From efe01acb5d42c793a73cc6b3fd58fbf0ef2cac3d Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 12 Dec 2012 11:29:00 +0100 Subject: [PATCH] app: formatting cleanup in the last commits, and a format string fix --- app/config/gimpconfig-file.c | 27 +++++++++++++++++++-------- app/core/gimp-user-install.c | 32 ++++++++++++++++---------------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/app/config/gimpconfig-file.c b/app/config/gimpconfig-file.c index 069428e744..b7304cbc78 100644 --- a/app/config/gimpconfig-file.c +++ b/app/config/gimpconfig-file.c @@ -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. */ diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c index 9640a027c6..2bca84be75 100644 --- a/app/core/gimp-user-install.c +++ b/app/core/gimp-user-install.c @@ -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 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_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 */