8787
8888static void add_load_option (DYNAMIC_STRING * str , const char * option ,
8989 const char * option_value );
90- static ulong find_set (TYPELIB * lib , const char * x , uint length ,
90+ static ulong find_set (TYPELIB * lib , const char * x , size_t length ,
9191 char * * err_pos , uint * err_len );
9292static char * alloc_query_str (ulong size );
9393
@@ -885,7 +885,7 @@ get_one_option(int optid, const struct my_option *opt MY_ATTRIBUTE((unused)),
885885 opt_set_charset = 0 ;
886886 opt_compatible_mode_str = argument ;
887887 opt_compatible_mode = find_set (& compatible_mode_typelib ,
888- argument , ( uint ) strlen (argument ),
888+ argument , strlen (argument ),
889889 & err_ptr , & err_len );
890890 if (err_len )
891891 {
@@ -895,7 +895,7 @@ get_one_option(int optid, const struct my_option *opt MY_ATTRIBUTE((unused)),
895895 }
896896#if !defined(DBUG_OFF )
897897 {
898- uint size_for_sql_mode = 0 ;
898+ size_t size_for_sql_mode = 0 ;
899899 const char * * ptr ;
900900 for (ptr = compatible_mode_names ; * ptr ; ptr ++ )
901901 size_for_sql_mode += strlen (* ptr );
@@ -1182,8 +1182,8 @@ static int fetch_db_collation(const char *db_name,
11821182 break ;
11831183 }
11841184
1185- strncpy (db_cl_name , db_cl_row [0 ], db_cl_size );
1186- db_cl_name [db_cl_size - 1 ]= 0 ; /* just in case. */
1185+ strncpy (db_cl_name , db_cl_row [0 ], db_cl_size - 1 );
1186+ db_cl_name [db_cl_size - 1 ]= 0 ;
11871187
11881188 } while (FALSE);
11891189
@@ -1194,7 +1194,7 @@ static int fetch_db_collation(const char *db_name,
11941194
11951195
11961196static char * my_case_str (const char * str ,
1197- uint str_len ,
1197+ size_t str_len ,
11981198 const char * token ,
11991199 uint token_len )
12001200{
@@ -1410,7 +1410,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
14101410*/
14111411
14121412static char * cover_definer_clause (const char * stmt_str ,
1413- uint stmt_length ,
1413+ size_t stmt_length ,
14141414 const char * definer_version_str ,
14151415 uint definer_version_length ,
14161416 const char * stmt_version_str ,
@@ -1603,14 +1603,14 @@ static void dbDisconnect(char *host)
16031603} /* dbDisconnect */
16041604
16051605
1606- static void unescape (FILE * file ,char * pos ,uint length )
1606+ static void unescape (FILE * file ,char * pos , size_t length )
16071607{
16081608 char * tmp ;
16091609 DBUG_ENTER ("unescape" );
16101610 if (!(tmp = (char * ) my_malloc (length * 2 + 1 , MYF (MY_WME ))))
16111611 die (EX_MYSQLERR , "Couldn't allocate memory" );
16121612
1613- mysql_real_escape_string (& mysql_connection , tmp , pos , length );
1613+ mysql_real_escape_string (& mysql_connection , tmp , pos , ( ulong ) length );
16141614 fputc ('\'' , file );
16151615 fputs (tmp , file );
16161616 fputc ('\'' , file );
@@ -1724,7 +1724,7 @@ static char *quote_for_like(const char *name, char *buff)
17241724 Quote '<' '>' '&' '\"' chars and print a string to the xml_file.
17251725*/
17261726
1727- static void print_quoted_xml (FILE * xml_file , const char * str , ulong len ,
1727+ static void print_quoted_xml (FILE * xml_file , const char * str , size_t len ,
17281728 my_bool is_attribute_name )
17291729{
17301730 const char * end ;
@@ -1983,7 +1983,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
19831983 squeezed to a single hyphen.
19841984*/
19851985
1986- static void print_xml_comment (FILE * xml_file , ulong len ,
1986+ static void print_xml_comment (FILE * xml_file , size_t len ,
19871987 const char * comment_string )
19881988{
19891989 const char * end ;
@@ -2100,7 +2100,7 @@ static uint dump_events_for_db(char *db)
21002100 DBUG_ENTER ("dump_events_for_db" );
21012101 DBUG_PRINT ("enter" , ("db: '%s'" , db ));
21022102
2103- mysql_real_escape_string (mysql , db_name_buff , db , strlen (db ));
2103+ mysql_real_escape_string (mysql , db_name_buff , db , ( ulong ) strlen (db ));
21042104
21052105 /* nice comments */
21062106 print_comment (sql_file , 0 ,
@@ -2219,6 +2219,11 @@ static uint dump_events_for_db(char *db)
22192219 (const char * ) (query_str != NULL ? query_str : row [3 ]),
22202220 (const char * ) delimiter );
22212221
2222+ if (query_str )
2223+ {
2224+ my_free (query_str );
2225+ query_str = NULL ;
2226+ }
22222227 restore_time_zone (sql_file , delimiter );
22232228 restore_sql_mode (sql_file , delimiter );
22242229
@@ -2312,7 +2317,7 @@ static uint dump_routines_for_db(char *db)
23122317 DBUG_ENTER ("dump_routines_for_db" );
23132318 DBUG_PRINT ("enter" , ("db: '%s'" , db ));
23142319
2315- mysql_real_escape_string (mysql , db_name_buff , db , strlen (db ));
2320+ mysql_real_escape_string (mysql , db_name_buff , db , ( ulong ) strlen (db ));
23162321
23172322 /* nice comments */
23182323 print_comment (sql_file , 0 ,
@@ -2366,9 +2371,9 @@ static uint dump_routines_for_db(char *db)
23662371 if the user has EXECUTE privilege he see routine names, but NOT the
23672372 routine body of other routines that are not the creator of!
23682373 */
2369- DBUG_PRINT ("info" ,("length of body for %s row[2] '%s' is %d " ,
2374+ DBUG_PRINT ("info" ,("length of body for %s row[2] '%s' is %zu " ,
23702375 routine_name , row [2 ] ? row [2 ] : "(null)" ,
2371- row [2 ] ? ( int ) strlen (row [2 ]) : 0 ));
2376+ row [2 ] ? strlen (row [2 ]) : 0 ));
23722377 if (row [2 ] == NULL )
23732378 {
23742379 print_comment (sql_file , 1 , "\n-- insufficient privileges to %s\n" ,
@@ -3915,7 +3920,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
39153920 int i ;
39163921 char name_buff [NAME_LEN * 2 + 3 ];
39173922
3918- mysql_real_escape_string (mysql , name_buff , db , strlen (db ));
3923+ mysql_real_escape_string (mysql , name_buff , db , ( ulong ) strlen (db ));
39193924
39203925 init_dynamic_string_checked (& where , " AND TABLESPACE_NAME IN ("
39213926 "SELECT DISTINCT TABLESPACE_NAME FROM"
@@ -3928,7 +3933,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
39283933 for (i = 0 ; i < tables ; i ++ )
39293934 {
39303935 mysql_real_escape_string (mysql , name_buff ,
3931- table_names [i ], strlen (table_names [i ]));
3936+ table_names [i ], ( ulong ) strlen (table_names [i ]));
39323937
39333938 dynstr_append_checked (& where , "'" );
39343939 dynstr_append_checked (& where , name_buff );
@@ -3959,7 +3964,7 @@ static int dump_tablespaces_for_databases(char** databases)
39593964 {
39603965 char db_name_buff [NAME_LEN * 2 + 3 ];
39613966 mysql_real_escape_string (mysql , db_name_buff ,
3962- databases [i ], strlen (databases [i ]));
3967+ databases [i ], ( ulong ) strlen (databases [i ]));
39633968 dynstr_append_checked (& where , "'" );
39643969 dynstr_append_checked (& where , db_name_buff );
39653970 dynstr_append_checked (& where , "'," );
@@ -5086,7 +5091,7 @@ static int start_transaction(MYSQL *mysql_con)
50865091}
50875092
50885093
5089- static ulong find_set (TYPELIB * lib , const char * x , uint length ,
5094+ static ulong find_set (TYPELIB * lib , const char * x , size_t length ,
50905095 char * * err_pos , uint * err_len )
50915096{
50925097 const char * end = x + length ;
@@ -5144,7 +5149,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
51445149 fputc (' ' ,file );
51455150 fputs (prefix , file );
51465151 if (string_value )
5147- unescape (file ,row [0 ],( uint ) strlen (row [0 ]));
5152+ unescape (file ,row [0 ], strlen (row [0 ]));
51485153 else
51495154 fputs (row [0 ], file );
51505155 check_io (file );
@@ -5554,8 +5559,8 @@ static my_bool get_view_structure(char *table, char* db)
55545559 verbose_msg ("-- Retrieving view structure for table %s...\n" , table );
55555560
55565561#ifdef NOT_REALLY_USED_YET
5557- sprintf ( insert_pat ,"SET SQL_QUOTE_SHOW_CREATE=%d" ,
5558- (opt_quoted || opt_keywords ));
5562+ dynstr_append_checked ( & insert_pat , "SET SQL_QUOTE_SHOW_CREATE=" );
5563+ dynstr_append_checked ( & insert_pat , (opt_quoted || opt_keywords )? "1" : "0" );
55595564#endif
55605565
55615566 result_table = quote_name (table , table_buff , 1 );
0 commit comments