summaryrefslogtreecommitdiff
path: root/sql/net_serv.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-02-06 12:55:58 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2018-02-06 12:55:58 +0000
commit6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch)
tree3603f88e1b3bd1e622edb182cccd882dd31ddc8a /sql/net_serv.cc
parentf271100836d8a91a775894ec36b869a66a3145e5 (diff)
downloadmariadb-git-6c279ad6a71c63cb595fde7c951aadb31c3dbebc.tar.gz
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.
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r--sql/net_serv.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index fd0139c1e03..cab9b0ede69 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -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;
}