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
@@ -852,7 +852,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
852
852
opt_set_charset = 0 ;
853
853
opt_compatible_mode_str = argument ;
854
854
opt_compatible_mode = find_set (& compatible_mode_typelib ,
855
- argument , ( uint ) strlen (argument ),
855
+ argument , strlen (argument ),
856
856
& err_ptr , & err_len );
857
857
if (err_len )
858
858
{
@@ -862,7 +862,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
862
862
}
863
863
#if !defined(DBUG_OFF )
864
864
{
865
- uint size_for_sql_mode = 0 ;
865
+ size_t size_for_sql_mode = 0 ;
866
866
const char * * ptr ;
867
867
for (ptr = compatible_mode_names ; * ptr ; ptr ++ )
868
868
size_for_sql_mode += strlen (* ptr );
@@ -1138,8 +1138,8 @@ static int fetch_db_collation(const char *db_name,
1138
1138
break ;
1139
1139
}
1140
1140
1141
- strncpy (db_cl_name , db_cl_row [0 ], db_cl_size );
1142
- db_cl_name [db_cl_size - 1 ]= 0 ; /* just in case. */
1141
+ strncpy (db_cl_name , db_cl_row [0 ], db_cl_size - 1 );
1142
+ db_cl_name [db_cl_size - 1 ]= 0 ;
1143
1143
1144
1144
} while (FALSE);
1145
1145
@@ -1150,7 +1150,7 @@ static int fetch_db_collation(const char *db_name,
1150
1150
1151
1151
1152
1152
static char * my_case_str (const char * str ,
1153
- uint str_len ,
1153
+ size_t str_len ,
1154
1154
const char * token ,
1155
1155
uint token_len )
1156
1156
{
@@ -1366,7 +1366,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
1366
1366
*/
1367
1367
1368
1368
static char * cover_definer_clause (const char * stmt_str ,
1369
- uint stmt_length ,
1369
+ size_t stmt_length ,
1370
1370
const char * definer_version_str ,
1371
1371
uint definer_version_length ,
1372
1372
const char * stmt_version_str ,
@@ -1548,14 +1548,14 @@ static void dbDisconnect(char *host)
1548
1548
} /* dbDisconnect */
1549
1549
1550
1550
1551
- static void unescape (FILE * file ,char * pos ,uint length )
1551
+ static void unescape (FILE * file ,char * pos , size_t length )
1552
1552
{
1553
1553
char * tmp ;
1554
1554
DBUG_ENTER ("unescape" );
1555
1555
if (!(tmp = (char * ) my_malloc (length * 2 + 1 , MYF (MY_WME ))))
1556
1556
die (EX_MYSQLERR , "Couldn't allocate memory" );
1557
1557
1558
- mysql_real_escape_string (& mysql_connection , tmp , pos , length );
1558
+ mysql_real_escape_string (& mysql_connection , tmp , pos , ( ulong ) length );
1559
1559
fputc ('\'' , file );
1560
1560
fputs (tmp , file );
1561
1561
fputc ('\'' , file );
@@ -1669,7 +1669,7 @@ static char *quote_for_like(const char *name, char *buff)
1669
1669
Quote '<' '>' '&' '\"' chars and print a string to the xml_file.
1670
1670
*/
1671
1671
1672
- static void print_quoted_xml (FILE * xml_file , const char * str , ulong len ,
1672
+ static void print_quoted_xml (FILE * xml_file , const char * str , size_t len ,
1673
1673
my_bool is_attribute_name )
1674
1674
{
1675
1675
const char * end ;
@@ -1928,7 +1928,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
1928
1928
squeezed to a single hyphen.
1929
1929
*/
1930
1930
1931
- static void print_xml_comment (FILE * xml_file , ulong len ,
1931
+ static void print_xml_comment (FILE * xml_file , size_t len ,
1932
1932
const char * comment_string )
1933
1933
{
1934
1934
const char * end ;
@@ -2045,7 +2045,7 @@ static uint dump_events_for_db(char *db)
2045
2045
DBUG_ENTER ("dump_events_for_db" );
2046
2046
DBUG_PRINT ("enter" , ("db: '%s'" , db ));
2047
2047
2048
- mysql_real_escape_string (mysql , db_name_buff , db , strlen (db ));
2048
+ mysql_real_escape_string (mysql , db_name_buff , db , ( ulong ) strlen (db ));
2049
2049
2050
2050
/* nice comments */
2051
2051
print_comment (sql_file , 0 ,
@@ -2164,6 +2164,11 @@ static uint dump_events_for_db(char *db)
2164
2164
(const char * ) (query_str != NULL ? query_str : row [3 ]),
2165
2165
(const char * ) delimiter );
2166
2166
2167
+ if (query_str )
2168
+ {
2169
+ my_free (query_str );
2170
+ query_str = NULL ;
2171
+ }
2167
2172
restore_time_zone (sql_file , delimiter );
2168
2173
restore_sql_mode (sql_file , delimiter );
2169
2174
@@ -2257,7 +2262,7 @@ static uint dump_routines_for_db(char *db)
2257
2262
DBUG_ENTER ("dump_routines_for_db" );
2258
2263
DBUG_PRINT ("enter" , ("db: '%s'" , db ));
2259
2264
2260
- mysql_real_escape_string (mysql , db_name_buff , db , strlen (db ));
2265
+ mysql_real_escape_string (mysql , db_name_buff , db , ( ulong ) strlen (db ));
2261
2266
2262
2267
/* nice comments */
2263
2268
print_comment (sql_file , 0 ,
@@ -2311,9 +2316,9 @@ static uint dump_routines_for_db(char *db)
2311
2316
if the user has EXECUTE privilege he see routine names, but NOT the
2312
2317
routine body of other routines that are not the creator of!
2313
2318
*/
2314
- DBUG_PRINT ("info" ,("length of body for %s row[2] '%s' is %d " ,
2319
+ DBUG_PRINT ("info" ,("length of body for %s row[2] '%s' is %zu " ,
2315
2320
routine_name , row [2 ] ? row [2 ] : "(null)" ,
2316
- row [2 ] ? ( int ) strlen (row [2 ]) : 0 ));
2321
+ row [2 ] ? strlen (row [2 ]) : 0 ));
2317
2322
if (row [2 ] == NULL )
2318
2323
{
2319
2324
print_comment (sql_file , 1 , "\n-- insufficient privileges to %s\n" ,
@@ -3873,7 +3878,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
3873
3878
int i ;
3874
3879
char name_buff [NAME_LEN * 2 + 3 ];
3875
3880
3876
- mysql_real_escape_string (mysql , name_buff , db , strlen (db ));
3881
+ mysql_real_escape_string (mysql , name_buff , db , ( ulong ) strlen (db ));
3877
3882
3878
3883
init_dynamic_string_checked (& where , " AND TABLESPACE_NAME IN ("
3879
3884
"SELECT DISTINCT TABLESPACE_NAME FROM"
@@ -3886,7 +3891,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
3886
3891
for (i = 0 ; i < tables ; i ++ )
3887
3892
{
3888
3893
mysql_real_escape_string (mysql , name_buff ,
3889
- table_names [i ], strlen (table_names [i ]));
3894
+ table_names [i ], ( ulong ) strlen (table_names [i ]));
3890
3895
3891
3896
dynstr_append_checked (& where , "'" );
3892
3897
dynstr_append_checked (& where , name_buff );
@@ -3917,7 +3922,7 @@ static int dump_tablespaces_for_databases(char** databases)
3917
3922
{
3918
3923
char db_name_buff [NAME_LEN * 2 + 3 ];
3919
3924
mysql_real_escape_string (mysql , db_name_buff ,
3920
- databases [i ], strlen (databases [i ]));
3925
+ databases [i ], ( ulong ) strlen (databases [i ]));
3921
3926
dynstr_append_checked (& where , "'" );
3922
3927
dynstr_append_checked (& where , db_name_buff );
3923
3928
dynstr_append_checked (& where , "'," );
@@ -4927,7 +4932,7 @@ static int start_transaction(MYSQL *mysql_con)
4927
4932
}
4928
4933
4929
4934
4930
- static ulong find_set (TYPELIB * lib , const char * x , uint length ,
4935
+ static ulong find_set (TYPELIB * lib , const char * x , size_t length ,
4931
4936
char * * err_pos , uint * err_len )
4932
4937
{
4933
4938
const char * end = x + length ;
@@ -4985,7 +4990,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
4985
4990
fputc (' ' ,file );
4986
4991
fputs (prefix , file );
4987
4992
if (string_value )
4988
- unescape (file ,row [0 ],( uint ) strlen (row [0 ]));
4993
+ unescape (file ,row [0 ], strlen (row [0 ]));
4989
4994
else
4990
4995
fputs (row [0 ], file );
4991
4996
check_io (file );
@@ -5238,8 +5243,8 @@ static my_bool get_view_structure(char *table, char* db)
5238
5243
verbose_msg ("-- Retrieving view structure for table %s...\n" , table );
5239
5244
5240
5245
#ifdef NOT_REALLY_USED_YET
5241
- sprintf ( insert_pat , "SET SQL_QUOTE_SHOW_CREATE=%d" ,
5242
- (opt_quoted || opt_keywords ));
5246
+ dynstr_append_checked ( & insert_pat , "SET SQL_QUOTE_SHOW_CREATE=" );
5247
+ dynstr_append_checked ( & insert_pat , (opt_quoted || opt_keywords )? "1" : "0" );
5243
5248
#endif
5244
5249
5245
5250
result_table = quote_name (table , table_buff , 1 );
0 commit comments