@@ -1719,7 +1719,7 @@ void log_msg(const char *fmt, ...)
1719
1719
va_end (args);
1720
1720
1721
1721
dynstr_append_mem (&ds_res, buff, len);
1722
- dynstr_append (&ds_res, " \n " );
1722
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " \n " ) );
1723
1723
1724
1724
DBUG_VOID_RETURN;
1725
1725
}
@@ -1854,7 +1854,7 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
1854
1854
die (" Out of memory" );
1855
1855
1856
1856
dynstr_append_os_quoted (&ds_cmdline, tool_path, NullS);
1857
- dynstr_append (&ds_cmdline, " " );
1857
+ dynstr_append_mem (&ds_cmdline, STRING_WITH_LEN ( " " ) );
1858
1858
1859
1859
va_start (args, ds_res);
1860
1860
@@ -1865,13 +1865,13 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
1865
1865
dynstr_append_os_quoted (&ds_cmdline, arg, NullS);
1866
1866
else
1867
1867
dynstr_append (&ds_cmdline, arg);
1868
- dynstr_append (&ds_cmdline, " " );
1868
+ dynstr_append_mem (&ds_cmdline, STRING_WITH_LEN ( " " ) );
1869
1869
}
1870
1870
1871
1871
va_end (args);
1872
1872
1873
1873
#ifdef _WIN32
1874
- dynstr_append (&ds_cmdline, " \" " );
1874
+ dynstr_append_mem (&ds_cmdline, STRING_WITH_LEN ( " \" " ) );
1875
1875
#endif
1876
1876
1877
1877
DBUG_PRINT (" info" , (" Running: %s" , ds_cmdline.str ));
@@ -2006,8 +2006,8 @@ void show_diff(DYNAMIC_STRING* ds,
2006
2006
Fallback to dump both files to result file and inform
2007
2007
about installing "diff"
2008
2008
*/
2009
- dynstr_append (&ds_tmp, " \n " );
2010
- dynstr_append (&ds_tmp,
2009
+ char message[]=
2010
+ " \n "
2011
2011
" \n "
2012
2012
" The two files differ but it was not possible to execute 'diff' in\n "
2013
2013
" order to show only the difference. Instead the whole content of the\n "
@@ -2017,17 +2017,18 @@ void show_diff(DYNAMIC_STRING* ds,
2017
2017
#ifdef _WIN32
2018
2018
" or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n "
2019
2019
#endif
2020
- " \n " );
2020
+ " \n " ;
2021
+ dynstr_append_mem (&ds_tmp, message, sizeof (message));
2021
2022
2022
- dynstr_append (&ds_tmp, " --- " );
2023
+ dynstr_append_mem (&ds_tmp, STRING_WITH_LEN ( " --- " ) );
2023
2024
dynstr_append (&ds_tmp, filename1);
2024
- dynstr_append (&ds_tmp, " >>>\n " );
2025
+ dynstr_append_mem (&ds_tmp, STRING_WITH_LEN ( " >>>\n " ) );
2025
2026
cat_file (&ds_tmp, filename1);
2026
- dynstr_append (&ds_tmp, " <<<\n --- " );
2027
+ dynstr_append_mem (&ds_tmp, STRING_WITH_LEN ( " <<<\n --- " ) );
2027
2028
dynstr_append (&ds_tmp, filename1);
2028
- dynstr_append (&ds_tmp, " >>>\n " );
2029
+ dynstr_append_mem (&ds_tmp, STRING_WITH_LEN ( " >>>\n " ) );
2029
2030
cat_file (&ds_tmp, filename2);
2030
- dynstr_append (&ds_tmp, " <<<<\n " );
2031
+ dynstr_append_mem (&ds_tmp, STRING_WITH_LEN ( " <<<<\n " ) );
2031
2032
}
2032
2033
2033
2034
if (ds)
@@ -2806,9 +2807,9 @@ do_result_format_version(struct st_command *command)
2806
2807
2807
2808
set_result_format_version (version);
2808
2809
2809
- dynstr_append (&ds_res, " result_format: " );
2810
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " result_format: " ) );
2810
2811
dynstr_append_mem (&ds_res, ds_version.str , ds_version.length );
2811
- dynstr_append (&ds_res, " \n " );
2812
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " \n " ) );
2812
2813
dynstr_free (&ds_version);
2813
2814
}
2814
2815
@@ -3355,7 +3356,7 @@ void do_exec(struct st_command *command)
3355
3356
if (disable_result_log)
3356
3357
{
3357
3358
/* Collect stderr output as well, for the case app. crashes or returns error.*/
3358
- dynstr_append (&ds_cmd, " 2>&1" );
3359
+ dynstr_append_mem (&ds_cmd, STRING_WITH_LEN ( " 2>&1" ) );
3359
3360
}
3360
3361
3361
3362
DBUG_PRINT (" info" , (" Executing '%s' as '%s'" ,
@@ -3557,9 +3558,9 @@ void do_system(struct st_command *command)
3557
3558
else
3558
3559
{
3559
3560
/* If ! abort_on_error, log message and continue */
3560
- dynstr_append (&ds_res, " system command '" );
3561
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " system command '" ) );
3561
3562
replace_dynstr_append (&ds_res, command->first_argument );
3562
- dynstr_append (&ds_res, " ' failed\n " );
3563
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " ' failed\n " ) );
3563
3564
}
3564
3565
}
3565
3566
@@ -4026,7 +4027,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
4026
4027
wild_compare (file->name , ds_wild->str , 0 ))
4027
4028
continue ;
4028
4029
replace_dynstr_append (ds, file->name );
4029
- dynstr_append (ds, " \n " );
4030
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " \n " ) );
4030
4031
}
4031
4032
set_wild_chars (0 );
4032
4033
my_dirend (dir_info);
@@ -7684,9 +7685,10 @@ void append_metadata(DYNAMIC_STRING *ds,
7684
7685
uint num_fields)
7685
7686
{
7686
7687
MYSQL_FIELD *field_end;
7687
- dynstr_append (ds," Catalog\t Database\t Table\t Table_alias\t Column\t "
7688
- " Column_alias\t Type\t Length\t Max length\t Is_null\t "
7689
- " Flags\t Decimals\t Charsetnr\n " );
7688
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7689
+ " Catalog\t Database\t Table\t Table_alias\t Column\t "
7690
+ " Column_alias\t Type\t Length\t Max length\t Is_null\t "
7691
+ " Flags\t Decimals\t Charsetnr\n " ));
7690
7692
7691
7693
for (field_end= field+num_fields ;
7692
7694
field < field_end ;
@@ -7738,9 +7740,9 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
7738
7740
dynstr_append (ds, buf);
7739
7741
if (info)
7740
7742
{
7741
- dynstr_append (ds, " info: " );
7743
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " info: " ) );
7742
7744
dynstr_append (ds, info);
7743
- dynstr_append_mem (ds, " \n " , 1 );
7745
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " \n " ) );
7744
7746
}
7745
7747
}
7746
7748
@@ -7764,34 +7766,41 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
7764
7766
(enum_session_state_type) type,
7765
7767
&data, &data_length))
7766
7768
{
7767
- dynstr_append (ds, " -- " );
7769
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " -- " ) );
7768
7770
switch (type)
7769
7771
{
7770
7772
case SESSION_TRACK_SYSTEM_VARIABLES:
7771
- dynstr_append (ds, " Tracker : SESSION_TRACK_SYSTEM_VARIABLES\n " );
7773
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7774
+ " Tracker : SESSION_TRACK_SYSTEM_VARIABLES\n " ));
7772
7775
break ;
7773
7776
case SESSION_TRACK_SCHEMA:
7774
- dynstr_append (ds, " Tracker : SESSION_TRACK_SCHEMA\n " );
7777
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7778
+ " Tracker : SESSION_TRACK_SCHEMA\n " ));
7775
7779
break ;
7776
7780
case SESSION_TRACK_STATE_CHANGE:
7777
- dynstr_append (ds, " Tracker : SESSION_TRACK_STATE_CHANGE\n " );
7781
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7782
+ " Tracker : SESSION_TRACK_STATE_CHANGE\n " ));
7778
7783
break ;
7779
7784
case SESSION_TRACK_GTIDS:
7780
- dynstr_append (ds, " Tracker : SESSION_TRACK_GTIDS\n " );
7785
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7786
+ " Tracker : SESSION_TRACK_GTIDS\n " ));
7781
7787
break ;
7782
7788
case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:
7783
- dynstr_append (ds, " Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS\n " );
7789
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7790
+ " Tracker : "
7791
+ " SESSION_TRACK_TRANSACTION_CHARACTERISTICS\n " ));
7784
7792
break ;
7785
7793
case SESSION_TRACK_TRANSACTION_TYPE:
7786
- dynstr_append (ds, " Tracker : SESSION_TRACK_TRANSACTION_TYPE\n " );
7794
+ dynstr_append_mem (ds, STRING_WITH_LEN (
7795
+ " Tracker : SESSION_TRACK_TRANSACTION_TYPE\n " ));
7787
7796
break ;
7788
7797
default :
7789
7798
DBUG_ASSERT (0 );
7790
- dynstr_append (ds, " \n " );
7799
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " \n " ) );
7791
7800
}
7792
7801
7793
7802
7794
- dynstr_append (ds, " -- " );
7803
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " -- " ) );
7795
7804
dynstr_append_mem (ds, data, data_length);
7796
7805
}
7797
7806
else
@@ -7800,10 +7809,10 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
7800
7809
(enum_session_state_type) type,
7801
7810
&data, &data_length))
7802
7811
{
7803
- dynstr_append (ds, " \n -- " );
7812
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " \n -- " ) );
7804
7813
dynstr_append_mem (ds, data, data_length);
7805
7814
}
7806
- dynstr_append (ds, " \n\n " );
7815
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " \n\n " ) );
7807
7816
}
7808
7817
#endif /* EMBEDDED_LIBRARY */
7809
7818
}
@@ -8198,7 +8207,8 @@ void handle_error(struct st_command *command,
8198
8207
else if (command->expected_errors .err [0 ].type == ERR_SQLSTATE ||
8199
8208
(command->expected_errors .err [0 ].type == ERR_ERRNO &&
8200
8209
command->expected_errors .err [0 ].code .errnum != 0 ))
8201
- dynstr_append (ds," Got one of the listed errors\n " );
8210
+ dynstr_append_mem (ds, STRING_WITH_LEN (" Got one of the listed "
8211
+ " errors\n " ));
8202
8212
}
8203
8213
/* OK */
8204
8214
revert_properties ();
@@ -10232,7 +10242,7 @@ int main(int argc, char **argv)
10232
10242
if (p && *p == ' #' && *(p+1 ) == ' #' )
10233
10243
{
10234
10244
dynstr_append_mem (&ds_res, command->query , command->query_len );
10235
- dynstr_append (&ds_res, " \n " );
10245
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " \n " ) );
10236
10246
}
10237
10247
break ;
10238
10248
}
@@ -10245,7 +10255,7 @@ int main(int argc, char **argv)
10245
10255
if (disable_query_log)
10246
10256
break ;
10247
10257
10248
- dynstr_append (&ds_res, " \n " );
10258
+ dynstr_append_mem (&ds_res, STRING_WITH_LEN ( " \n " ) );
10249
10259
break ;
10250
10260
case Q_PING:
10251
10261
handle_command_error (command, mysql_ping (cur_con->mysql ), -1 );
@@ -11886,7 +11896,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
11886
11896
{
11887
11897
const char **line= dynamic_element (&lines, i, const char **);
11888
11898
dynstr_append (ds, *line);
11889
- dynstr_append (ds, " \n " );
11899
+ dynstr_append_mem (ds, STRING_WITH_LEN ( " \n " ) );
11890
11900
}
11891
11901
11892
11902
delete_dynamic (&lines);
0 commit comments