diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
commit | 6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch) | |
tree | 3603f88e1b3bd1e622edb182cccd882dd31ddc8a /client/mysqlslap.c | |
parent | f271100836d8a91a775894ec36b869a66a3145e5 (diff) | |
download | mariadb-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 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index f0ad2f40abc..83c5838f739 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -144,7 +144,7 @@ static unsigned long connect_flags= CLIENT_MULTI_RESULTS | CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS; -static int verbose, delimiter_length; +static int verbose; static uint commit_rate; static uint detach_rate; const char *num_int_cols_opt; @@ -263,7 +263,7 @@ void option_cleanup(option_string *stmt); void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr); static int run_statements(MYSQL *mysql, statement *stmt); int slap_connect(MYSQL *mysql); -static int run_query(MYSQL *mysql, const char *query, int len); +static int run_query(MYSQL *mysql, const char *query, size_t len); static const char ALPHANUMERICS[]= "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz"; @@ -343,9 +343,6 @@ int main(int argc, char **argv) if (auto_generate_sql) srandom((uint)time(NULL)); - /* globals? Yes, so we only have to run strlen once */ - delimiter_length= strlen(delimiter); - if (argc > 2) { fprintf(stderr,"%s: Too many arguments\n",my_progname); @@ -1552,18 +1549,18 @@ get_options(int *argc,char ***argv) } -static int run_query(MYSQL *mysql, const char *query, int len) +static int run_query(MYSQL *mysql, const char *query, size_t len) { if (opt_only_print) { - printf("%.*s;\n", len, query); + printf("%.*s;\n", (int)len, query); return 0; } if (verbose >= 3) - printf("%.*s;\n", len, query); + printf("%.*s;\n", (int)len, query); - return mysql_real_query(mysql, query, len); + return mysql_real_query(mysql, query, (ulong)len); } @@ -2131,7 +2128,7 @@ parse_delimiter(const char *script, statement **stmt, char delm) char *ptr= (char *)script; statement **sptr= stmt; statement *tmp; - uint length= strlen(script); + size_t length= strlen(script); uint count= 0; /* We know that there is always one */ for (tmp= *sptr= (statement *)my_malloc(sizeof(statement), |