diff options
author | Pavel Cisler <pavel@eazel.com> | 2000-09-05 20:38:10 +0000 |
---|---|---|
committer | Pavel Cisler <pce@src.gnome.org> | 2000-09-05 20:38:10 +0000 |
commit | add783964b40df9dcae367f7ee3985c00e48cf8e (patch) | |
tree | 5d687872f47da87a4da2892d97288040261f5ed7 | |
parent | 1b18a656209f630d30bc0e68eb8842950644e6ba (diff) | |
download | nautilus-add783964b40df9dcae367f7ee3985c00e48cf8e.tar.gz |
Fix all the warnings -Wuninitialized found. Quite a number of them were
2000-09-05 Pavel Cisler <pavel@eazel.com>
* components/help/converters/gnome-db2html2/gdb3html.c:
(xml_parse_document):
* components/help/hyperbola-nav-index.c: (end_element):
* components/services/summary/nautilus-view/nautilus-summary-view.c
: (logout_button_cb):
* components/services/time/service/trilobite-eazel-time-service.c:
(trilobite_eazel_time_service_do_http_request):
* components/tree/nautilus-tree-view.c:
* configure.in:
* libnautilus-extensions/bonobo-stream-vfs.c:
(bonobo_stream_vfs_open):
* libnautilus-extensions/nautilus-background.c:
(nautilus_background_draw), (nautilus_background_draw_aa):
* libnautilus-extensions/nautilus-customization-data.c:
(nautilus_customization_data_new):
* libnautilus-extensions/nautilus-directory-background.c:
(nautilus_directory_background_write_desktop_settings):
* libnautilus-extensions/nautilus-file-operations.c:
(nautilus_file_operations_move_to_trash), (do_empty_trash):
* libnautilus-extensions/nautilus-file.c: (nautilus_file_dump):
* libnautilus-extensions/nautilus-icon-canvas-item.c:
(draw_or_measure_label_text), (emblem_layout_next):
* libnautilus-extensions/nautilus-icon-factory.c:
(get_image_from_cache):
* libnautilus-extensions/nautilus-icon-text-item.c:
(iti_paint_text):
* libnautilus-extensions/nautilus-list.c: (draw_cell), (draw_row):
* libnautilus-extensions/nautilus-mime-actions.c:
(nautilus_mime_add_application_to_short_list_for_uri):
* libnautilus-extensions/nautilus-program-chooser.c:
(program_file_pair_get_short_status_text),
(program_file_pair_get_long_status_text):
* libnautilus-extensions/nautilus-program-choosing.c:
(nautilus_choose_component_for_file),
(nautilus_choose_application_for_file):
* libnautilus-extensions/nautilus-scalable-font.c:
(nautilus_scalable_font_draw_text_lines_with_dimensions):
* libnautilus-extensions/nautilus-theme.c:
(nautilus_theme_make_selector):
* librsvg/rsvg-ft.c: (rsvg_ft_get_glyph):
* librsvg/test-ft-gtk.c: (set_text):
* librsvg/test-ft.c: (save_pixbuf_to_file_internal),
(save_pixbuf_to_file):
* librsvg/test-rsvg.c: (save_pixbuf_to_file_internal),
(save_pixbuf_to_file):
* src/file-manager/fm-directory-view.c: (display_pending_files),
(compute_menu_item_info):
* src/file-manager/fm-icon-view.c: (compute_menu_item_info):
* src/file-manager/fm-list-view.c: (get_column_from_attribute):
* src/nautilus-application.c: (nautilus_application_startup):
* src/nautilus-search-bar-criterion.c:
(nautilus_search_bar_criterion_next_new),
(nautilus_search_bar_criterion_get_location),
(get_date_modified_location_for):
* src/nautilus-sidebar-tabs.c: (draw_one_tab_themed),
(draw_or_layout_all_tabs):
* src/nautilus-toolbar.c: (nautilus_toolbar_size_allocate):
* src/nautilus-window-manage-views.c:
(nautilus_window_get_current_location_title):
* test/test-nautilus-label.c: (justification_changed_callback):
Fix all the warnings -Wuninitialized found.
Quite a number of them were actual bugs.
Turn on -Wuninitialized in configure.in now that ORBit generates
warning-free code.
52 files changed, 383 insertions, 165 deletions
@@ -1,3 +1,71 @@ +2000-09-05 Pavel Cisler <pavel@eazel.com> + + * components/help/converters/gnome-db2html2/gdb3html.c: + (xml_parse_document): + * components/help/hyperbola-nav-index.c: (end_element): + * components/services/summary/nautilus-view/nautilus-summary-view.c + : (logout_button_cb): + * components/services/time/service/trilobite-eazel-time-service.c: + (trilobite_eazel_time_service_do_http_request): + * components/tree/nautilus-tree-view.c: + * configure.in: + * libnautilus-extensions/bonobo-stream-vfs.c: + (bonobo_stream_vfs_open): + * libnautilus-extensions/nautilus-background.c: + (nautilus_background_draw), (nautilus_background_draw_aa): + * libnautilus-extensions/nautilus-customization-data.c: + (nautilus_customization_data_new): + * libnautilus-extensions/nautilus-directory-background.c: + (nautilus_directory_background_write_desktop_settings): + * libnautilus-extensions/nautilus-file-operations.c: + (nautilus_file_operations_move_to_trash), (do_empty_trash): + * libnautilus-extensions/nautilus-file.c: (nautilus_file_dump): + * libnautilus-extensions/nautilus-icon-canvas-item.c: + (draw_or_measure_label_text), (emblem_layout_next): + * libnautilus-extensions/nautilus-icon-factory.c: + (get_image_from_cache): + * libnautilus-extensions/nautilus-icon-text-item.c: + (iti_paint_text): + * libnautilus-extensions/nautilus-list.c: (draw_cell), (draw_row): + * libnautilus-extensions/nautilus-mime-actions.c: + (nautilus_mime_add_application_to_short_list_for_uri): + * libnautilus-extensions/nautilus-program-chooser.c: + (program_file_pair_get_short_status_text), + (program_file_pair_get_long_status_text): + * libnautilus-extensions/nautilus-program-choosing.c: + (nautilus_choose_component_for_file), + (nautilus_choose_application_for_file): + * libnautilus-extensions/nautilus-scalable-font.c: + (nautilus_scalable_font_draw_text_lines_with_dimensions): + * libnautilus-extensions/nautilus-theme.c: + (nautilus_theme_make_selector): + * librsvg/rsvg-ft.c: (rsvg_ft_get_glyph): + * librsvg/test-ft-gtk.c: (set_text): + * librsvg/test-ft.c: (save_pixbuf_to_file_internal), + (save_pixbuf_to_file): + * librsvg/test-rsvg.c: (save_pixbuf_to_file_internal), + (save_pixbuf_to_file): + * src/file-manager/fm-directory-view.c: (display_pending_files), + (compute_menu_item_info): + * src/file-manager/fm-icon-view.c: (compute_menu_item_info): + * src/file-manager/fm-list-view.c: (get_column_from_attribute): + * src/nautilus-application.c: (nautilus_application_startup): + * src/nautilus-search-bar-criterion.c: + (nautilus_search_bar_criterion_next_new), + (nautilus_search_bar_criterion_get_location), + (get_date_modified_location_for): + * src/nautilus-sidebar-tabs.c: (draw_one_tab_themed), + (draw_or_layout_all_tabs): + * src/nautilus-toolbar.c: (nautilus_toolbar_size_allocate): + * src/nautilus-window-manage-views.c: + (nautilus_window_get_current_location_title): + * test/test-nautilus-label.c: (justification_changed_callback): + + Fix all the warnings -Wuninitialized found. + Quite a number of them were actual bugs. + Turn on -Wuninitialized in configure.in now that ORBit generates + warning-free code. + 2000-09-05 John Sullivan <sullivan@eazel.com> Fixed bug 1247 ("Edit Novice Settings" menu item diff --git a/components/adapter/bonobo-stream-vfs.c b/components/adapter/bonobo-stream-vfs.c index 74e85a8df..fa9d28280 100644 --- a/components/adapter/bonobo-stream-vfs.c +++ b/components/adapter/bonobo-stream-vfs.c @@ -360,19 +360,24 @@ BonoboStream * bonobo_stream_vfs_open (const char *uri, Bonobo_Storage_OpenMode mode) { GnomeVFSHandle *fd = NULL; - GnomeVFSResult res; + GnomeVFSResult result; g_return_val_if_fail (uri != NULL, NULL); - if (mode == Bonobo_Storage_READ) - res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ); - else if (mode == Bonobo_Storage_WRITE) - res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE); + /* unhandled open modes */ + result = GNOME_VFS_ERROR_NOT_SUPPORTED; - if(fd && res == GNOME_VFS_OK) + if (mode == Bonobo_Storage_READ) { + result = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ); + } else if (mode == Bonobo_Storage_WRITE) { + result = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE); + } + + if (fd != NULL && result == GNOME_VFS_OK) { return bonobo_stream_create (fd); - else - return NULL; + } + + return NULL; } /** diff --git a/components/help/converters/gnome-db2html2/gdb3html.c b/components/help/converters/gnome-db2html2/gdb3html.c index ab797c05e..203b04c67 100644 --- a/components/help/converters/gnome-db2html2/gdb3html.c +++ b/components/help/converters/gnome-db2html2/gdb3html.c @@ -551,6 +551,8 @@ xml_parse_document (gchar *filename) xmlParserCtxtPtr ctxt; char *directory; + directory = NULL; + ctxt = xmlCreateFileParserCtxt(filename); if (ctxt == NULL) { return (NULL); diff --git a/components/help/hyperbola-nav-index.c b/components/help/hyperbola-nav-index.c index 2092d04d8..d0334a3d1 100644 --- a/components/help/hyperbola-nav-index.c +++ b/components/help/hyperbola-nav-index.c @@ -395,6 +395,7 @@ end_element (SAXParseInfo *spi, g_return_if_fail(spi->stinfo[PRIMARY]); + it = PRIMARY; if(spi->stinfo[SECONDARY] || spi->stinfo[SEE] || spi->stinfo[SEEALSO]) { parent_ii = g_tree_lookup(spi->idx->all_items, spi->stinfo[PRIMARY]); @@ -442,7 +443,6 @@ end_element (SAXParseInfo *spi, } else { - it = PRIMARY; parent_tree = spi->idx->all_items; } diff --git a/components/services/summary/nautilus-summary-view.c b/components/services/summary/nautilus-summary-view.c index a1a346c87..4368916f7 100644 --- a/components/services/summary/nautilus-summary-view.c +++ b/components/services/summary/nautilus-summary-view.c @@ -558,7 +558,7 @@ logout_button_cb (GtkWidget *button, NautilusSummaryView *view) if (CORBA_OBJECT_NIL != view->details->user_control) { /* Get list of currently active users */ - EazelProxy_UserControl_get_active_users ( + users = EazelProxy_UserControl_get_active_users ( view->details->user_control, &ev ); diff --git a/components/services/summary/nautilus-view/nautilus-summary-view.c b/components/services/summary/nautilus-view/nautilus-summary-view.c index a1a346c87..4368916f7 100644 --- a/components/services/summary/nautilus-view/nautilus-summary-view.c +++ b/components/services/summary/nautilus-view/nautilus-summary-view.c @@ -558,7 +558,7 @@ logout_button_cb (GtkWidget *button, NautilusSummaryView *view) if (CORBA_OBJECT_NIL != view->details->user_control) { /* Get list of currently active users */ - EazelProxy_UserControl_get_active_users ( + users = EazelProxy_UserControl_get_active_users ( view->details->user_control, &ev ); diff --git a/components/services/time/service/trilobite-eazel-time-service.c b/components/services/time/service/trilobite-eazel-time-service.c index aa76c875c..b1ce7f771 100644 --- a/components/services/time/service/trilobite-eazel-time-service.c +++ b/components/services/time/service/trilobite-eazel-time-service.c @@ -435,18 +435,18 @@ trilobite_eazel_time_service_do_http_request (TrilobiteEazelTimeService *service switch (request_status) { case ghttp_error: { - Trilobite_Eazel_Time_CannotGetTime *exn; - const char *reason; - exn = Trilobite_Eazel_Time_CannotGetTime__alloc (); - - reason = ghttp_get_error (request); - exn->url = CORBA_string_dup (service->private->time_url); - exn->reason = reason==NULL ? CORBA_string_dup ("Bad url"): CORBA_string_dup ( reason ); - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Trilobite_Eazel_Time_CannotGetTime, exn); - - result = 0; - } - break; + Trilobite_Eazel_Time_CannotGetTime *exn; + const char *reason; + exn = Trilobite_Eazel_Time_CannotGetTime__alloc (); + + reason = ghttp_get_error (request); + exn->url = CORBA_string_dup (service->private->time_url); + exn->reason = reason==NULL ? CORBA_string_dup ("Bad url"): CORBA_string_dup ( reason ); + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Trilobite_Eazel_Time_CannotGetTime, exn); + + result = 0; + } + break; case ghttp_not_done: g_message ("hest"); result = 0; @@ -454,6 +454,10 @@ trilobite_eazel_time_service_do_http_request (TrilobiteEazelTimeService *service case ghttp_done: result = trilobite_eazel_time_service_parse_body (ghttp_get_body (request)); break; + default: + result = 0; + g_assert_not_reached (); + break; } ghttp_clean (request); diff --git a/components/tree/nautilus-tree-view.c b/components/tree/nautilus-tree-view.c index 92b218834..82debbd31 100644 --- a/components/tree/nautilus-tree-view.c +++ b/components/tree/nautilus-tree-view.c @@ -1106,6 +1106,7 @@ expand_uri_sequence_and_select_end (NautilusTreeView *view) gboolean at_least_one_found; at_least_one_found = FALSE; + uri = NULL; if (!view->details->root_seen) { call_when_root_seen (view, expand_uri_sequence_and_select_end); @@ -1578,6 +1579,8 @@ static void nautilus_tree_view_drag_data_received (GtkWidget *widget, action_string = "link"; break; default: + g_assert_not_reached (); + action_string = "error"; break; } diff --git a/configure.in b/configure.in index 6154795ee..f2006eb12 100644 --- a/configure.in +++ b/configure.in @@ -466,7 +466,7 @@ AC_MSG_CHECKING(for more warnings, including -Werror) if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then AC_MSG_RESULT(yes) CFLAGS="$CFLAGS \ - -Wall -Wno-uninitialized \ + -Wall -Wuninitialized \ -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith \ -Wno-sign-compare -Wsign-promo \ diff --git a/libnautilus-extensions/bonobo-stream-vfs.c b/libnautilus-extensions/bonobo-stream-vfs.c index 74e85a8df..fa9d28280 100644 --- a/libnautilus-extensions/bonobo-stream-vfs.c +++ b/libnautilus-extensions/bonobo-stream-vfs.c @@ -360,19 +360,24 @@ BonoboStream * bonobo_stream_vfs_open (const char *uri, Bonobo_Storage_OpenMode mode) { GnomeVFSHandle *fd = NULL; - GnomeVFSResult res; + GnomeVFSResult result; g_return_val_if_fail (uri != NULL, NULL); - if (mode == Bonobo_Storage_READ) - res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ); - else if (mode == Bonobo_Storage_WRITE) - res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE); + /* unhandled open modes */ + result = GNOME_VFS_ERROR_NOT_SUPPORTED; - if(fd && res == GNOME_VFS_OK) + if (mode == Bonobo_Storage_READ) { + result = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ); + } else if (mode == Bonobo_Storage_WRITE) { + result = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE); + } + + if (fd != NULL && result == GNOME_VFS_OK) { return bonobo_stream_create (fd); - else - return NULL; + } + + return NULL; } /** diff --git a/libnautilus-extensions/nautilus-background.c b/libnautilus-extensions/nautilus-background.c index f63742a54..536ce6b45 100644 --- a/libnautilus-extensions/nautilus-background.c +++ b/libnautilus-extensions/nautilus-background.c @@ -348,6 +348,8 @@ nautilus_background_draw (NautilusBackground *background, g_assert_not_reached (); /* fall through */ case NAUTILUS_BACKGROUND_CENTERED: + image_width = gdk_pixbuf_get_width (background->details->image); + image_height = gdk_pixbuf_get_height (background->details->image); gdk_pixbuf_render_to_drawable (background->details->image, drawable, gc, 0, 0, rectangle->x + (rectangle->width - image_width)/2, @@ -531,6 +533,9 @@ nautilus_background_draw_aa (NautilusBackground *background, int accumulator, temp_value; g_return_if_fail (NAUTILUS_IS_BACKGROUND (background)); + + remaining_width = 0; + remaining_height = 0; if (!buffer->is_buf) { if (!nautilus_background_image_fully_obscures (background, entire_width, entire_height, TRUE)) { diff --git a/libnautilus-extensions/nautilus-customization-data.c b/libnautilus-extensions/nautilus-customization-data.c index 6f954b941..1b4699f2f 100644 --- a/libnautilus-extensions/nautilus-customization-data.c +++ b/libnautilus-extensions/nautilus-customization-data.c @@ -83,6 +83,7 @@ nautilus_customization_data_new (const char *customization_name, data = g_new0 (NautilusCustomizationData, 1); + public_result = GNOME_VFS_OK; if (show_public_customizations) { public_directory_uri = get_global_customization_uri (customization_name); diff --git a/libnautilus-extensions/nautilus-directory-background.c b/libnautilus-extensions/nautilus-directory-background.c index 4d27fd7a0..fdeb24716 100644 --- a/libnautilus-extensions/nautilus-directory-background.c +++ b/libnautilus-extensions/nautilus-directory-background.c @@ -271,6 +271,10 @@ nautilus_directory_background_write_desktop_settings (char *color, char *image, break; case NAUTILUS_BACKGROUND_SCALED_ASPECT: wallpaper_align = WALLPAPER_SCALED_KEEP; + break; + default: + g_assert_not_reached (); + wallpaper_align = WALLPAPER_TILED; break; } gnome_config_set_int ("/Background/Default/wallpaperAlign", wallpaper_align); diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c index 79207c2d0..ce0b2565a 100644 --- a/libnautilus-extensions/nautilus-file-operations.c +++ b/libnautilus-extensions/nautilus-file-operations.c @@ -916,6 +916,8 @@ nautilus_file_operations_move_to_trash (const GList *item_uris, source_uri_list = NULL; target_uri_list = NULL; + result = GNOME_VFS_OK; + /* build the source and uri list, checking if any of the delete itmes are Trash */ for (p = item_uris; p != NULL; p = p->next) { bail = FALSE; @@ -1057,6 +1059,8 @@ do_empty_trash (GtkWidget *parent_view) */ trash_dir_uri = NULL; + trash_dir_list = NULL; + result = gnome_vfs_find_directory (NULL, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_dir_uri, FALSE, FALSE, 0777); diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c index a302d524f..c2bff8bca 100644 --- a/libnautilus-extensions/nautilus-file.c +++ b/libnautilus-extensions/nautilus-file.c @@ -3717,9 +3717,6 @@ nautilus_file_dump (NautilusFile *file) } else { g_print("size: %ld \n", size); switch (file->details->info->type) { - case GNOME_VFS_FILE_TYPE_UNKNOWN: - file_kind = "unknown"; - break; case GNOME_VFS_FILE_TYPE_REGULAR: file_kind = "regular file"; break; @@ -3741,6 +3738,10 @@ nautilus_file_dump (NautilusFile *file) case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK: file_kind = "symbolic link"; break; + case GNOME_VFS_FILE_TYPE_UNKNOWN: + default: + file_kind = "unknown"; + break; } g_print("kind: %s \n", file_kind); if (file->details->info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) { diff --git a/libnautilus-extensions/nautilus-icon-canvas-item.c b/libnautilus-extensions/nautilus-icon-canvas-item.c index 3daac16bf..07d52d1f7 100644 --- a/libnautilus-extensions/nautilus-icon-canvas-item.c +++ b/libnautilus-extensions/nautilus-icon-canvas-item.c @@ -627,6 +627,9 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, char *combined_text; gboolean have_editable, have_additional, needs_highlight; + gc = NULL; + icon_width = 0; + details = item->details; needs_highlight = details->is_highlighted_for_selection || details->is_highlighted_for_drop; @@ -956,6 +959,11 @@ emblem_layout_next (EmblemLayout *layout, x = layout->icon_rect.x0; y = layout->icon_rect.y0; break; + default: + g_assert_not_reached (); + x = 0; + y = 0; + break; } if (layout->position != 0) { switch (layout->side) { diff --git a/libnautilus-extensions/nautilus-icon-factory.c b/libnautilus-extensions/nautilus-icon-factory.c index d28e1ca4e..7c5acf830 100644 --- a/libnautilus-extensions/nautilus-icon-factory.c +++ b/libnautilus-extensions/nautilus-icon-factory.c @@ -1934,6 +1934,9 @@ get_image_from_cache (NautilusScalableIcon *scalable_icon, g_return_val_if_fail (scalable_icon != NULL, NULL); + key = NULL; + image = NULL; + factory = nautilus_get_current_icon_factory (); hash_table = factory->icon_cache; @@ -1959,8 +1962,7 @@ get_image_from_cache (NautilusScalableIcon *scalable_icon, g_assert (image != NULL); } - if (!found_image) - { + if (!found_image) { gboolean got_scaled_image; gboolean got_custom_image; IconInfo key_icon_info; @@ -2046,6 +2048,7 @@ get_image_from_cache (NautilusScalableIcon *scalable_icon, nautilus_icon_factory_schedule_sweep (); /* Grab a ref for the caller. */ + g_assert (image != NULL); gdk_pixbuf_ref (image); return image; } diff --git a/libnautilus-extensions/nautilus-icon-text-item.c b/libnautilus-extensions/nautilus-icon-text-item.c index 04ed0f4fb..2b8a16c20 100644 --- a/libnautilus-extensions/nautilus-icon-text-item.c +++ b/libnautilus-extensions/nautilus-icon-text-item.c @@ -399,6 +399,8 @@ iti_paint_text (Iti *iti, GdkDrawable *drawable, int x, int y) int cursor, offset, i; GnomeCanvasItem *canvas_item; + xpos = 0; + offset = 0; priv = iti->priv; style = GTK_WIDGET (GNOME_CANVAS_ITEM (iti)->canvas)->style; @@ -525,7 +527,7 @@ iti_paint_text (Iti *iti, GdkDrawable *drawable, int x, int y) /* The i-beam should only be drawn at the end of a line of text if that line is the * only or last line of text in a label. We subtract one from the x position * so the i-beam is not visually jammed against the edge of the bounding rect. */ - if (cursor == i){ + if (cursor == i) { int px = x + xpos + offset; y -= ti->baseline_skip; diff --git a/libnautilus-extensions/nautilus-list.c b/libnautilus-extensions/nautilus-list.c index dc0d2fc87..59934fbe9 100644 --- a/libnautilus-extensions/nautilus-list.c +++ b/libnautilus-extensions/nautilus-list.c @@ -1943,7 +1943,7 @@ get_cell_greater_rectangle (GdkRectangle *cell_rect, GdkRectangle *result, static void draw_cell (GtkCList *clist, GdkRectangle *area, int row_index, int column_index, - GtkCListRow *row, GdkRectangle *erase_rect) + GtkCListRow *row) { GtkStyle *style; GdkGC *fg_gc; @@ -2128,7 +2128,6 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, int row_index, GtkCListRow *row) { GtkWidget *widget; - GdkRectangle *rect; GdkRectangle row_rectangle; GdkRectangle extended_row_rectangle; GdkRectangle intersect_rectangle; @@ -2180,7 +2179,7 @@ draw_row (GtkCList *clist, GdkRectangle *area, int row_index, GtkCListRow *row) /* iterate and draw all the columns (row cells) and draw their contents */ for (colum_index = 0; colum_index < clist->columns; colum_index++) { - draw_cell (clist, area, row_index, colum_index, row, rect); + draw_cell (clist, area, row_index, colum_index, row); } /* draw the row spacer */ diff --git a/libnautilus-extensions/nautilus-mime-actions.c b/libnautilus-extensions/nautilus-mime-actions.c index 28f6d5d58..3516b955e 100644 --- a/libnautilus-extensions/nautilus-mime-actions.c +++ b/libnautilus-extensions/nautilus-mime-actions.c @@ -857,6 +857,8 @@ nautilus_mime_add_application_to_short_list_for_uri (const char *uri, GList *old_list, *new_list; GnomeVFSResult result; + result = GNOME_VFS_OK; + old_list = nautilus_mime_get_short_list_applications_for_uri (uri); if (!gnome_vfs_mime_id_in_application_list (application_id, old_list)) { diff --git a/libnautilus-extensions/nautilus-program-chooser.c b/libnautilus-extensions/nautilus-program-chooser.c index 872cebdc0..d5bca1bfb 100644 --- a/libnautilus-extensions/nautilus-program-chooser.c +++ b/libnautilus-extensions/nautilus-program-chooser.c @@ -209,8 +209,10 @@ program_file_pair_get_short_status_text (ProgramFilePair *pair) supertype = get_supertype_from_file (pair->file); switch (pair->status) { + default: case PROGRAM_STATUS_UNKNOWN: g_assert_not_reached (); + result = "error"; break; case PROGRAM_NOT_IN_PREFERRED_LIST: result = g_strdup (_("not in menu")); @@ -254,8 +256,10 @@ program_file_pair_get_long_status_text (ProgramFilePair *pair) file_name = nautilus_file_get_name (pair->file); switch (pair->status) { + default: case PROGRAM_STATUS_UNKNOWN: g_assert_not_reached (); + result = "error"; break; case PROGRAM_NOT_IN_PREFERRED_LIST: result = g_strdup_printf (_("Is not in the menu for \"%s\" items."), file_type); diff --git a/libnautilus-extensions/nautilus-program-choosing.c b/libnautilus-extensions/nautilus-program-choosing.c index eb6d68acd..8ae22c157 100644 --- a/libnautilus-extensions/nautilus-program-choosing.c +++ b/libnautilus-extensions/nautilus-program-choosing.c @@ -125,13 +125,14 @@ nautilus_choose_component_for_file (NautilusFile *file, any_choices = any_programs_available_for_file (action_type, file); identifier = NULL; + dialog = NULL; if (any_choices) { dialog = set_up_program_chooser (file, action_type, parent_window); if (gnome_dialog_run (dialog) == GNOME_OK) { - identifier = nautilus_program_chooser_get_component (dialog);; + identifier = nautilus_program_chooser_get_component (dialog); } } else { nautilus_program_chooser_show_no_choices_message (action_type, file, parent_window); @@ -148,6 +149,7 @@ nautilus_choose_component_for_file (NautilusFile *file, /* Destroy only after callback, since view identifier will * be destroyed too. */ + g_assert (dialog != NULL); gtk_widget_destroy (GTK_WIDGET (dialog)); } } @@ -185,6 +187,7 @@ nautilus_choose_application_for_file (NautilusFile *file, any_choices = any_programs_available_for_file (action_type, file); application = NULL; + dialog = NULL; if (any_choices) { dialog = set_up_program_chooser @@ -207,6 +210,7 @@ nautilus_choose_application_for_file (NautilusFile *file, /* Destroy only after callback, since application struct will * be destroyed too. */ + g_assert (dialog != NULL); gtk_widget_destroy (GTK_WIDGET (dialog)); } } diff --git a/libnautilus-extensions/nautilus-scalable-font.c b/libnautilus-extensions/nautilus-scalable-font.c index 702200450..86ee4b5e6 100644 --- a/libnautilus-extensions/nautilus-scalable-font.c +++ b/libnautilus-extensions/nautilus-scalable-font.c @@ -941,6 +941,7 @@ nautilus_scalable_font_draw_text_lines_with_dimensions (const NautilusScalableFo default: g_assert_not_reached (); + text_x = 0; } text_y = y; diff --git a/libnautilus-extensions/nautilus-theme.c b/libnautilus-extensions/nautilus-theme.c index 74d897c51..8521496b0 100644 --- a/libnautilus-extensions/nautilus-theme.c +++ b/libnautilus-extensions/nautilus-theme.c @@ -211,6 +211,7 @@ nautilus_theme_make_selector (const char *theme_name) return NULL; } + pixbuf = NULL; /* load the icon that we found and return it */ if (nautilus_istr_has_suffix(pixbuf_file, ".svg")) { FILE *f = fopen (pixbuf_file, "rb"); diff --git a/libnautilus-private/bonobo-stream-vfs.c b/libnautilus-private/bonobo-stream-vfs.c index 74e85a8df..fa9d28280 100644 --- a/libnautilus-private/bonobo-stream-vfs.c +++ b/libnautilus-private/bonobo-stream-vfs.c @@ -360,19 +360,24 @@ BonoboStream * bonobo_stream_vfs_open (const char *uri, Bonobo_Storage_OpenMode mode) { GnomeVFSHandle *fd = NULL; - GnomeVFSResult res; + GnomeVFSResult result; g_return_val_if_fail (uri != NULL, NULL); - if (mode == Bonobo_Storage_READ) - res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ); - else if (mode == Bonobo_Storage_WRITE) - res = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE); + /* unhandled open modes */ + result = GNOME_VFS_ERROR_NOT_SUPPORTED; - if(fd && res == GNOME_VFS_OK) + if (mode == Bonobo_Storage_READ) { + result = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_READ); + } else if (mode == Bonobo_Storage_WRITE) { + result = gnome_vfs_open(&fd, uri, GNOME_VFS_OPEN_WRITE); + } + + if (fd != NULL && result == GNOME_VFS_OK) { return bonobo_stream_create (fd); - else - return NULL; + } + + return NULL; } /** diff --git a/libnautilus-private/nautilus-background.c b/libnautilus-private/nautilus-background.c index f63742a54..536ce6b45 100644 --- a/libnautilus-private/nautilus-background.c +++ b/libnautilus-private/nautilus-background.c @@ -348,6 +348,8 @@ nautilus_background_draw (NautilusBackground *background, g_assert_not_reached (); /* fall through */ case NAUTILUS_BACKGROUND_CENTERED: + image_width = gdk_pixbuf_get_width (background->details->image); + image_height = gdk_pixbuf_get_height (background->details->image); gdk_pixbuf_render_to_drawable (background->details->image, drawable, gc, 0, 0, rectangle->x + (rectangle->width - image_width)/2, @@ -531,6 +533,9 @@ nautilus_background_draw_aa (NautilusBackground *background, int accumulator, temp_value; g_return_if_fail (NAUTILUS_IS_BACKGROUND (background)); + + remaining_width = 0; + remaining_height = 0; if (!buffer->is_buf) { if (!nautilus_background_image_fully_obscures (background, entire_width, entire_height, TRUE)) { diff --git a/libnautilus-private/nautilus-customization-data.c b/libnautilus-private/nautilus-customization-data.c index 6f954b941..1b4699f2f 100644 --- a/libnautilus-private/nautilus-customization-data.c +++ b/libnautilus-private/nautilus-customization-data.c @@ -83,6 +83,7 @@ nautilus_customization_data_new (const char *customization_name, data = g_new0 (NautilusCustomizationData, 1); + public_result = GNOME_VFS_OK; if (show_public_customizations) { public_directory_uri = get_global_customization_uri (customization_name); diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index 4d27fd7a0..fdeb24716 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -271,6 +271,10 @@ nautilus_directory_background_write_desktop_settings (char *color, char *image, break; case NAUTILUS_BACKGROUND_SCALED_ASPECT: wallpaper_align = WALLPAPER_SCALED_KEEP; + break; + default: + g_assert_not_reached (); + wallpaper_align = WALLPAPER_TILED; break; } gnome_config_set_int ("/Background/Default/wallpaperAlign", wallpaper_align); diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 79207c2d0..ce0b2565a 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -916,6 +916,8 @@ nautilus_file_operations_move_to_trash (const GList *item_uris, source_uri_list = NULL; target_uri_list = NULL; + result = GNOME_VFS_OK; + /* build the source and uri list, checking if any of the delete itmes are Trash */ for (p = item_uris; p != NULL; p = p->next) { bail = FALSE; @@ -1057,6 +1059,8 @@ do_empty_trash (GtkWidget *parent_view) */ trash_dir_uri = NULL; + trash_dir_list = NULL; + result = gnome_vfs_find_directory (NULL, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_dir_uri, FALSE, FALSE, 0777); diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c index a302d524f..c2bff8bca 100644 --- a/libnautilus-private/nautilus-file.c +++ b/libnautilus-private/nautilus-file.c @@ -3717,9 +3717,6 @@ nautilus_file_dump (NautilusFile *file) } else { g_print("size: %ld \n", size); switch (file->details->info->type) { - case GNOME_VFS_FILE_TYPE_UNKNOWN: - file_kind = "unknown"; - break; case GNOME_VFS_FILE_TYPE_REGULAR: file_kind = "regular file"; break; @@ -3741,6 +3738,10 @@ nautilus_file_dump (NautilusFile *file) case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK: file_kind = "symbolic link"; break; + case GNOME_VFS_FILE_TYPE_UNKNOWN: + default: + file_kind = "unknown"; + break; } g_print("kind: %s \n", file_kind); if (file->details->info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) { diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c index 3daac16bf..07d52d1f7 100644 --- a/libnautilus-private/nautilus-icon-canvas-item.c +++ b/libnautilus-private/nautilus-icon-canvas-item.c @@ -627,6 +627,9 @@ draw_or_measure_label_text (NautilusIconCanvasItem *item, char *combined_text; gboolean have_editable, have_additional, needs_highlight; + gc = NULL; + icon_width = 0; + details = item->details; needs_highlight = details->is_highlighted_for_selection || details->is_highlighted_for_drop; @@ -956,6 +959,11 @@ emblem_layout_next (EmblemLayout *layout, x = layout->icon_rect.x0; y = layout->icon_rect.y0; break; + default: + g_assert_not_reached (); + x = 0; + y = 0; + break; } if (layout->position != 0) { switch (layout->side) { diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index d28e1ca4e..7c5acf830 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -1934,6 +1934,9 @@ get_image_from_cache (NautilusScalableIcon *scalable_icon, g_return_val_if_fail (scalable_icon != NULL, NULL); + key = NULL; + image = NULL; + factory = nautilus_get_current_icon_factory (); hash_table = factory->icon_cache; @@ -1959,8 +1962,7 @@ get_image_from_cache (NautilusScalableIcon *scalable_icon, g_assert (image != NULL); } - if (!found_image) - { + if (!found_image) { gboolean got_scaled_image; gboolean got_custom_image; IconInfo key_icon_info; @@ -2046,6 +2048,7 @@ get_image_from_cache (NautilusScalableIcon *scalable_icon, nautilus_icon_factory_schedule_sweep (); /* Grab a ref for the caller. */ + g_assert (image != NULL); gdk_pixbuf_ref (image); return image; } diff --git a/libnautilus-private/nautilus-icon-text-item.c b/libnautilus-private/nautilus-icon-text-item.c index 04ed0f4fb..2b8a16c20 100644 --- a/libnautilus-private/nautilus-icon-text-item.c +++ b/libnautilus-private/nautilus-icon-text-item.c @@ -399,6 +399,8 @@ iti_paint_text (Iti *iti, GdkDrawable *drawable, int x, int y) int cursor, offset, i; GnomeCanvasItem *canvas_item; + xpos = 0; + offset = 0; priv = iti->priv; style = GTK_WIDGET (GNOME_CANVAS_ITEM (iti)->canvas)->style; @@ -525,7 +527,7 @@ iti_paint_text (Iti *iti, GdkDrawable *drawable, int x, int y) /* The i-beam should only be drawn at the end of a line of text if that line is the * only or last line of text in a label. We subtract one from the x position * so the i-beam is not visually jammed against the edge of the bounding rect. */ - if (cursor == i){ + if (cursor == i) { int px = x + xpos + offset; y -= ti->baseline_skip; diff --git a/libnautilus-private/nautilus-list.c b/libnautilus-private/nautilus-list.c index dc0d2fc87..59934fbe9 100644 --- a/libnautilus-private/nautilus-list.c +++ b/libnautilus-private/nautilus-list.c @@ -1943,7 +1943,7 @@ get_cell_greater_rectangle (GdkRectangle *cell_rect, GdkRectangle *result, static void draw_cell (GtkCList *clist, GdkRectangle *area, int row_index, int column_index, - GtkCListRow *row, GdkRectangle *erase_rect) + GtkCListRow *row) { GtkStyle *style; GdkGC *fg_gc; @@ -2128,7 +2128,6 @@ static void draw_row (GtkCList *clist, GdkRectangle *area, int row_index, GtkCListRow *row) { GtkWidget *widget; - GdkRectangle *rect; GdkRectangle row_rectangle; GdkRectangle extended_row_rectangle; GdkRectangle intersect_rectangle; @@ -2180,7 +2179,7 @@ draw_row (GtkCList *clist, GdkRectangle *area, int row_index, GtkCListRow *row) /* iterate and draw all the columns (row cells) and draw their contents */ for (colum_index = 0; colum_index < clist->columns; colum_index++) { - draw_cell (clist, area, row_index, colum_index, row, rect); + draw_cell (clist, area, row_index, colum_index, row); } /* draw the row spacer */ diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c index 28f6d5d58..3516b955e 100644 --- a/libnautilus-private/nautilus-mime-actions.c +++ b/libnautilus-private/nautilus-mime-actions.c @@ -857,6 +857,8 @@ nautilus_mime_add_application_to_short_list_for_uri (const char *uri, GList *old_list, *new_list; GnomeVFSResult result; + result = GNOME_VFS_OK; + old_list = nautilus_mime_get_short_list_applications_for_uri (uri); if (!gnome_vfs_mime_id_in_application_list (application_id, old_list)) { diff --git a/libnautilus-private/nautilus-program-chooser.c b/libnautilus-private/nautilus-program-chooser.c index 872cebdc0..d5bca1bfb 100644 --- a/libnautilus-private/nautilus-program-chooser.c +++ b/libnautilus-private/nautilus-program-chooser.c @@ -209,8 +209,10 @@ program_file_pair_get_short_status_text (ProgramFilePair *pair) supertype = get_supertype_from_file (pair->file); switch (pair->status) { + default: case PROGRAM_STATUS_UNKNOWN: g_assert_not_reached (); + result = "error"; break; case PROGRAM_NOT_IN_PREFERRED_LIST: result = g_strdup (_("not in menu")); @@ -254,8 +256,10 @@ program_file_pair_get_long_status_text (ProgramFilePair *pair) file_name = nautilus_file_get_name (pair->file); switch (pair->status) { + default: case PROGRAM_STATUS_UNKNOWN: g_assert_not_reached (); + result = "error"; break; case PROGRAM_NOT_IN_PREFERRED_LIST: result = g_strdup_printf (_("Is not in the menu for \"%s\" items."), file_type); diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c index eb6d68acd..8ae22c157 100644 --- a/libnautilus-private/nautilus-program-choosing.c +++ b/libnautilus-private/nautilus-program-choosing.c @@ -125,13 +125,14 @@ nautilus_choose_component_for_file (NautilusFile *file, any_choices = any_programs_available_for_file (action_type, file); identifier = NULL; + dialog = NULL; if (any_choices) { dialog = set_up_program_chooser (file, action_type, parent_window); if (gnome_dialog_run (dialog) == GNOME_OK) { - identifier = nautilus_program_chooser_get_component (dialog);; + identifier = nautilus_program_chooser_get_component (dialog); } } else { nautilus_program_chooser_show_no_choices_message (action_type, file, parent_window); @@ -148,6 +149,7 @@ nautilus_choose_component_for_file (NautilusFile *file, /* Destroy only after callback, since view identifier will * be destroyed too. */ + g_assert (dialog != NULL); gtk_widget_destroy (GTK_WIDGET (dialog)); } } @@ -185,6 +187,7 @@ nautilus_choose_application_for_file (NautilusFile *file, any_choices = any_programs_available_for_file (action_type, file); application = NULL; + dialog = NULL; if (any_choices) { dialog = set_up_program_chooser @@ -207,6 +210,7 @@ nautilus_choose_application_for_file (NautilusFile *file, /* Destroy only after callback, since application struct will * be destroyed too. */ + g_assert (dialog != NULL); gtk_widget_destroy (GTK_WIDGET (dialog)); } } diff --git a/libnautilus-private/nautilus-scalable-font.c b/libnautilus-private/nautilus-scalable-font.c index 702200450..86ee4b5e6 100644 --- a/libnautilus-private/nautilus-scalable-font.c +++ b/libnautilus-private/nautilus-scalable-font.c @@ -941,6 +941,7 @@ nautilus_scalable_font_draw_text_lines_with_dimensions (const NautilusScalableFo default: g_assert_not_reached (); + text_x = 0; } text_y = y; diff --git a/libnautilus-private/nautilus-theme.c b/libnautilus-private/nautilus-theme.c index 74d897c51..8521496b0 100644 --- a/libnautilus-private/nautilus-theme.c +++ b/libnautilus-private/nautilus-theme.c @@ -211,6 +211,7 @@ nautilus_theme_make_selector (const char *theme_name) return NULL; } + pixbuf = NULL; /* load the icon that we found and return it */ if (nautilus_istr_has_suffix(pixbuf_file, ".svg")) { FILE *f = fopen (pixbuf_file, "rb"); diff --git a/librsvg/rsvg-ft.c b/librsvg/rsvg-ft.c index 837df054d..35d42dd75 100644 --- a/librsvg/rsvg-ft.c +++ b/librsvg/rsvg-ft.c @@ -480,6 +480,8 @@ rsvg_ft_get_glyph (RsvgFTFont *font, FT_UInt glyph_ix, double sx, double sy, FT_Vector delta; double expansion, scale; + result = NULL; + if (glyph_ix == 0) return NULL; diff --git a/librsvg/test-ft-gtk.c b/librsvg/test-ft-gtk.c index ce907afe6..d0605a443 100644 --- a/librsvg/test-ft-gtk.c +++ b/librsvg/test-ft-gtk.c @@ -368,6 +368,8 @@ static void set_text (TestCtx *ctx, const char *fn) { int n_lines; char **lines; + lines = NULL; + f = fopen (fn, "r"); if (f == NULL) { g_warning ("Error opening file %s\n", fn); @@ -384,6 +386,9 @@ static void set_text (TestCtx *ctx, const char *fn) { else if (!(n_lines & (n_lines - 1))) { lines = g_renew (char *, lines, n_lines << 1); } + + g_assert (lines != NULL); + len = strlen (line); if (len > 0 && line[len - 1] == '\n') line[--len] = 0; diff --git a/librsvg/test-ft.c b/librsvg/test-ft.c index d21eadcf5..710ad3047 100644 --- a/librsvg/test-ft.c +++ b/librsvg/test-ft.c @@ -115,78 +115,65 @@ art_render_freetype(ArtRender * render, const RsvgFTFont *font, /* utility routine for saving a pixbuf to a png file. * This was adapted from Iain Holmes' code in gnome-iconedit, and probably * should be in a utility library, possibly in gdk-pixbuf itself. + * + * It is split up into save_pixbuf_to_file and save_pixbuf_to_file_internal + * to work around a gcc warning about handle possibly getting clobbered by + * longjmp. Declaring handle 'volatile FILE *' didn't work as it should have. */ -static gboolean save_pixbuf_to_file(GdkPixbuf * pixbuf, char *filename) +static gboolean +save_pixbuf_to_file_internal (GdkPixbuf *pixbuf, char *filename, FILE *handle) { - FILE *handle; - char *buffer; + char *buffer; gboolean has_alpha; int width, height, depth, rowstride; - guchar *pixels; - png_structp png_ptr; - png_infop info_ptr; - png_text text[2]; - int i; - - g_return_val_if_fail(pixbuf != NULL, FALSE); - g_return_val_if_fail(filename != NULL, FALSE); - g_return_val_if_fail(filename[0] != '\0', FALSE); - - if (!strcmp(filename, "-")) - handle = stdout; - else - handle = fopen(filename, "wb"); - if (handle == NULL) { - return FALSE; - } - - png_ptr = - png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, - NULL); + guchar *pixels; + png_structp png_ptr; + png_infop info_ptr; + png_text text[2]; + int i; + + png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { - fclose(handle); return FALSE; } - info_ptr = png_create_info_struct(png_ptr); + info_ptr = png_create_info_struct (png_ptr); if (info_ptr == NULL) { - png_destroy_write_struct(&png_ptr, (png_infopp) NULL); - fclose(handle); - return FALSE; + png_destroy_write_struct (&png_ptr, (png_infopp)NULL); + return FALSE; } - if (setjmp(png_ptr->jmpbuf)) { - png_destroy_write_struct(&png_ptr, &info_ptr); - fclose(handle); + if (setjmp (png_ptr->jmpbuf)) { + png_destroy_write_struct (&png_ptr, &info_ptr); return FALSE; } - png_init_io(png_ptr, handle); + png_init_io (png_ptr, (FILE *)handle); - has_alpha = gdk_pixbuf_get_has_alpha(pixbuf); - width = gdk_pixbuf_get_width(pixbuf); - height = gdk_pixbuf_get_height(pixbuf); - depth = gdk_pixbuf_get_bits_per_sample(pixbuf); - pixels = gdk_pixbuf_get_pixels(pixbuf); - rowstride = gdk_pixbuf_get_rowstride(pixbuf); + has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + depth = gdk_pixbuf_get_bits_per_sample (pixbuf); + pixels = gdk_pixbuf_get_pixels (pixbuf); + rowstride = gdk_pixbuf_get_rowstride (pixbuf); - png_set_IHDR(png_ptr, info_ptr, width, height, - depth, PNG_COLOR_TYPE_RGB_ALPHA, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); + png_set_IHDR (png_ptr, info_ptr, width, height, + depth, PNG_COLOR_TYPE_RGB_ALPHA, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); /* Some text to go with the png image */ text[0].key = "Title"; text[0].text = filename; text[0].compression = PNG_TEXT_COMPRESSION_NONE; text[1].key = "Software"; - text[1].text = "Test-ft"; + text[1].text = "Test-Rsvg"; text[1].compression = PNG_TEXT_COMPRESSION_NONE; - png_set_text(png_ptr, info_ptr, text, 2); + png_set_text (png_ptr, info_ptr, text, 2); /* Write header data */ - png_write_info(png_ptr, info_ptr); + png_write_info (png_ptr, info_ptr); /* if there is no alpha in the data, allocate buffer to expand into */ if (has_alpha) { @@ -194,12 +181,12 @@ static gboolean save_pixbuf_to_file(GdkPixbuf * pixbuf, char *filename) } else { buffer = g_malloc(4 * width); } - - /* pump the raster data into libpng, one scan line at a time */ + + /* pump the raster data into libpng, one scan line at a time */ for (i = 0; i < height; i++) { if (has_alpha) { png_bytep row_pointer = pixels; - png_write_row(png_ptr, row_pointer); + png_write_row (png_ptr, row_pointer); } else { /* expand RGB to RGBA using an opaque alpha value */ int x; @@ -211,19 +198,44 @@ static gboolean save_pixbuf_to_file(GdkPixbuf * pixbuf, char *filename) *buffer_ptr++ = *source_ptr++; *buffer_ptr++ = 255; } - png_write_row(png_ptr, (png_bytep) buffer); + png_write_row (png_ptr, (png_bytep) buffer); } pixels += rowstride; } + + png_write_end (png_ptr, info_ptr); + png_destroy_write_struct (&png_ptr, &info_ptr); + + g_free (buffer); - png_write_end(png_ptr, info_ptr); - png_destroy_write_struct(&png_ptr, &info_ptr); + return TRUE; +} - g_free(buffer); +static gboolean +save_pixbuf_to_file (GdkPixbuf *pixbuf, char *filename) +{ + FILE *handle; + gboolean result; - if (handle != stdout) - fclose(handle); - return TRUE; + g_return_val_if_fail (pixbuf != NULL, FALSE); + g_return_val_if_fail (filename != NULL, FALSE); + g_return_val_if_fail (filename[0] != '\0', FALSE); + + if (!strcmp (filename, "-")) { + handle = stdout; + } else { + handle = fopen (filename, "wb"); + } + + if (handle == NULL) { + return FALSE; + } + + result = save_pixbuf_to_file_internal (pixbuf, filename, handle); + if (!result || handle != stdout) + fclose (handle); + + return result; } static void test_pixmap_destroy(guchar * pixels, gpointer data) diff --git a/librsvg/test-rsvg.c b/librsvg/test-rsvg.c index 55c3395f5..49c591619 100644 --- a/librsvg/test-rsvg.c +++ b/librsvg/test-rsvg.c @@ -40,11 +40,14 @@ /* utility routine for saving a pixbuf to a png file. * This was adapted from Iain Holmes' code in gnome-iconedit, and probably * should be in a utility library, possibly in gdk-pixbuf itself. + * + * It is split up into save_pixbuf_to_file and save_pixbuf_to_file_internal + * to work around a gcc warning about handle possibly getting clobbered by + * longjmp. Declaring handle 'volatile FILE *' didn't work as it should have. */ static gboolean -save_pixbuf_to_file (GdkPixbuf *pixbuf, char *filename) +save_pixbuf_to_file_internal (GdkPixbuf *pixbuf, char *filename, FILE *handle) { - FILE *handle; char *buffer; gboolean has_alpha; int width, height, depth, rowstride; @@ -53,39 +56,24 @@ save_pixbuf_to_file (GdkPixbuf *pixbuf, char *filename) png_infop info_ptr; png_text text[2]; int i; - - g_return_val_if_fail (pixbuf != NULL, FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - g_return_val_if_fail (filename[0] != '\0', FALSE); - - if (!strcmp (filename, "-")) - handle = stdout; - else - handle = fopen (filename, "wb"); - if (handle == NULL) { - return FALSE; - } - + png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { - fclose (handle); return FALSE; } info_ptr = png_create_info_struct (png_ptr); if (info_ptr == NULL) { png_destroy_write_struct (&png_ptr, (png_infopp)NULL); - fclose (handle); return FALSE; } if (setjmp (png_ptr->jmpbuf)) { png_destroy_write_struct (&png_ptr, &info_ptr); - fclose (handle); return FALSE; } - png_init_io (png_ptr, handle); + png_init_io (png_ptr, (FILE *)handle); has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); width = gdk_pixbuf_get_width (pixbuf); @@ -145,11 +133,36 @@ save_pixbuf_to_file (GdkPixbuf *pixbuf, char *filename) g_free (buffer); - if (handle != stdout) - fclose (handle); return TRUE; } +static gboolean +save_pixbuf_to_file (GdkPixbuf *pixbuf, char *filename) +{ + FILE *handle; + gboolean result; + + g_return_val_if_fail (pixbuf != NULL, FALSE); + g_return_val_if_fail (filename != NULL, FALSE); + g_return_val_if_fail (filename[0] != '\0', FALSE); + + if (!strcmp (filename, "-")) { + handle = stdout; + } else { + handle = fopen (filename, "wb"); + } + + if (handle == NULL) { + return FALSE; + } + + result = save_pixbuf_to_file_internal (pixbuf, filename, handle); + if (!result || handle != stdout) + fclose (handle); + + return result; +} + int main (int argc, char **argv) { diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index c66378865..ec1886bbb 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -1333,6 +1333,8 @@ display_pending_files (FMDirectoryView *view) GList *selection; char *uri; + selection = NULL; + if (view->details->model != NULL && nautilus_directory_are_all_files_seen (view->details->model)) { done_loading (view); @@ -2361,6 +2363,7 @@ compute_menu_item_info (FMDirectoryView *directory_view, *return_sensitivity = nautilus_directory_background_is_set (fm_directory_view_get_background (directory_view)); } else { + name = ""; g_assert_not_reached (); } diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 0aa3e43e4..e896063ce 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -427,7 +427,7 @@ compute_menu_item_info (FMIconView *view, *sensitive_return = TRUE; *toggle_item = TRUE; } else { - + name = ""; g_assert_not_reached (); } diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index fc364bc54..eb55525ac 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -1371,6 +1371,7 @@ get_column_from_attribute (FMListView *list_view, const char *value) return LIST_VIEW_COLUMN_NONE; } + number_of_columns = get_number_of_columns (list_view); for (i = 0; i < number_of_columns; i++) { if (strcmp (get_column_attribute (list_view, i), value) == 0) { return i; diff --git a/src/nautilus-application.c b/src/nautilus-application.c index cc8603d9e..b676d132e 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -336,6 +336,7 @@ nautilus_application_startup (NautilusApplication *application, case OAF_REG_ALREADY_ACTIVE: /* Another copy of . */ message = NULL; + detailed_message = NULL; break; case OAF_REG_NOT_LISTED: /* Can't register myself due to trouble locating the diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c index 7df2f0947..352f3a229 100644 --- a/src/nautilus-search-bar-criterion.c +++ b/src/nautilus-search-bar-criterion.c @@ -384,6 +384,7 @@ nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion NULL); break; default: + new_criterion = NULL; g_assert_not_reached (); } @@ -411,7 +412,9 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio GtkWidget *menu_item; int name_number, relation_number, value_number; char *value_text; - + + value_number = 0; + value_text = NULL; /* There is ONE thing you should be aware of while implementing this function. You have to make sure you use non-translated strings for building the uri. So, to implement this, you are supposed to: @@ -433,22 +436,23 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio menu = gtk_option_menu_get_menu (criterion->details->value_menu); menu_item = gtk_menu_get_active (GTK_MENU (menu)); value_number = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu_item), "type")); - } - else if (criterion->details->use_value_entry) { + } else if (criterion->details->use_value_entry) { value_text = gtk_entry_get_text (GTK_ENTRY (criterion->details->value_entry)); - } - else if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) { + } else if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) { value_text = nautilus_gnome_date_edit_get_date_as_string (criterion->details->date); } switch (name_number) { case NAUTILUS_FILE_NAME_SEARCH_CRITERION: + g_assert (criterion->details->use_value_entry + || criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION); return get_name_location_for (relation_number, value_text); case NAUTILUS_CONTENT_SEARCH_CRITERION: return get_content_location_for (relation_number, value_text); case NAUTILUS_FILE_TYPE_SEARCH_CRITERION: + g_assert (criterion->details->use_value_menu); return get_file_type_location_for (relation_number, value_number); case NAUTILUS_SIZE_SEARCH_CRITERION: @@ -464,8 +468,7 @@ nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterio return get_owner_location_for (relation_number, value_text); default: - g_assert_not_reached (); - return NULL; + break; } g_assert_not_reached (); @@ -671,19 +674,14 @@ get_date_modified_location_for (int relation_number, /* Handle "is today" and "is yesterday" separately */ if (relation_number == 5) { result = g_strdup_printf ("%s is today", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED); - } - if (relation_number == 6) { + } else if (relation_number == 6) { result = g_strdup_printf ("%s is yesterday", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED); - } - if (relation_number != 5 && relation_number != 6) { - if (date_string == NULL) { - return g_strdup (""); - } - else { - result = g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED, - possible_relations[relation_number], - date_string); - } + } else if (date_string != NULL) { + result = g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED, + possible_relations[relation_number], + date_string); + } else { + result = g_strdup (""); } return result; diff --git a/src/nautilus-sidebar-tabs.c b/src/nautilus-sidebar-tabs.c index 78dcddaf7..58b932694 100644 --- a/src/nautilus-sidebar-tabs.c +++ b/src/nautilus-sidebar-tabs.c @@ -637,6 +637,8 @@ draw_one_tab_themed (NautilusSidebarTabs *sidebar_tabs, GdkPixbuf *tab_pixbuf, int highlight_offset; int text_x; int text_y; + + left_width = 0; widget = GTK_WIDGET (sidebar_tabs); /* FIXME bugzilla.eazel.com 2504: can't prelight active state yet */ @@ -845,7 +847,11 @@ draw_or_layout_all_tabs (NautilusSidebarTabs *sidebar_tabs, gboolean layout_only gboolean first_flag, prev_invisible; g_assert (NAUTILUS_IS_SIDEBAR_TABS (sidebar_tabs)); - + + temp_gc = NULL; + tab_pixbuf = NULL; + text_h_offset = 0; + next_tab = sidebar_tabs->details->tab_items; widget = GTK_WIDGET (sidebar_tabs); @@ -882,6 +888,7 @@ draw_or_layout_all_tabs (NautilusSidebarTabs *sidebar_tabs, gboolean layout_only temp_gc = gdk_gc_new (widget->window); if (is_themed) { + g_assert (tab_pixbuf != NULL); draw_pixbuf_tiled_aa (sidebar_tabs->details->tab_piece_images[TAB_BACKGROUND], tab_pixbuf, sidebar_tabs->details->tab_height + TAB_TOP_GAP); } else { gdk_gc_set_foreground (temp_gc, &sidebar_tabs->details->background_color); @@ -900,13 +907,16 @@ draw_or_layout_all_tabs (NautilusSidebarTabs *sidebar_tabs, gboolean layout_only if (this_item->visible && !layout_only) { prev_invisible = prev_item && !prev_item->visible; - if (is_themed) + if (is_themed) { + g_assert (tab_pixbuf != NULL); draw_one_tab_themed (sidebar_tabs, tab_pixbuf, this_item->tab_text, x_pos, y_pos, this_item->prelit, first_flag, prev_invisible, text_h_offset, &this_item->tab_rect); - else + } else { + g_assert (temp_gc != NULL); draw_one_tab_plain (sidebar_tabs, temp_gc, this_item->tab_text, x_pos, y_pos, this_item->prelit, &this_item->tab_rect); + } } tab_width = get_tab_width (sidebar_tabs, this_item, is_themed, first_flag); diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c index 4e687b82c..b055a4e6b 100644 --- a/src/nautilus-toolbar.c +++ b/src/nautilus-toolbar.c @@ -102,6 +102,7 @@ nautilus_toolbar_size_allocate (GtkWidget *widget, g_return_if_fail (GTK_IS_TOOLBAR (widget)); g_return_if_fail (allocation != NULL); + save_x = 0; toolbar = GTK_TOOLBAR (widget); nautilus_toolbar = NAUTILUS_TOOLBAR (widget); spacing = nautilus_toolbar->button_spacing; diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c index b514c4107..77ac8a0f4 100644 --- a/src/nautilus-window-manage-views.c +++ b/src/nautilus-window-manage-views.c @@ -221,6 +221,7 @@ nautilus_window_get_current_location_title (NautilusWindow *window) { char *title; + title = NULL; if (window->new_content_view != NULL) { title = nautilus_view_frame_get_title (window->new_content_view); } else if (window->content_view != NULL) { diff --git a/test/test-nautilus-label.c b/test/test-nautilus-label.c index ced192657..b9bcab921 100644 --- a/test/test-nautilus-label.c +++ b/test/test-nautilus-label.c @@ -577,12 +577,13 @@ justification_changed_callback (NautilusStringPicker *string_picker, gpointer cl if (nautilus_str_is_equal (string, "Left")) { justification = GTK_JUSTIFY_LEFT; - } - else if (nautilus_str_has_prefix (string, "Center")) { + } else if (nautilus_str_has_prefix (string, "Center")) { justification = GTK_JUSTIFY_CENTER; - } - else if (nautilus_str_has_prefix (string, "Right")) { + } else if (nautilus_str_has_prefix (string, "Right")) { justification = GTK_JUSTIFY_RIGHT; + } else { + g_assert_not_reached (); + justification = GTK_JUSTIFY_LEFT; } nautilus_label_set_text_justification (NAUTILUS_LABEL (client_data), justification); |