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)