mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
This commit is contained in:
@@ -104,7 +104,7 @@ extern uint test_flags;
|
||||
extern ulong bytes_sent, bytes_received, net_big_packet_count;
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
#define USE_QUERY_CACHE
|
||||
extern void query_cache_insert(void *thd, const char *packet, ulong length,
|
||||
extern void query_cache_insert(void *thd, const char *packet, size_t length,
|
||||
unsigned pkt_nr);
|
||||
#endif // HAVE_QUERY_CACHE
|
||||
#define update_statistics(A) A
|
||||
@@ -117,7 +117,7 @@ extern my_bool thd_net_is_killed();
|
||||
#endif
|
||||
|
||||
|
||||
static my_bool net_write_buff(NET *, const uchar *, ulong);
|
||||
static my_bool net_write_buff(NET *, const uchar *, size_t len);
|
||||
|
||||
my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags);
|
||||
|
||||
@@ -542,13 +542,13 @@ net_write_command(NET *net,uchar command,
|
||||
*/
|
||||
|
||||
static my_bool
|
||||
net_write_buff(NET *net, const uchar *packet, ulong len)
|
||||
net_write_buff(NET *net, const uchar *packet, size_t len)
|
||||
{
|
||||
ulong left_length;
|
||||
size_t left_length;
|
||||
if (net->compress && net->max_packet > MAX_PACKET_LENGTH)
|
||||
left_length= (ulong) (MAX_PACKET_LENGTH - (net->write_pos - net->buff));
|
||||
left_length= (MAX_PACKET_LENGTH - (net->write_pos - net->buff));
|
||||
else
|
||||
left_length= (ulong) (net->buff_end - net->write_pos);
|
||||
left_length= (net->buff_end - net->write_pos);
|
||||
|
||||
#ifdef DEBUG_DATA_PACKETS
|
||||
DBUG_DUMP("data_written", packet, len);
|
||||
@@ -1034,7 +1034,7 @@ retry:
|
||||
#endif
|
||||
if (i == 0)
|
||||
{ /* First parts is packet length */
|
||||
ulong helping;
|
||||
size_t helping;
|
||||
#ifndef DEBUG_DATA_PACKETS
|
||||
DBUG_DUMP("packet_header", net->buff+net->where_b,
|
||||
NET_HEADER_SIZE);
|
||||
@@ -1238,7 +1238,7 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
||||
size_t total_length= 0;
|
||||
do
|
||||
{
|
||||
net->where_b += len;
|
||||
net->where_b += (ulong)len;
|
||||
total_length += len;
|
||||
len = my_real_read(net,&complen, 0);
|
||||
} while (len == MAX_PACKET_LENGTH);
|
||||
@@ -1251,10 +1251,10 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
||||
if (len != packet_error)
|
||||
{
|
||||
net->read_pos[len]=0; /* Safeguard for mysql_use_result */
|
||||
*reallen = len;
|
||||
*reallen = (ulong)len;
|
||||
}
|
||||
MYSQL_NET_READ_DONE(0, len);
|
||||
return len;
|
||||
return (ulong)len;
|
||||
#ifdef HAVE_COMPRESS
|
||||
}
|
||||
else
|
||||
@@ -1352,7 +1352,7 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
||||
MYSQL_NET_READ_DONE(1, 0);
|
||||
return packet_error;
|
||||
}
|
||||
buf_length+= complen;
|
||||
buf_length+= (ulong)complen;
|
||||
*reallen += packet_len;
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
||||
}
|
||||
#endif /* HAVE_COMPRESS */
|
||||
MYSQL_NET_READ_DONE(0, len);
|
||||
return len;
|
||||
return (ulong)len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user