86
86
87
87
static void add_load_option (DYNAMIC_STRING * str , const char * option ,
88
88
const char * option_value );
89
- static ulong find_set (TYPELIB * lib , const char * x , uint length ,
89
+ static ulong find_set (TYPELIB * lib , const char * x , size_t length ,
90
90
char * * err_pos , uint * err_len );
91
91
static char * alloc_query_str (ulong size );
92
92
@@ -867,7 +867,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
867
867
opt_set_charset = 0 ;
868
868
opt_compatible_mode_str = argument ;
869
869
opt_compatible_mode = find_set (& compatible_mode_typelib ,
870
- argument , ( uint ) strlen (argument ),
870
+ argument , strlen (argument ),
871
871
& err_ptr , & err_len );
872
872
if (err_len )
873
873
{
@@ -877,7 +877,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
877
877
}
878
878
#if !defined(DBUG_OFF )
879
879
{
880
- uint size_for_sql_mode = 0 ;
880
+ size_t size_for_sql_mode = 0 ;
881
881
const char * * ptr ;
882
882
for (ptr = compatible_mode_names ; * ptr ; ptr ++ )
883
883
size_for_sql_mode += strlen (* ptr );
@@ -1153,8 +1153,8 @@ static int fetch_db_collation(const char *db_name,
1153
1153
break ;
1154
1154
}
1155
1155
1156
- strncpy (db_cl_name , db_cl_row [0 ], db_cl_size );
1157
- db_cl_name [db_cl_size - 1 ]= 0 ; /* just in case. */
1156
+ strncpy (db_cl_name , db_cl_row [0 ], db_cl_size - 1 );
1157
+ db_cl_name [db_cl_size - 1 ]= 0 ;
1158
1158
1159
1159
} while (FALSE);
1160
1160
@@ -1165,7 +1165,7 @@ static int fetch_db_collation(const char *db_name,
1165
1165
1166
1166
1167
1167
static char * my_case_str (const char * str ,
1168
- uint str_len ,
1168
+ size_t str_len ,
1169
1169
const char * token ,
1170
1170
uint token_len )
1171
1171
{
@@ -1381,7 +1381,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
1381
1381
*/
1382
1382
1383
1383
static char * cover_definer_clause (const char * stmt_str ,
1384
- uint stmt_length ,
1384
+ size_t stmt_length ,
1385
1385
const char * definer_version_str ,
1386
1386
uint definer_version_length ,
1387
1387
const char * stmt_version_str ,
@@ -1567,14 +1567,14 @@ static void dbDisconnect(char *host)
1567
1567
} /* dbDisconnect */
1568
1568
1569
1569
1570
- static void unescape (FILE * file ,char * pos ,uint length )
1570
+ static void unescape (FILE * file ,char * pos , size_t length )
1571
1571
{
1572
1572
char * tmp ;
1573
1573
DBUG_ENTER ("unescape" );
1574
1574
if (!(tmp = (char * ) my_malloc (length * 2 + 1 , MYF (MY_WME ))))
1575
1575
die (EX_MYSQLERR , "Couldn't allocate memory" );
1576
1576
1577
- mysql_real_escape_string (& mysql_connection , tmp , pos , length );
1577
+ mysql_real_escape_string (& mysql_connection , tmp , pos , ( ulong ) length );
1578
1578
fputc ('\'' , file );
1579
1579
fputs (tmp , file );
1580
1580
fputc ('\'' , file );
@@ -1688,7 +1688,7 @@ static char *quote_for_like(const char *name, char *buff)
1688
1688
Quote '<' '>' '&' '\"' chars and print a string to the xml_file.
1689
1689
*/
1690
1690
1691
- static void print_quoted_xml (FILE * xml_file , const char * str , ulong len ,
1691
+ static void print_quoted_xml (FILE * xml_file , const char * str , size_t len ,
1692
1692
my_bool is_attribute_name )
1693
1693
{
1694
1694
const char * end ;
@@ -1947,7 +1947,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
1947
1947
squeezed to a single hyphen.
1948
1948
*/
1949
1949
1950
- static void print_xml_comment (FILE * xml_file , ulong len ,
1950
+ static void print_xml_comment (FILE * xml_file , size_t len ,
1951
1951
const char * comment_string )
1952
1952
{
1953
1953
const char * end ;
@@ -2064,7 +2064,7 @@ static uint dump_events_for_db(char *db)
2064
2064
DBUG_ENTER ("dump_events_for_db" );
2065
2065
DBUG_PRINT ("enter" , ("db: '%s'" , db ));
2066
2066
2067
- mysql_real_escape_string (mysql , db_name_buff , db , strlen (db ));
2067
+ mysql_real_escape_string (mysql , db_name_buff , db , ( ulong ) strlen (db ));
2068
2068
2069
2069
/* nice comments */
2070
2070
print_comment (sql_file , 0 ,
@@ -2183,6 +2183,11 @@ static uint dump_events_for_db(char *db)
2183
2183
(const char * ) (query_str != NULL ? query_str : row [3 ]),
2184
2184
(const char * ) delimiter );
2185
2185
2186
+ if (query_str )
2187
+ {
2188
+ my_free (query_str );
2189
+ query_str = NULL ;
2190
+ }
2186
2191
restore_time_zone (sql_file , delimiter );
2187
2192
restore_sql_mode (sql_file , delimiter );
2188
2193
@@ -2276,7 +2281,7 @@ static uint dump_routines_for_db(char *db)
2276
2281
DBUG_ENTER ("dump_routines_for_db" );
2277
2282
DBUG_PRINT ("enter" , ("db: '%s'" , db ));
2278
2283
2279
- mysql_real_escape_string (mysql , db_name_buff , db , strlen (db ));
2284
+ mysql_real_escape_string (mysql , db_name_buff , db , ( ulong ) strlen (db ));
2280
2285
2281
2286
/* nice comments */
2282
2287
print_comment (sql_file , 0 ,
@@ -2330,9 +2335,9 @@ static uint dump_routines_for_db(char *db)
2330
2335
if the user has EXECUTE privilege he see routine names, but NOT the
2331
2336
routine body of other routines that are not the creator of!
2332
2337
*/
2333
- DBUG_PRINT ("info" ,("length of body for %s row[2] '%s' is %d " ,
2338
+ DBUG_PRINT ("info" ,("length of body for %s row[2] '%s' is %zu " ,
2334
2339
routine_name , row [2 ] ? row [2 ] : "(null)" ,
2335
- row [2 ] ? ( int ) strlen (row [2 ]) : 0 ));
2340
+ row [2 ] ? strlen (row [2 ]) : 0 ));
2336
2341
if (row [2 ] == NULL )
2337
2342
{
2338
2343
print_comment (sql_file , 1 , "\n-- insufficient privileges to %s\n" ,
@@ -3902,7 +3907,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
3902
3907
int i ;
3903
3908
char name_buff [NAME_LEN * 2 + 3 ];
3904
3909
3905
- mysql_real_escape_string (mysql , name_buff , db , strlen (db ));
3910
+ mysql_real_escape_string (mysql , name_buff , db , ( ulong ) strlen (db ));
3906
3911
3907
3912
init_dynamic_string_checked (& where , " AND TABLESPACE_NAME IN ("
3908
3913
"SELECT DISTINCT TABLESPACE_NAME FROM"
@@ -3915,7 +3920,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
3915
3920
for (i = 0 ; i < tables ; i ++ )
3916
3921
{
3917
3922
mysql_real_escape_string (mysql , name_buff ,
3918
- table_names [i ], strlen (table_names [i ]));
3923
+ table_names [i ], ( ulong ) strlen (table_names [i ]));
3919
3924
3920
3925
dynstr_append_checked (& where , "'" );
3921
3926
dynstr_append_checked (& where , name_buff );
@@ -3946,7 +3951,7 @@ static int dump_tablespaces_for_databases(char** databases)
3946
3951
{
3947
3952
char db_name_buff [NAME_LEN * 2 + 3 ];
3948
3953
mysql_real_escape_string (mysql , db_name_buff ,
3949
- databases [i ], strlen (databases [i ]));
3954
+ databases [i ], ( ulong ) strlen (databases [i ]));
3950
3955
dynstr_append_checked (& where , "'" );
3951
3956
dynstr_append_checked (& where , db_name_buff );
3952
3957
dynstr_append_checked (& where , "'," );
@@ -5018,7 +5023,7 @@ static int start_transaction(MYSQL *mysql_con)
5018
5023
}
5019
5024
5020
5025
5021
- static ulong find_set (TYPELIB * lib , const char * x , uint length ,
5026
+ static ulong find_set (TYPELIB * lib , const char * x , size_t length ,
5022
5027
char * * err_pos , uint * err_len )
5023
5028
{
5024
5029
const char * end = x + length ;
@@ -5076,7 +5081,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
5076
5081
fputc (' ' ,file );
5077
5082
fputs (prefix , file );
5078
5083
if (string_value )
5079
- unescape (file ,row [0 ],( uint ) strlen (row [0 ]));
5084
+ unescape (file ,row [0 ], strlen (row [0 ]));
5080
5085
else
5081
5086
fputs (row [0 ], file );
5082
5087
check_io (file );
@@ -5329,8 +5334,8 @@ static my_bool get_view_structure(char *table, char* db)
5329
5334
verbose_msg ("-- Retrieving view structure for table %s...\n" , table );
5330
5335
5331
5336
#ifdef NOT_REALLY_USED_YET
5332
- sprintf ( insert_pat , "SET SQL_QUOTE_SHOW_CREATE=%d" ,
5333
- (opt_quoted || opt_keywords ));
5337
+ dynstr_append_checked ( & insert_pat , "SET SQL_QUOTE_SHOW_CREATE=" );
5338
+ dynstr_append_checked ( & insert_pat , (opt_quoted || opt_keywords )? "1" : "0" );
5334
5339
#endif
5335
5340
5336
5341
result_table = quote_name (table , table_buff , 1 );
0 commit comments