Commit efe01acb authored by Michael Natterer's avatar Michael Natterer 😴

app: formatting cleanup in the last commits, and a format string fix

parent 78b27783
......@@ -55,9 +55,14 @@ gimp_config_file_copy (const gchar *source,
gint unwritten_len = 0;
GRegex *old_options_regexp = NULL;
if (old_options_pattern && update_callback && !(old_options_regexp = g_regex_new (old_options_pattern, 0, 0, error)))
/* error set by g_regex_new. */
return FALSE;
if (old_options_pattern && update_callback)
{
old_options_regexp = g_regex_new (old_options_pattern, 0, 0, error);
/* error set by g_regex_new. */
if (! old_options_regexp)
return FALSE;
}
sfile = g_fopen (source, "rb");
if (sfile == NULL)
......@@ -82,7 +87,8 @@ gimp_config_file_copy (const gchar *source,
return FALSE;
}
while ((nbytes = fread (buffer + unwritten_len, 1, sizeof (buffer) - unwritten_len, sfile)) > 0 || unwritten_len)
while ((nbytes = fread (buffer + unwritten_len, 1,
sizeof (buffer) - unwritten_len, sfile)) > 0 || unwritten_len)
{
size_t read_len = nbytes + unwritten_len;
size_t write_len;
......@@ -98,10 +104,13 @@ gimp_config_file_copy (const gchar *source,
}
else if (! feof (sfile))
{
/* We are in unlikely case where a single config line is longer than the buffer! */
/* We are in unlikely case where a single config line is
* longer than the buffer!
*/
g_set_error (error, GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
_("Error parsing '%s': line over %ld characters."),
gimp_filename_to_utf8 (dest), sizeof (buffer));
_("Error parsing '%s': line longer than %"
G_GINT64_FORMAT" characters."),
gimp_filename_to_utf8 (dest), (gint64) sizeof (buffer));
fclose (sfile);
fclose (dfile);
if (old_options_regexp)
......@@ -111,7 +120,9 @@ gimp_config_file_copy (const gchar *source,
if (old_options_regexp && update_callback)
{
write_bytes = g_regex_replace_eval (old_options_regexp, buffer, read_len, 0, 0, update_callback, NULL, error);
write_bytes = g_regex_replace_eval (old_options_regexp, buffer,
read_len, 0, 0, update_callback,
NULL, error);
if (write_bytes == NULL)
{
/* error already set. */
......
......@@ -110,32 +110,32 @@ gimp_user_install_items[] =
};
static gboolean user_install_detect_old (GimpUserInstall *install,
const gchar *gimp_dir);
static gboolean user_install_detect_old (GimpUserInstall *install,
const gchar *gimp_dir);
static gchar * user_install_old_style_gimpdir (void);
static void user_install_log (GimpUserInstall *install,
const gchar *format,
static void user_install_log (GimpUserInstall *install,
const gchar *format,
...) G_GNUC_PRINTF (2, 3);
static void user_install_log_newline (GimpUserInstall *install);
static void user_install_log_error (GimpUserInstall *install,
GError **error);
static gboolean user_install_mkdir (GimpUserInstall *install,
const gchar *dirname);
static gboolean user_install_mkdir_with_parents (GimpUserInstall *install,
const gchar *dirname);
static void user_install_log_newline (GimpUserInstall *install);
static void user_install_log_error (GimpUserInstall *install,
GError **error);
static gboolean user_install_mkdir (GimpUserInstall *install,
const gchar *dirname);
static gboolean user_install_mkdir_with_parents (GimpUserInstall *install,
const gchar *dirname);
static gboolean user_install_file_copy (GimpUserInstall *install,
const gchar *source,
const gchar *dest,
const gchar *old_options_regexp,
GRegexEvalCallback update_callback);
static gboolean user_install_dir_copy (GimpUserInstall *install,
const gchar *source,
const gchar *base);
static gboolean user_install_dir_copy (GimpUserInstall *install,
const gchar *source,
const gchar *base);
static gboolean user_install_create_files (GimpUserInstall *install);
static gboolean user_install_migrate_files (GimpUserInstall *install);
static gboolean user_install_create_files (GimpUserInstall *install);
static gboolean user_install_migrate_files (GimpUserInstall *install);
/* public functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment