Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler warnings #6

Closed
dalcde opened this issue Aug 25, 2012 · 2 comments
Closed

Compiler warnings #6

dalcde opened this issue Aug 25, 2012 · 2 comments

Comments

@dalcde
Copy link
Contributor

dalcde commented Aug 25, 2012

Might have missed some, but these are those I've found:

nemo-clipboard-monitor.c: In function 'nemo_get_clipboard_callback':
nemo-clipboard-monitor.c:309:17: warning: pointer targets in passing argument 4 of 'gtk_selection_data_set' differ in signedness [-Wpointer-sign]
/usr/include/gtk-3.0/gtk/gtkselection.h:142:10: note: expected 'const guchar *' but argument is of type 'char *'

nemo-clipboard.c: In function 'nemo_clipboard_get_uri_list_from_selection_data':
nemo-clipboard.c:596:3: warning: pointer targets in passing argument 1 of 'g_strsplit' differ in signedness [-Wpointer-sign]
/usr/include/glib-2.0/glib/gstrfuncs.h:230:23: note: expected 'const gchar *' but argument is of type 'guchar *'

nemo-dnd.c: In function 'nemo_drag_build_selection_list':
nemo-dnd.c:244:9: warning: pointer targets in passing argument 1 of 'sscanf' differ in signedness [-Wpointer-sign]
/usr/include/stdio.h:454:12: note: expected 'const char * restrict' but argument is of type 'const guchar *'
nemo-dnd.c: In function 'nemo_drag_drag_data_get':
nemo-dnd.c:693:5: warning: pointer targets in passing argument 4 of 'gtk_selection_data_set' differ in signedness [-Wpointer-sign]
/usr/include/gtk-3.0/gtk/gtkselection.h:142:10: note: expected 'const guchar *' but argument is of type 'gchar *'

nemo-icon-dnd.c: In function 'get_direct_save_filename':
nemo-icon-dnd.c:400:2: warning: pointer targets in return differ in signedness [-Wpointer-sign]
nemo-icon-dnd.c: In function 'drag_data_received_callback':
nemo-icon-dnd.c:1599:8: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
nemo-icon-dnd.c:1608:12: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]

nemo-tree-view-drag-dest.c: In function 'receive_dropped_text':
nemo-tree-view-drag-dest.c:696:7: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
nemo-tree-view-drag-dest.c: In function 'drag_data_received_callback':
nemo-tree-view-drag-dest.c:842:8: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
nemo-tree-view-drag-dest.c: In function 'get_direct_save_filename':
nemo-tree-view-drag-dest.c:891:2: warning: pointer targets in return differ in signedness [-Wpointer-sign]

nemo-undo-signal-handlers.c: In function 'editable_register_edit_undo':
nemo-undo-signal-handlers.c:166:9: warning: pointer targets in passing argument 2 of 'gtk_editable_get_selection_bounds' differ in signedness [-Wpointer-sign]
/usr/include/gtk-3.0/gtk/gtkeditable.h:87:10: note: expected 'gint *' but argument is of type 'guint *'
nemo-undo-signal-handlers.c:166:9: warning: pointer targets in passing argument 3 of 'gtk_editable_get_selection_bounds' differ in signedness [-Wpointer-sign]
/usr/include/gtk-3.0/gtk/gtkeditable.h:87:10: note: expected 'gint *' but argument is of type 'guint *'

nemo-desktop-item-properties.c: In function ‘nemo_desktop_item_properties_url_drag_data_received’:
nemo-desktop-item-properties.c:169:2: warning: pointer targets in passing argument 1 of ‘g_strsplit’ differ in signedness [-Wpointer-sign]
/usr/include/glib-2.0/glib/gstrfuncs.h:230:23: note: expected ‘const gchar *’ but argument is of type ‘const guchar *’
nemo-desktop-item-properties.c: In function ‘nemo_desktop_item_properties_exec_drag_data_received’:
nemo-desktop-item-properties.c:201:2: warning: pointer targets in passing argument 1 of ‘g_strsplit’ differ in signedness [-Wpointer-sign]
/usr/include/glib-2.0/glib/gstrfuncs.h:230:23: note: expected ‘const gchar *’ but argument is of type ‘const guchar *’

nemo-image-properties-page.c: In function ‘file_read_callback’:
nemo-image-properties-page.c:451:10: warning: pointer targets in passing argument 2 of ‘exif_loader_write’ differ in signedness [-Wpointer-sign]
/usr/include/libexif/exif-loader.h:80:15: note: expected ‘unsigned char *’ but argument is of type ‘char *’
nemo-image-properties-page.c:460:19: warning: pointer targets in passing argument 2 of ‘gdk_pixbuf_loader_write’ differ in signedness [-Wpointer-sign]
/usr/include/gdk-pixbuf-2.0/gdk-pixbuf/gdk-pixbuf-loader.h:93:22: note: expected ‘const guchar *’ but argument is of type ‘char *’

nemo-location-bar.c: In function ‘drag_data_received_callback’:
nemo-location-bar.c:164:2: warning: pointer targets in passing argument 1 of ‘g_uri_list_extract_uris’ differ in signedness [-Wpointer-sign]
/usr/include/glib-2.0/glib/gconvert.h:160:9: note: expected ‘const gchar *’ but argument is of type ‘const guchar *’

nemo-pathbar.c: In function ‘button_drag_data_get_cb’:
nemo-pathbar.c:1558:6: warning: pointer targets in passing argument 4 of ‘gtk_selection_data_set’ differ in signedness [-Wpointer-sign]
/usr/include/gtk-3.0/gtk/gtkselection.h:142:10: note: expected ‘const guchar *’ but argument is of type ‘char *’

nemo-places-sidebar.c: In function ‘drag_data_received_callback’:
nemo-places-sidebar.c:1450:4: warning: pointer targets in passing argument 1 of ‘build_selection_list’ differ in signedness [-Wpointer-sign]
nemo-places-sidebar.c:1359:1: note: expected ‘const char *’ but argument is of type ‘const guchar *’
nemo-places-sidebar.c:1530:5: warning: pointer targets in passing argument 1 of ‘build_selection_list’ differ in signedness [-Wpointer-sign]
nemo-places-sidebar.c:1359:1: note: expected ‘const char *’ but argument is of type ‘const guchar *’

nemo-properties-window.c: In function ‘nemo_properties_window_drag_data_received’:
nemo-properties-window.c:477:2: warning: pointer targets in passing argument 1 of ‘g_strsplit’ differ in signedness [-Wpointer-sign]
/usr/include/glib-2.0/glib/gstrfuncs.h:230:23: note: expected ‘const gchar *’ but argument is of type ‘const guchar *’

nemo-toolbar.c: In function ‘toolbar_update_appearance’:
nemo-toolbar.c:67:13: warning: unused variable ‘action’ [-Wunused-variable]

nemo-view.c: In function ‘action_new_launcher_callback’:
nemo-view.c:2043:13: warning: variable ‘window’ set but not used [-Wunused-but-set-variable]
nemo-view.c: In function ‘disconnect_model_handlers’:
nemo-view.c:9169:2: warning: pointer targets in passing argument 2 of ‘disconnect_directory_handler’ differ in signedness [-Wpointer-sign]
nemo-view.c:9152:1: note: expected ‘int *’ but argument is of type ‘guint *’
nemo-view.c:9170:2: warning: pointer targets in passing argument 2 of ‘disconnect_directory_handler’ differ in signedness [-Wpointer-sign]
nemo-view.c:9152:1: note: expected ‘int *’ but argument is of type ‘guint *’
nemo-view.c:9171:2: warning: pointer targets in passing argument 2 of ‘disconnect_directory_handler’ differ in signedness [-Wpointer-sign]
nemo-view.c:9152:1: note: expected ‘int *’ but argument is of type ‘guint *’
nemo-view.c:9172:2: warning: pointer targets in passing argument 2 of ‘disconnect_directory_handler’ differ in signedness [-Wpointer-sign]
nemo-view.c:9152:1: note: expected ‘int *’ but argument is of type ‘guint *’
nemo-view.c:9173:2: warning: pointer targets in passing argument 2 of ‘disconnect_directory_as_file_handler’ differ in signedness [-Wpointer-sign]
nemo-view.c:9158:1: note: expected ‘int *’ but argument is of type ‘guint *’

nemo-window-menus.c: In function ‘action_about_nemo_callback’:
nemo-window-menus.c:344:9: warning: ‘copyright_str’ is used uninitialized in this function [-Wuninitialized]

nemo-convert-metadata.c: In function ‘parse_xml_node’:
nemo-convert-metadata.c:163:3: warning: pointer targets in passing argument 1 of ‘convert_key_name’ differ in signedness [-Wpointer-sign]
nemo-convert-metadata.c:126:1: note: expected ‘const char *’ but argument is of type ‘const xmlChar *’
nemo-convert-metadata.c:169:11: warning: pointer targets in passing argument 3 of ‘g_file_info_set_attribute_string’ differ in signedness [-Wpointer-sign]
/usr/include/glib-2.0/gio/gfileinfo.h:872:20: note: expected ‘const char *’ but argument is of type ‘xmlChar *’
nemo-convert-metadata.c:178:4: warning: pointer targets in passing argument 1 of ‘convert_key_name’ differ in signedness [-Wpointer-sign]
nemo-convert-metadata.c:126:1: note: expected ‘const char *’ but argument is of type ‘const xmlChar *’

@dalcde
Copy link
Contributor Author

dalcde commented Sep 4, 2012

dpkg-gencontrol: warning: package nemo: unused substitution variable ${gnome:Version}
dpkg-gencontrol: warning: package nemo: unused substitution variable ${gnome:NextVersion}

@mtwebster
Copy link
Member

Most of the compile warnings should be gone now, the main remaining ones are for some deprecated (in 3.6) functions.

mtwebster pushed a commit that referenced this issue Mar 11, 2021
With some GIO backends (observed at least with sftp),
g_file_info_get_symlink_target() returns an empty string rather
than NULL for non-symlinks. A warning and then segfault result:

    ** (nemo:8386): WARNING **: 18:34:22.807: File has symlink target, but  is not marked as symlink

    Thread 1 "nemo" received signal SIGSEGV, Segmentation fault.
    0x00007ffff71beac0 in g_str_hash () from /usr/lib/libglib-2.0.so.0
    (gdb) bt
    #0  0x00007ffff71beac0 in g_str_hash () at /usr/lib/libglib-2.0.so.0
    #1  0x00007ffff71bfa2f in g_hash_table_lookup_extended () at /usr/lib/libglib-2.0.so.0
    #2  0x000055555564926e in modify_link_hash_table at ../libnemo-private/nemo-file.c:600
    #3  0x000055555564ed11 in add_to_link_hash_table at ../libnemo-private/nemo-file.c:642
    #4  update_info_internal at ../libnemo-private/nemo-file.c:2683
    #5  0x000055555564f767 in nemo_file_update_info  at ../libnemo-private/nemo-file.c:2702
    #6  0x00005555556263ec in query_info_callback at ../libnemo-private/nemo-directory-async.c:3230

Defend against this at two levels:
 - For non-symlinks, don't call g_file_info_get_symlink_target().
 - Use g_return_if_fail() to prevent NULL pointer dereference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants