diff options
author | Pablo Barciela <[email protected]> | 2019-04-12 22:17:28 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-04-18 10:47:40 +0200 |
commit | c93d8453ecc0421fe45e6f88ed3d15163149e39c (patch) | |
tree | 595dbe405c56dfc882081b0eb23a4db97a7e3adc /eel/eel-editable-label.c | |
parent | 2f3f26ee105181dbc2996f5fb492cfa24468cf6c (diff) | |
download | caja-c93d8453ecc0421fe45e6f88ed3d15163149e39c.tar.bz2 caja-c93d8453ecc0421fe45e6f88ed3d15163149e39c.tar.xz |
eel: reduce the scope of some variables
Fixes 'cppcheck' warnings:
[eel/eel-background.c:163]: (style) The scope of the variable 'intensity' can be reduced.
[eel/eel-background.c:163]: (style) The scope of the variable 'saturation' can be reduced.
[eel/eel-background.c:196]: (style) The scope of the variable 'end_color' can be reduced.
[eel/eel-canvas-rect-ellipse.c:600]: (style) The scope of the variable 'tmp' can be reduced.
[eel/eel-canvas-rect-ellipse.c:705]: (style) The scope of the variable 'width_pixels' can be reduced.
[eel/eel-canvas-rect-ellipse.c:706]: (style) The scope of the variable 'width_lt' can be reduced.
[eel/eel-canvas-rect-ellipse.c:706]: (style) The scope of the variable 'width_rb' can be reduced.
[eel/eel-canvas.c:1420]: (style) The scope of the variable 'child' can be reduced.
[eel/eel-canvas.c:1493]: (style) The scope of the variable 'i' can be reduced.
[eel/eel-canvas.c:1518]: (style) The scope of the variable 'i' can be reduced.
[eel/eel-canvas.c:1545]: (style) The scope of the variable 'i' can be reduced.
[eel/eel-canvas.c:1599]: (style) The scope of the variable 'child' can be reduced.
[eel/eel-canvas.c:2598]: (style) The scope of the variable 'cx' can be reduced.
[eel/eel-canvas.c:2598]: (style) The scope of the variable 'cy' can be reduced.
[eel/eel-debug.c:80]: (style) The scope of the variable 'f' can be reduced.
[eel/eel-editable-label.c:1493]: (style) The scope of the variable 'clip' can be reduced.
[eel/eel-editable-label.c:1571]: (style) The scope of the variable 'text' can be reduced.
[eel/eel-editable-label.c:2270]: (style) The scope of the variable 'anchor' can be reduced.
[eel/eel-editable-label.c:2270]: (style) The scope of the variable 'end' can be reduced.
[eel/eel-editable-label.c:3054]: (style) The scope of the variable 'menuitem' can be reduced.
[eel/eel-editable-label.c:3400]: (style) The scope of the variable 'index' can be reduced.
[eel/eel-gdk-pixbuf-extensions.c:85]: (style) The scope of the variable 'scale' can be reduced.
[eel/eel-gdk-pixbuf-extensions.c:283]: (style) The scope of the variable 's_x1' can be reduced.
[eel/eel-gdk-pixbuf-extensions.c:283]: (style) The scope of the variable 's_y2' can be reduced.
[eel/eel-gdk-pixbuf-extensions.c:284]: (style) The scope of the variable 's_xfrac' can be reduced.
[eel/eel-glib-extensions.c:439]: (style) The scope of the variable 'compare_result' can be reduced.
[eel/eel-glib-extensions.c:561]: (style) The scope of the variable 'hash_table_to_free' can be reduced.
[eel/eel-graphic-effects.c:74]: (style) The scope of the variable 'pixsrc' can be reduced.
[eel/eel-graphic-effects.c:74]: (style) The scope of the variable 'pixdest' can be reduced.
[eel/eel-graphic-effects.c:137]: (style) The scope of the variable 'pixsrc' can be reduced.
[eel/eel-graphic-effects.c:137]: (style) The scope of the variable 'pixdest' can be reduced.
[eel/eel-graphic-effects.c:195]: (style) The scope of the variable 'pixsrc' can be reduced.
[eel/eel-graphic-effects.c:196]: (style) The scope of the variable 'pixdest' can be reduced.
[eel/eel-graphic-effects.c:245]: (style) The scope of the variable 'slab_width' can be reduced.
[eel/eel-graphic-effects.c:262]: (style) The scope of the variable 'slab_height' can be reduced.
[eel/eel-graphic-effects.c:282]: (style) The scope of the variable 'y' can be reduced.
[eel/eel-gtk-extensions.c:165]: (style) The scope of the variable 'screen' can be reduced.
[eel/eel-gtk-extensions.c:167]: (style) The scope of the variable 'screen_width' can be reduced.
[eel/eel-gtk-extensions.c:167]: (style) The scope of the variable 'screen_height' can be reduced.
[eel/eel-gtk-extensions.c:168]: (style) The scope of the variable 'scale' can be reduced.
[eel/eel-labeled-image.c:1051]: (style) The scope of the variable 'x_alignment' can be reduced.
[eel/eel-labeled-image.c:1052]: (style) The scope of the variable 'y_alignment' can be reduced.
[eel/eel-labeled-image.c:1100]: (style) The scope of the variable 'x_alignment' can be reduced.
[eel/eel-labeled-image.c:1101]: (style) The scope of the variable 'y_alignment' can be reduced.
[eel/eel-mate-extensions.c:73]: (style) The scope of the variable 'quoted' can be reduced.
[eel/eel-stock-dialogs.c:409]: (style) The scope of the variable 'button_title' can be reduced.
[eel/eel-string.c:415]: (style) The scope of the variable 'i' can be reduced.
[eel/eel-string.c:542]: (style) The scope of the variable 'type' can be reduced.
[eel/eel-vfs-extensions.c:65]: (style) The scope of the variable 'valid_bytes' can be reduced.
[eel/eel-wrap-table.c:766]: (style) The scope of the variable 'hadj' can be reduced.
[eel/eel-wrap-table.c:766]: (style) The scope of the variable 'vadj' can be reduced.
Diffstat (limited to 'eel/eel-editable-label.c')
-rw-r--r-- | eel/eel-editable-label.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c index 0fbdc0c5..800552e8 100644 --- a/eel/eel-editable-label.c +++ b/eel/eel-editable-label.c @@ -1490,7 +1490,6 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff else /* Block cursor */ { GdkRGBA fg_color; - cairo_region_t *clip; gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg_color); @@ -1507,6 +1506,7 @@ eel_editable_label_draw_cursor (EelEditableLabel *label, cairo_t *cr, gint xoff { GdkRGBA color; GdkRGBA *c; + cairo_region_t *clip; clip = gdk_pango_layout_get_clip_region (label->layout, xoffset, yoffset, @@ -1568,7 +1568,6 @@ eel_editable_label_draw (GtkWidget *widget, if (label->selection_anchor != label->selection_end) { gint range[2]; - const char *text; cairo_region_t *clip; GtkStateType state; @@ -1582,6 +1581,8 @@ eel_editable_label_draw (GtkWidget *widget, if (label->preedit_length > 0 && range[1] > label->selection_anchor) { + const char *text; + text = pango_layout_get_text (label->layout) + label->selection_anchor; range[1] += g_utf8_offset_to_pointer (text, label->preedit_length) - text; } @@ -2267,8 +2268,6 @@ eel_editable_label_delete_text (EelEditableLabel *label, int start_pos, int end_pos) { - int anchor, end; - if (start_pos < 0) start_pos = 0; if (end_pos < 0 || end_pos > label->n_bytes) @@ -2276,6 +2275,8 @@ eel_editable_label_delete_text (EelEditableLabel *label, if (start_pos < end_pos) { + int anchor, end; + memmove (label->text + start_pos, label->text + end_pos, label->n_bytes + 1 - end_pos); label->n_bytes -= (end_pos - start_pos); @@ -3051,7 +3052,6 @@ popup_targets_received (GtkClipboard *clipboard, GtkSelectionData *data, gpointer user_data) { - GtkWidget *menuitem; gboolean have_selection; gboolean clipboard_contains_text; PopupInfo *info; @@ -3062,6 +3062,8 @@ popup_targets_received (GtkClipboard *clipboard, if (gtk_widget_get_realized (GTK_WIDGET (label))) { + GtkWidget *menuitem; + if (label->popup_menu) gtk_widget_destroy (label->popup_menu); @@ -3397,7 +3399,6 @@ eel_editable_label_accessible_get_character_at_offset (AtkText *text, GtkWidget *widget; EelEditableLabelAccessiblePrivate *priv; gchar *string; - gchar *index; gunichar unichar; widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text)); @@ -3413,6 +3414,8 @@ eel_editable_label_accessible_get_character_at_offset (AtkText *text, } else { + gchar *index; + index = g_utf8_offset_to_pointer (string, offset); unichar = g_utf8_get_char(index); |