diff --git a/lapiz/bacon-message-connection.c b/lapiz/bacon-message-connection.c
index 0e71fabc..308888c5 100644
--- a/lapiz/bacon-message-connection.c
+++ b/lapiz/bacon-message-connection.c
@@ -224,7 +224,7 @@ find_file_with_pattern (const char *dir, const char *pattern)
static char *
socket_filename (const char *prefix)
{
- char *pattern, *newfile, *path, *filename;
+ char *pattern, *path, *filename;
const char *tmpdir;
pattern = g_strdup_printf ("%s.%s.*", prefix, g_get_user_name ());
@@ -232,6 +232,8 @@ socket_filename (const char *prefix)
filename = find_file_with_pattern (tmpdir, pattern);
if (filename == NULL)
{
+ char *newfile;
+
newfile = g_strdup_printf ("%s.%s.%u", prefix,
g_get_user_name (), g_random_int ());
path = g_build_filename (tmpdir, newfile, NULL);
diff --git a/lapiz/lapiz-documents-panel.c b/lapiz/lapiz-documents-panel.c
index 7f5dc241..862287dd 100644
--- a/lapiz/lapiz-documents-panel.c
+++ b/lapiz/lapiz-documents-panel.c
@@ -146,13 +146,14 @@ window_active_tab_changed (LapizWindow *window,
if (!_lapiz_window_is_removing_tabs (window))
{
CtkTreeIter iter;
- CtkTreeSelection *selection;
get_iter_from_tab (panel, tab, &iter);
if (ctk_list_store_iter_is_valid (CTK_LIST_STORE (panel->priv->model),
&iter))
{
+ CtkTreeSelection *selection;
+
selection = ctk_tree_view_get_selection (
CTK_TREE_VIEW (panel->priv->treeview));
diff --git a/lapiz/lapiz-io-error-message-area.c b/lapiz/lapiz-io-error-message-area.c
index bd2892d0..8efdb437 100644
--- a/lapiz/lapiz-io-error-message-area.c
+++ b/lapiz/lapiz-io-error-message-area.c
@@ -113,9 +113,7 @@ set_message_area_text_and_icon (CtkWidget *message_area,
CtkWidget *image;
CtkWidget *vbox;
gchar *primary_markup;
- gchar *secondary_markup;
CtkWidget *primary_label;
- CtkWidget *secondary_label;
hbox_content = ctk_box_new (CTK_ORIENTATION_HORIZONTAL, 8);
@@ -139,6 +137,9 @@ set_message_area_text_and_icon (CtkWidget *message_area,
if (secondary_text != NULL)
{
+ gchar *secondary_markup;
+ CtkWidget *secondary_label;
+
secondary_markup = g_strdup_printf ("%s",
secondary_text);
secondary_label = ctk_label_new (secondary_markup);
@@ -209,12 +210,13 @@ parse_gio_error (gint code,
case G_IO_ERROR_NOT_SUPPORTED:
{
gchar *scheme_string;
- gchar *scheme_markup;
scheme_string = g_uri_parse_scheme (uri);
if ((scheme_string != NULL) && g_utf8_validate (scheme_string, -1, NULL))
{
+ gchar *scheme_markup;
+
scheme_markup = g_markup_printf_escaped ("%s:", scheme_string);
/* Translators: %s is a URI scheme (like for example http:, ftp:, etc.) */
@@ -475,9 +477,7 @@ create_conversion_error_message_area (const gchar *primary_text,
CtkWidget *image;
CtkWidget *vbox;
gchar *primary_markup;
- gchar *secondary_markup;
CtkWidget *primary_label;
- CtkWidget *secondary_label;
message_area = ctk_info_bar_new ();
@@ -534,6 +534,9 @@ create_conversion_error_message_area (const gchar *primary_text,
if (secondary_text != NULL)
{
+ gchar *secondary_markup;
+ CtkWidget *secondary_label;
+
secondary_markup = g_strdup_printf ("%s",
secondary_text);
secondary_label = ctk_label_new (secondary_markup);
@@ -1025,8 +1028,6 @@ lapiz_unrecoverable_saving_error_message_area_new (const gchar *uri,
gchar *error_message = NULL;
gchar *message_details = NULL;
gchar *full_formatted_uri;
- gchar *scheme_string;
- gchar *scheme_markup;
gchar *uri_for_display;
gchar *temp_uri_for_display;
CtkWidget *message_area;
@@ -1051,10 +1052,14 @@ lapiz_unrecoverable_saving_error_message_area_new (const gchar *uri,
if (is_gio_error (error, G_IO_ERROR_NOT_SUPPORTED))
{
+ gchar *scheme_string;
+
scheme_string = g_uri_parse_scheme (uri);
if ((scheme_string != NULL) && g_utf8_validate (scheme_string, -1, NULL))
{
+ gchar *scheme_markup;
+
scheme_markup = g_markup_printf_escaped ("%s:", scheme_string);
/* Translators: %s is a URI scheme (like for example http:, ftp:, etc.) */
diff --git a/lapiz/lapiz-session.c b/lapiz/lapiz-session.c
index 899e87c8..7b3aae27 100644
--- a/lapiz/lapiz-session.c
+++ b/lapiz/lapiz-session.c
@@ -134,7 +134,6 @@ client_save_state_cb (EggSMClient *client,
gpointer user_data)
{
const GList *windows;
- gchar *group_name;
int n;
windows = lapiz_app_get_windows (lapiz_app_get_default ());
@@ -142,7 +141,9 @@ client_save_state_cb (EggSMClient *client,
while (windows != NULL)
{
- group_name = g_strdup_printf ("lapiz window %d", n);
+ gchar *group_name;
+
+ group_name = g_strdup_printf ("lapiz window %d", n);
save_window_session (state_file,
group_name,
LAPIZ_WINDOW (windows->data));
diff --git a/lapiz/lapiz-utils.c b/lapiz/lapiz-utils.c
index dcdfed82..28d4096f 100644
--- a/lapiz/lapiz-utils.c
+++ b/lapiz/lapiz-utils.c
@@ -646,7 +646,7 @@ lapiz_utils_make_valid_utf8 (const char *name)
{
GString *string;
const char *remainder, *invalid;
- int remaining_bytes, valid_bytes;
+ int remaining_bytes;
g_return_val_if_fail (name != NULL, NULL);
@@ -655,6 +655,8 @@ lapiz_utils_make_valid_utf8 (const char *name)
remaining_bytes = strlen (name);
while (remaining_bytes != 0) {
+ int valid_bytes;
+
if (g_utf8_validate (remainder, remaining_bytes, &invalid)) {
break;
}
@@ -1439,9 +1441,7 @@ lapiz_utils_decode_uri (const gchar *uri,
* functionality should be in glib/gio, but for now we implement it
* ourselves (see bug #546182) */
- const char *p, *in, *hier_part_start, *hier_part_end;
- char *out;
- char c;
+ const char *p, *hier_part_start, *hier_part_end;
/* From RFC 3986 Decodes:
* URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
@@ -1464,6 +1464,8 @@ lapiz_utils_decode_uri (const gchar *uri,
while (1)
{
+ char c;
+
c = *p++;
if (c == ':')
@@ -1478,6 +1480,9 @@ lapiz_utils_decode_uri (const gchar *uri,
if (scheme)
{
+ const char *in;
+ char *out;
+
*scheme = g_malloc (p - uri);
out = *scheme;
@@ -1493,7 +1498,7 @@ lapiz_utils_decode_uri (const gchar *uri,
if (hier_part_start[0] == '/' && hier_part_start[1] == '/')
{
const char *authority_start, *authority_end;
- const char *userinfo_start, *userinfo_end;
+ const char *userinfo_end;
const char *host_start, *host_end;
const char *port_start;
@@ -1512,6 +1517,8 @@ lapiz_utils_decode_uri (const gchar *uri,
if (userinfo_end)
{
+ const char *userinfo_start;
+
userinfo_start = authority_start;
if (user)
diff --git a/lapiz/lapiz-view.c b/lapiz/lapiz-view.c
index 1e6a049a..d71b4acf 100644
--- a/lapiz/lapiz-view.c
+++ b/lapiz/lapiz-view.c
@@ -2115,11 +2115,11 @@ lapiz_view_drag_data_received (CtkWidget *widget,
guint info,
guint timestamp)
{
- gchar **uri_list;
-
/* If this is an URL emit DROP_URIS, otherwise chain up the signal */
if (info == TARGET_URI_LIST)
{
+ gchar **uri_list;
+
uri_list = lapiz_utils_drop_get_uris (selection_data);
if (uri_list != NULL)
diff --git a/lapiz/smclient/eggdesktopfile.c b/lapiz/smclient/eggdesktopfile.c
index 467d3c31..e9022831 100644
--- a/lapiz/smclient/eggdesktopfile.c
+++ b/lapiz/smclient/eggdesktopfile.c
@@ -479,10 +479,7 @@ gboolean
egg_desktop_file_can_launch (EggDesktopFile *desktop_file,
const char *desktop_environment)
{
- char *try_exec, *found_program;
- char **only_show_in, **not_show_in;
gboolean found;
- int i;
if (desktop_file->type != EGG_DESKTOP_FILE_TYPE_APPLICATION &&
desktop_file->type != EGG_DESKTOP_FILE_TYPE_LINK)
@@ -490,12 +487,16 @@ egg_desktop_file_can_launch (EggDesktopFile *desktop_file,
if (desktop_environment)
{
+ char **only_show_in, **not_show_in;
+
only_show_in = g_key_file_get_string_list (desktop_file->key_file,
EGG_DESKTOP_FILE_GROUP,
EGG_DESKTOP_FILE_KEY_ONLY_SHOW_IN,
NULL, NULL);
if (only_show_in)
{
+ int i;
+
for (i = 0, found = FALSE; only_show_in[i] && !found; i++)
{
if (!strcmp (only_show_in[i], desktop_environment))
@@ -529,12 +530,16 @@ egg_desktop_file_can_launch (EggDesktopFile *desktop_file,
if (desktop_file->type == EGG_DESKTOP_FILE_TYPE_APPLICATION)
{
+ char *try_exec;
+
try_exec = g_key_file_get_string (desktop_file->key_file,
EGG_DESKTOP_FILE_GROUP,
EGG_DESKTOP_FILE_KEY_TRY_EXEC,
NULL);
if (try_exec)
{
+ char found_program;
+
found_program = g_find_program_in_path (try_exec);
g_free (try_exec);
@@ -604,8 +609,6 @@ append_quoted_word (GString *str,
gboolean in_single_quotes,
gboolean in_double_quotes)
{
- const char *p;
-
if (!in_single_quotes && !in_double_quotes)
g_string_append_c (str, '\'');
else if (!in_single_quotes && in_double_quotes)
@@ -615,6 +618,8 @@ append_quoted_word (GString *str,
g_string_append (str, s);
else
{
+ const char *p;
+
for (p = s; *p != '\0'; p++)
{
if (*p == '\'')
diff --git a/plugins/filebrowser/lapiz-file-browser-messages.c b/plugins/filebrowser/lapiz-file-browser-messages.c
index bfd28299..ef220927 100644
--- a/plugins/filebrowser/lapiz-file-browser-messages.c
+++ b/plugins/filebrowser/lapiz-file-browser-messages.c
@@ -220,7 +220,6 @@ message_set_emblem_cb (LapizMessageBus *bus,
gchar *id = NULL;
gchar *emblem = NULL;
CtkTreePath *path;
- LapizFileBrowserStore *store;
lapiz_message_get (message, "id", &id, "emblem", &emblem, NULL);
@@ -247,6 +246,8 @@ message_set_emblem_cb (LapizMessageBus *bus,
if (pixbuf)
{
+ LapizFileBrowserStore *store;
+
GValue value = { 0, };
CtkTreeIter iter;
diff --git a/plugins/spell/lapiz-automatic-spell-checker.c b/plugins/spell/lapiz-automatic-spell-checker.c
index 982d1679..98e12269 100644
--- a/plugins/spell/lapiz-automatic-spell-checker.c
+++ b/plugins/spell/lapiz-automatic-spell-checker.c
@@ -404,7 +404,6 @@ build_suggestion_menu (LapizAutomaticSpellChecker *spell, const gchar *word)
CtkWidget *mi;
GSList *suggestions;
GSList *list;
- gchar *label_text;
topmenu = menu = ctk_menu_new();
@@ -432,6 +431,7 @@ build_suggestion_menu (LapizAutomaticSpellChecker *spell, const gchar *word)
/* build a set of menus with suggestions. */
while (suggestions != NULL)
{
+ gchar *label_text;
CtkWidget *label;
if (count == 10)
diff --git a/plugins/spell/lapiz-spell-checker-language.c b/plugins/spell/lapiz-spell-checker-language.c
index e3865649..e0ee21fe 100644
--- a/plugins/spell/lapiz-spell-checker-language.c
+++ b/plugins/spell/lapiz-spell-checker-language.c
@@ -253,7 +253,7 @@ create_name_for_language (const char *code)
{
char **str;
char *name = NULL;
- const char *langname, *localename;
+ const char *langname;
int len;
g_return_val_if_fail (iso_639_table != NULL, NULL);
@@ -271,6 +271,8 @@ create_name_for_language (const char *code)
}
else if (len == 2 && langname != NULL)
{
+ const char *localename;
+
gchar *locale_code = g_ascii_strdown (str[1], -1);
localename = (const char *) g_hash_table_lookup (iso_3166_table, locale_code);
diff --git a/plugins/taglist/lapiz-taglist-plugin-parser.c b/plugins/taglist/lapiz-taglist-plugin-parser.c
index a2d171a5..933e064c 100644
--- a/plugins/taglist/lapiz-taglist-plugin-parser.c
+++ b/plugins/taglist/lapiz-taglist-plugin-parser.c
@@ -594,8 +594,6 @@ static TagList* parse_taglist_dir(const gchar* dir)
TagList* create_taglist(const gchar* data_dir)
{
- gchar* pdir;
-
lapiz_debug_message(DEBUG_PLUGINS, "ref_count: %d", taglist_ref_count);
if (taglist_ref_count > 0)
@@ -612,6 +610,8 @@ TagList* create_taglist(const gchar* data_dir)
home = g_get_home_dir ();
if (home != NULL)
{
+ gchar* pdir;
+
pdir = g_build_filename(home, ".config", USER_LAPIZ_TAGLIST_PLUGIN_LOCATION, NULL);
parse_taglist_dir(pdir);
g_free (pdir);