summaryrefslogtreecommitdiff
path: root/sql-common
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-common
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-common')
-rw-r--r--sql-common/client.c4
-rw-r--r--sql-common/my_time.c4
-rw-r--r--sql-common/mysql_async.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index b7a23e722f4..70edff9b737 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2972,7 +2972,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
/* new "use different plugin" packet */
uint len;
auth_plugin_name= (char*)mysql->net.read_pos + 1;
- len= strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */
+ len= (uint)strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */
mpvio.cached_server_reply.pkt_len= pkt_length - len - 2;
mpvio.cached_server_reply.pkt= mysql->net.read_pos + len + 2;
DBUG_PRINT ("info", ("change plugin packet from server for plugin %s",
@@ -3361,7 +3361,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
DBUG_PRINT("info", ("Connect socket"));
status= connect_sync_or_async(mysql, net, sock,
- t_res->ai_addr, t_res->ai_addrlen);
+ t_res->ai_addr, (uint)t_res->ai_addrlen);
/*
Here we rely on my_connect() to return success only if the
connect attempt was really successful. Otherwise we would stop
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index c8d8453b62f..eac02581f0d 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -293,7 +293,7 @@ static void get_microseconds(ulong *val, MYSQL_TIME_STATUS *status,
#define MAX_DATE_PARTS 8
my_bool
-str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
+str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time,
ulonglong flags, MYSQL_TIME_STATUS *status)
{
const char *end=str+length, *pos;
@@ -457,7 +457,7 @@ err:
TRUE on error
*/
-my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
+my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time,
ulonglong fuzzydate, MYSQL_TIME_STATUS *status)
{
ulong date[5];
diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c
index 1bac16edd1e..a19955c49de 100644
--- a/sql-common/mysql_async.c
+++ b/sql-common/mysql_async.c
@@ -135,7 +135,7 @@ my_recv_async(struct mysql_async_context *b, my_socket fd,
for (;;)
{
- res= recv(fd, buf, size, IF_WIN(0, MSG_DONTWAIT));
+ res= recv(fd, buf, (int)size, IF_WIN(0, MSG_DONTWAIT));
if (res >= 0 || IS_BLOCKING_ERROR())
return res;
b->events_to_wait_for= MYSQL_WAIT_READ;
@@ -163,7 +163,7 @@ my_send_async(struct mysql_async_context *b, my_socket fd,
for (;;)
{
- res= send(fd, buf, size, IF_WIN(0, MSG_DONTWAIT));
+ res= send(fd, buf, (int)size, IF_WIN(0, MSG_DONTWAIT));
if (res >= 0 || IS_BLOCKING_ERROR())
return res;
b->events_to_wait_for= MYSQL_WAIT_WRITE;