core: rename function string_iconv_fprintf to string_fprintf
parent
666bc4fda2
commit
eb86def400
|
@ -56,7 +56,7 @@ weechat_backtrace_printf (const char *message, ...)
|
|||
weechat_va_format (message);
|
||||
if (vbuffer)
|
||||
{
|
||||
string_iconv_fprintf (stderr, "%s\n", vbuffer);
|
||||
string_fprintf (stderr, "%s\n", vbuffer);
|
||||
log_printf ("%s", vbuffer);
|
||||
free (vbuffer);
|
||||
}
|
||||
|
|
|
@ -6099,12 +6099,12 @@ COMMAND_CALLBACK(upgrade)
|
|||
execvp (exec_args[0], exec_args);
|
||||
|
||||
/* this code should not be reached if execvp is OK */
|
||||
string_iconv_fprintf (stderr, "\n\n*****\n");
|
||||
string_iconv_fprintf (stderr,
|
||||
_("***** Error: exec failed (program: \"%s\"), "
|
||||
"exiting WeeChat"),
|
||||
exec_args[0]);
|
||||
string_iconv_fprintf (stderr, "\n*****\n\n");
|
||||
string_fprintf (stderr, "\n\n*****\n");
|
||||
string_fprintf (stderr,
|
||||
_("***** Error: exec failed (program: \"%s\"), "
|
||||
"exiting WeeChat"),
|
||||
exec_args[0]);
|
||||
string_fprintf (stderr, "\n*****\n\n");
|
||||
|
||||
free (exec_args[0]);
|
||||
free (exec_args[3]);
|
||||
|
|
|
@ -2301,35 +2301,35 @@ config_file_write_option (struct t_config_file *config_file,
|
|||
switch (option->type)
|
||||
{
|
||||
case CONFIG_OPTION_TYPE_BOOLEAN:
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
(CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
|
||||
"on" : "off");
|
||||
rc = string_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
(CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ?
|
||||
"on" : "off");
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_INTEGER:
|
||||
if (option->string_values)
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
option->string_values[CONFIG_INTEGER(option)]);
|
||||
rc = string_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
option->string_values[CONFIG_INTEGER(option)]);
|
||||
else
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s = %d\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
CONFIG_INTEGER(option));
|
||||
rc = string_fprintf (config_file->file, "%s%s = %d\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
CONFIG_INTEGER(option));
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_STRING:
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s = \"%s\"\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
(char *)option->value);
|
||||
rc = string_fprintf (config_file->file, "%s%s = \"%s\"\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
(char *)option->value);
|
||||
break;
|
||||
case CONFIG_OPTION_TYPE_COLOR:
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
gui_color_get_name (CONFIG_COLOR(option)));
|
||||
rc = string_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name,
|
||||
gui_color_get_name (CONFIG_COLOR(option)));
|
||||
break;
|
||||
case CONFIG_NUM_OPTION_TYPES:
|
||||
break;
|
||||
|
@ -2337,9 +2337,9 @@ config_file_write_option (struct t_config_file *config_file,
|
|||
}
|
||||
else
|
||||
{
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name);
|
||||
rc = string_fprintf (config_file->file, "%s%s\n",
|
||||
config_file_option_escape (option->name),
|
||||
option->name);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -2371,9 +2371,9 @@ config_file_write_line (struct t_config_file *config_file,
|
|||
{
|
||||
if (vbuffer[0])
|
||||
{
|
||||
rc = string_iconv_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option_name),
|
||||
option_name, vbuffer);
|
||||
rc = string_fprintf (config_file->file, "%s%s = %s\n",
|
||||
config_file_option_escape (option_name),
|
||||
option_name, vbuffer);
|
||||
free (vbuffer);
|
||||
return rc;
|
||||
}
|
||||
|
@ -2381,8 +2381,8 @@ config_file_write_line (struct t_config_file *config_file,
|
|||
}
|
||||
}
|
||||
|
||||
return (string_iconv_fprintf (config_file->file, "\n[%s]\n",
|
||||
option_name));
|
||||
return (string_fprintf (config_file->file, "\n[%s]\n",
|
||||
option_name));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2459,12 +2459,12 @@ config_file_write_internal (struct t_config_file *config_file,
|
|||
}
|
||||
|
||||
/* write header with name of config file and WeeChat version */
|
||||
if (!string_iconv_fprintf (config_file->file, "#\n"))
|
||||
if (!string_fprintf (config_file->file, "#\n"))
|
||||
goto error;
|
||||
if (!string_iconv_fprintf (config_file->file,
|
||||
"# %s -- %s\n#\n",
|
||||
version_get_name (),
|
||||
config_file->filename))
|
||||
if (!string_fprintf (config_file->file,
|
||||
"# %s -- %s\n#\n",
|
||||
version_get_name (),
|
||||
config_file->filename))
|
||||
goto error;
|
||||
|
||||
/* write all sections */
|
||||
|
@ -2493,8 +2493,8 @@ config_file_write_internal (struct t_config_file *config_file,
|
|||
else
|
||||
{
|
||||
/* write all options for section */
|
||||
if (!string_iconv_fprintf (config_file->file,
|
||||
"\n[%s]\n", ptr_section->name))
|
||||
if (!string_fprintf (config_file->file,
|
||||
"\n[%s]\n", ptr_section->name))
|
||||
goto error;
|
||||
for (ptr_option = ptr_section->options; ptr_option;
|
||||
ptr_option = ptr_option->next_option)
|
||||
|
|
|
@ -156,18 +156,17 @@ debug_sigsegv ()
|
|||
unhook_all ();
|
||||
gui_main_end (0);
|
||||
|
||||
string_iconv_fprintf (
|
||||
stderr,
|
||||
"\n"
|
||||
"*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
|
||||
string_fprintf (stderr,
|
||||
"\n*** Very bad! WeeChat is crashing (SIGSEGV received)"
|
||||
"\n");
|
||||
if (!log_crash_rename ())
|
||||
{
|
||||
string_iconv_fprintf (
|
||||
stderr,
|
||||
"*** Full crash dump was saved to %s/weechat.log file.\n",
|
||||
weechat_home);
|
||||
string_fprintf (stderr,
|
||||
"*** Full crash dump was saved to %s/weechat.log file."
|
||||
"\n",
|
||||
weechat_home);
|
||||
}
|
||||
string_iconv_fprintf (
|
||||
string_fprintf (
|
||||
stderr,
|
||||
"***\n"
|
||||
"*** Please help WeeChat developers to fix this bug:\n"
|
||||
|
|
|
@ -112,10 +112,10 @@ log_init ()
|
|||
{
|
||||
if (!log_open (NULL, "w"))
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: unable to create/append to log file (weechat.log)\n"
|
||||
"If another WeeChat process is using this file, try to run WeeChat\n"
|
||||
"with another home using the \"--dir\" command line option.\n"));
|
||||
string_fprintf (stderr,
|
||||
_("Error: unable to create/append to log file (weechat.log)\n"
|
||||
"If another WeeChat process is using this file, try to run WeeChat\n"
|
||||
"with another home using the \"--dir\" command line option.\n"));
|
||||
exit (1);
|
||||
}
|
||||
log_printf ("WeeChat %s (%s %s %s)",
|
||||
|
@ -159,18 +159,18 @@ log_printf (const char *message, ...)
|
|||
date_tmp = localtime (&seconds);
|
||||
if (date_tmp)
|
||||
{
|
||||
string_iconv_fprintf (weechat_log_file,
|
||||
"[%04d-%02d-%02d %02d:%02d:%02d] %s\n",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1,
|
||||
date_tmp->tm_mday, date_tmp->tm_hour,
|
||||
date_tmp->tm_min, date_tmp->tm_sec,
|
||||
vbuffer);
|
||||
string_fprintf (weechat_log_file,
|
||||
"[%04d-%02d-%02d %02d:%02d:%02d] %s\n",
|
||||
date_tmp->tm_year + 1900, date_tmp->tm_mon + 1,
|
||||
date_tmp->tm_mday, date_tmp->tm_hour,
|
||||
date_tmp->tm_min, date_tmp->tm_sec,
|
||||
vbuffer);
|
||||
}
|
||||
else
|
||||
string_iconv_fprintf (weechat_log_file, "%s\n", vbuffer);
|
||||
string_fprintf (weechat_log_file, "%s\n", vbuffer);
|
||||
}
|
||||
else
|
||||
string_iconv_fprintf (weechat_log_file, "%s\n", vbuffer);
|
||||
string_fprintf (weechat_log_file, "%s\n", vbuffer);
|
||||
|
||||
fflush (weechat_log_file);
|
||||
|
||||
|
@ -276,8 +276,8 @@ log_crash_rename ()
|
|||
getpid());
|
||||
if (rename (old_name, new_name) == 0)
|
||||
{
|
||||
string_iconv_fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
|
||||
new_name);
|
||||
string_fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
|
||||
new_name);
|
||||
log_open (new_name, "a");
|
||||
free (old_name);
|
||||
free (new_name);
|
||||
|
|
|
@ -2385,7 +2385,7 @@ string_iconv_from_internal (const char *charset, const char *string)
|
|||
*/
|
||||
|
||||
int
|
||||
string_iconv_fprintf (FILE *file, const char *data, ...)
|
||||
string_fprintf (FILE *file, const char *data, ...)
|
||||
{
|
||||
char *buf2;
|
||||
int rc, num_written;
|
||||
|
|
|
@ -85,7 +85,7 @@ extern char *string_iconv (int from_utf8, const char *from_code,
|
|||
extern char *string_iconv_to_internal (const char *charset, const char *string);
|
||||
extern char *string_iconv_from_internal (const char *charset,
|
||||
const char *string);
|
||||
extern int string_iconv_fprintf (FILE *file, const char *data, ...);
|
||||
extern int string_fprintf (FILE *file, const char *data, ...);
|
||||
extern char *string_format_size (unsigned long long size);
|
||||
extern void string_encode_base16 (const char *from, int length, char *to);
|
||||
extern int string_decode_base16 (const char *from, char *to);
|
||||
|
|
|
@ -110,8 +110,8 @@ char *weechat_startup_commands = NULL; /* startup commands (-r flag) */
|
|||
void
|
||||
weechat_display_copyright ()
|
||||
{
|
||||
string_iconv_fprintf (stdout, "\n");
|
||||
string_iconv_fprintf (
|
||||
string_fprintf (stdout, "\n");
|
||||
string_fprintf (
|
||||
stdout,
|
||||
/* TRANSLATORS: "%s %s" after "compiled on" is date and time */
|
||||
_("WeeChat %s Copyright %s, compiled on %s %s\n"
|
||||
|
@ -122,7 +122,7 @@ weechat_display_copyright ()
|
|||
version_get_compilation_date (),
|
||||
version_get_compilation_time (),
|
||||
WEECHAT_WEBSITE);
|
||||
string_iconv_fprintf (stdout, "\n");
|
||||
string_fprintf (stdout, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -133,12 +133,12 @@ void
|
|||
weechat_display_usage (char *exec_name)
|
||||
{
|
||||
weechat_display_copyright ();
|
||||
string_iconv_fprintf (stdout, "\n");
|
||||
string_iconv_fprintf (stdout,
|
||||
_("Usage: %s [option...] [plugin:option...]\n"),
|
||||
exec_name, exec_name);
|
||||
string_iconv_fprintf (stdout, "\n");
|
||||
string_iconv_fprintf (
|
||||
string_fprintf (stdout, "\n");
|
||||
string_fprintf (stdout,
|
||||
_("Usage: %s [option...] [plugin:option...]\n"),
|
||||
exec_name, exec_name);
|
||||
string_fprintf (stdout, "\n");
|
||||
string_fprintf (
|
||||
stdout,
|
||||
_(" -a, --no-connect disable auto-connect to servers at "
|
||||
"startup\n"
|
||||
|
@ -158,7 +158,7 @@ weechat_display_usage (char *exec_name)
|
|||
"(see /help upgrade in WeeChat)\n"
|
||||
" -v, --version display WeeChat version\n"
|
||||
" plugin:option option for plugin (see man weechat)\n"));
|
||||
string_iconv_fprintf(stdout, "\n");
|
||||
string_fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -198,10 +198,9 @@ weechat_parse_args (int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: missing argument for \"%s\" "
|
||||
"option\n"),
|
||||
argv[i]);
|
||||
string_fprintf (stderr,
|
||||
_("Error: missing argument for \"%s\" option\n"),
|
||||
argv[i]);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
|
@ -215,8 +214,8 @@ weechat_parse_args (int argc, char *argv[])
|
|||
|| (strcmp (argv[i], "--license") == 0))
|
||||
{
|
||||
weechat_display_copyright ();
|
||||
string_iconv_fprintf (stdout, "\n");
|
||||
string_iconv_fprintf (stdout, "%s%s", WEECHAT_LICENSE_TEXT);
|
||||
string_fprintf (stdout, "\n");
|
||||
string_fprintf (stdout, "%s%s", WEECHAT_LICENSE_TEXT);
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
else if (strcmp (argv[i], "--no-dlclose") == 0)
|
||||
|
@ -266,10 +265,9 @@ weechat_parse_args (int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: missing argument for \"%s\" "
|
||||
"option\n"),
|
||||
argv[i]);
|
||||
string_fprintf (stderr,
|
||||
_("Error: missing argument for \"%s\" option\n"),
|
||||
argv[i]);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +278,7 @@ weechat_parse_args (int argc, char *argv[])
|
|||
else if ((strcmp (argv[i], "-v") == 0)
|
||||
|| (strcmp (argv[i], "--version") == 0))
|
||||
{
|
||||
string_iconv_fprintf (stdout, version_get_version ());
|
||||
string_fprintf (stdout, version_get_version ());
|
||||
fprintf (stdout, "\n");
|
||||
weechat_shutdown (EXIT_SUCCESS, 0);
|
||||
}
|
||||
|
@ -303,8 +301,7 @@ weechat_set_home_path (char *home_path)
|
|||
ptr_home = getenv ("HOME");
|
||||
if (!ptr_home)
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: unable to get HOME directory\n"));
|
||||
string_fprintf (stderr, _("Error: unable to get HOME directory\n"));
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
/* make C static analyzer happy (never executed) */
|
||||
return;
|
||||
|
@ -324,9 +321,8 @@ weechat_set_home_path (char *home_path)
|
|||
|
||||
if (!weechat_home)
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: not enough memory for home "
|
||||
"directory\n"));
|
||||
string_fprintf (stderr,
|
||||
_("Error: not enough memory for home directory\n"));
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
/* make C static analyzer happy (never executed) */
|
||||
return;
|
||||
|
@ -363,9 +359,9 @@ weechat_create_home_dir ()
|
|||
config_weechat_home = WEECHAT_HOME;
|
||||
if (!config_weechat_home[0])
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: WEECHAT_HOME is undefined, check "
|
||||
"build options\n"));
|
||||
string_fprintf (stderr,
|
||||
_("Error: WEECHAT_HOME is undefined, check build "
|
||||
"options\n"));
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
/* make C static analyzer happy (never executed) */
|
||||
return;
|
||||
|
@ -378,9 +374,9 @@ weechat_create_home_dir ()
|
|||
{
|
||||
if (!S_ISDIR (statinfo.st_mode))
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: home (%s) is not a directory\n"),
|
||||
weechat_home);
|
||||
string_fprintf (stderr,
|
||||
_("Error: home (%s) is not a directory\n"),
|
||||
weechat_home);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
/* make C static analyzer happy (never executed) */
|
||||
return;
|
||||
|
@ -390,9 +386,9 @@ weechat_create_home_dir ()
|
|||
/* create home directory; error is fatal */
|
||||
if (!util_mkdir (weechat_home, 0755))
|
||||
{
|
||||
string_iconv_fprintf (stderr,
|
||||
_("Error: cannot create directory \"%s\"\n"),
|
||||
weechat_home);
|
||||
string_fprintf (stderr,
|
||||
_("Error: cannot create directory \"%s\"\n"),
|
||||
weechat_home);
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
/* make C static analyzer happy (never executed) */
|
||||
return;
|
||||
|
|
|
@ -927,7 +927,7 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
|
|||
gui_buffer_ask_chat_refresh (buffer, 1);
|
||||
}
|
||||
else
|
||||
string_iconv_fprintf (stdout, "%s\n", vbuffer);
|
||||
string_fprintf (stdout, "%s\n", vbuffer);
|
||||
}
|
||||
|
||||
free (vbuffer);
|
||||
|
@ -959,7 +959,7 @@ gui_chat_print_lines_waiting_buffer (FILE *f)
|
|||
if (!f && gui_init_ok)
|
||||
gui_chat_printf (NULL, "%s", lines[i]);
|
||||
else
|
||||
string_iconv_fprintf ((f) ? f : stdout, "%s\n", lines[i]);
|
||||
string_fprintf ((f) ? f : stdout, "%s\n", lines[i]);
|
||||
}
|
||||
string_free_split (lines);
|
||||
}
|
||||
|
|
|
@ -1008,7 +1008,7 @@ TEST(String, SplitBuildWithSplitString)
|
|||
* string_iconv
|
||||
* string_iconv_to_internal
|
||||
* string_iconv_from_internal
|
||||
* string_iconv_fprintf
|
||||
* string_fprintf
|
||||
*/
|
||||
|
||||
TEST(String, Iconv)
|
||||
|
@ -1038,12 +1038,12 @@ TEST(String, Iconv)
|
|||
WEE_TEST_STR("abc", string_iconv_from_internal (NULL, "abc"));
|
||||
WEE_TEST_STR(noel_iso, string_iconv_from_internal ("ISO-8859-15", noel_utf8));
|
||||
|
||||
/* string_iconv_fprintf */
|
||||
/* string_fprintf */
|
||||
f = fopen ("/dev/null", "w");
|
||||
LONGS_EQUAL(0, string_iconv_fprintf (f, NULL));
|
||||
LONGS_EQUAL(1, string_iconv_fprintf (f, "abc"));
|
||||
LONGS_EQUAL(1, string_iconv_fprintf (f, noel_utf8));
|
||||
LONGS_EQUAL(1, string_iconv_fprintf (f, noel_iso));
|
||||
LONGS_EQUAL(0, string_fprintf (f, NULL));
|
||||
LONGS_EQUAL(1, string_fprintf (f, "abc"));
|
||||
LONGS_EQUAL(1, string_fprintf (f, noel_utf8));
|
||||
LONGS_EQUAL(1, string_fprintf (f, noel_iso));
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue