glib r6632 - in trunk/gio: . tests xdgmime



Author: alexl
Date: Thu Mar  6 09:53:35 2008
New Revision: 6632
URL: http://svn.gnome.org/viewvc/glib?rev=6632&view=rev

Log:
2008-03-06  Alexander Larsson  <alexl redhat com>

        * gdesktopappinfo.c:
        * gfilemonitor.c:
        * gthemedicon.c:
        * gunionvolumemonitor.c:
        * gunixmounts.c:
        * tests/g-file.c:
        * tests/live-g-file.c:
        * xdgmime/xdgmimecache.c:
	Fix sparse warnings (#519489)



Modified:
   trunk/gio/ChangeLog
   trunk/gio/gdesktopappinfo.c
   trunk/gio/gfilemonitor.c
   trunk/gio/gthemedicon.c
   trunk/gio/gunionvolumemonitor.c
   trunk/gio/gunixmounts.c
   trunk/gio/tests/g-file.c
   trunk/gio/tests/live-g-file.c
   trunk/gio/xdgmime/xdgmimecache.c

Modified: trunk/gio/gdesktopappinfo.c
==============================================================================
--- trunk/gio/gdesktopappinfo.c	(original)
+++ trunk/gio/gdesktopappinfo.c	Thu Mar  6 09:53:35 2008
@@ -2544,7 +2544,7 @@
 {
   GDesktopAppInfoLookupIface *iface;
   
-  g_return_val_if_fail (G_IS_DESKTOP_APP_INFO_LOOKUP (lookup), FALSE);
+  g_return_val_if_fail (G_IS_DESKTOP_APP_INFO_LOOKUP (lookup), NULL);
 
   iface = G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE (lookup);
 

Modified: trunk/gio/gfilemonitor.c
==============================================================================
--- trunk/gio/gfilemonitor.c	(original)
+++ trunk/gio/gfilemonitor.c	Thu Mar  6 09:53:35 2008
@@ -365,7 +365,7 @@
   source = g_idle_source_new ();
   g_source_set_priority (source, 0);
 
-  g_source_set_callback (source, emit_cb, change, file_change_free);
+  g_source_set_callback (source, emit_cb, change, (GDestroyNotify)file_change_free);
   g_source_attach (source, NULL);
   g_source_unref (source);
 }

Modified: trunk/gio/gthemedicon.c
==============================================================================
--- trunk/gio/gthemedicon.c	(original)
+++ trunk/gio/gthemedicon.c	Thu Mar  6 09:53:35 2008
@@ -226,7 +226,6 @@
 g_themed_icon_append_name (GThemedIcon *icon, const char *iconname)
 {
   guint num_names;
-  char **new_names;
 
   g_return_if_fail (G_IS_THEMED_ICON (icon));
   g_return_if_fail (iconname != NULL);

Modified: trunk/gio/gunionvolumemonitor.c
==============================================================================
--- trunk/gio/gunionvolumemonitor.c	(original)
+++ trunk/gio/gunionvolumemonitor.c	Thu Mar  6 09:53:35 2008
@@ -456,7 +456,7 @@
  * instance on the first call.
  */
 static GNativeVolumeMonitorClass *
-get_native_class ()
+get_native_class (void)
 {
   static GOnce once_init = G_ONCE_INIT;
   GTypeClass *type_class;
@@ -464,7 +464,7 @@
   type_class = NULL;
   g_once (&once_init, (GThreadFunc)get_default_native_class, &type_class);
 
-  if (type_class == NULL && once_init.retval != G_TYPE_INVALID)
+  if (type_class == NULL && once_init.retval != GUINT_TO_POINTER(G_TYPE_INVALID))
     type_class = g_type_class_ref ((GType)once_init.retval);
   
   return (GNativeVolumeMonitorClass *)type_class;

Modified: trunk/gio/gunixmounts.c
==============================================================================
--- trunk/gio/gunixmounts.c	(original)
+++ trunk/gio/gunixmounts.c	Thu Mar  6 09:53:35 2008
@@ -1865,7 +1865,6 @@
 gboolean
 g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
 {
-  GUnixMountType guessed_type;
   const char *mount_path;
 
   /* Never display internal mountpoints */

Modified: trunk/gio/tests/g-file.c
==============================================================================
--- trunk/gio/tests/g-file.c	(original)
+++ trunk/gio/tests/g-file.c	Thu Mar  6 09:53:35 2008
@@ -436,7 +436,7 @@
 roundtrip_parent_child (const gboolean use_uri, const gboolean under_root_descending,
 			const char *path, const char *dir_holder)
 {
-  GFile *files[6] = {0};
+  GFile *files[6] = {NULL};
   int i;
   
   if (use_uri)

Modified: trunk/gio/tests/live-g-file.c
==============================================================================
--- trunk/gio/tests/live-g-file.c	(original)
+++ trunk/gio/tests/live-g-file.c	Thu Mar  6 09:53:35 2008
@@ -26,9 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-
 #define PATTERN_FILE_SIZE	0x10000
-
 #define TEST_HANDLE_SPECIAL	TRUE
 
 enum StructureExtraFlags
@@ -71,7 +69,7 @@
 #define TEST_TARGET_FILE		"target-file"
 
 
-const struct StructureItem sample_struct[] = {
+static const struct StructureItem sample_struct[] = {
 /*	 filename				link	file_type				create_flags		mode | handle_special | extra_flags              */
     {"dir1",				NULL,	G_FILE_TYPE_DIRECTORY,	G_FILE_CREATE_NONE, 0, 0, TEST_DELETE_NORMAL | TEST_DELETE_NON_EMPTY | TEST_REPLACE | TEST_OPEN},
     {"dir1/subdir",			NULL,	G_FILE_TYPE_DIRECTORY,	G_FILE_CREATE_NONE, 0, 0, TEST_COPY	| TEST_COPY_ERROR_RECURSE | TEST_APPEND},
@@ -100,22 +98,13 @@
 	{"lost_symlink",		"nowhere",	G_FILE_TYPE_SYMBOLIC_LINK, G_FILE_CREATE_NONE, 0, 0, TEST_COPY | TEST_DELETE_NORMAL | TEST_OPEN | TEST_INVALID_SYMLINK},
   };
 
-
-
-
 static gboolean write_test;
 static gboolean verbose;
 static gboolean posix_compat;
 
 #define log(msg...) if (verbose)  g_print (msg)
 
-
-
-
-
-
-
-GFile *
+static GFile *
 create_empty_file (GFile * parent, const char *filename,
 		   GFileCreateFlags create_flags)
 {
@@ -124,7 +113,6 @@
   GError *error;
   GFileOutputStream *outs;
 
-
   child = g_file_get_child (parent, filename);
   g_assert (child != NULL);
 
@@ -138,7 +126,7 @@
   return child;
 }
 
-GFile *
+static GFile *
 create_empty_dir (GFile * parent, const char *filename)
 {
   GFile *child;
@@ -154,7 +142,7 @@
   return child;
 }
 
-GFile *
+static GFile *
 create_symlink (GFile * parent, const char *filename, const char *points_to)
 {
   GFile *child;
@@ -182,7 +170,6 @@
   int i;
   struct StructureItem item;
 
-
   g_assert (test_data != NULL);
   log ("\n  Going to create testing structure in '%s'...\n",
        (char *) test_data);
@@ -194,7 +181,6 @@
   res = g_file_make_directory (root, NULL, NULL);
   /*  don't care about errors here  */
 
-
   /*  create any other items  */
   for (i = 0; i < G_N_ELEMENTS (sample_struct); i++)
     {
@@ -270,11 +256,7 @@
   g_object_unref (root);
 }
 
-
-
-
-
-GFile *
+static GFile *
 file_exists (GFile * parent, const char *filename, gboolean * result)
 {
   GFile *child;
@@ -292,7 +274,7 @@
   return child;
 }
 
-void
+static void
 test_attributes (struct StructureItem item, GFileInfo * info)
 {
   GFileType ftype;
@@ -381,7 +363,6 @@
     }
 }
 
-
 static void
 test_initial_structure (gconstpointer test_data)
 {
@@ -406,7 +387,6 @@
   res = g_file_query_exists (root, NULL);
   g_assert_cmpint (res, ==, TRUE);
 
-
   /*  test the structure  */
   for (i = 0; i < G_N_ELEMENTS (sample_struct); i++)
     {
@@ -433,7 +413,6 @@
       g_object_unref (child);
     }
 
-
   /*  read and test the pattern file  */
   log ("    Testing pattern file...\n");
   child = file_exists (root, "pattern_file", &res);
@@ -484,12 +463,7 @@
   g_object_unref (root);
 }
 
-
-
-
-
-
-void
+static void
 traverse_recurse_dirs (GFile * parent, GFile * root)
 {
   gboolean res;
@@ -501,7 +475,6 @@
   int i;
   gboolean found;
 
-
   g_assert (root != NULL);
 
   error = NULL;
@@ -547,7 +520,6 @@
     }
   g_assert (error == NULL);
 
-
   error = NULL;
   res = g_file_enumerator_close (enumerator, NULL, &error);
   g_assert_cmpint (res, ==, TRUE);
@@ -656,12 +628,7 @@
   g_object_unref (root);
 }
 
-
-
-
-
-
-void
+static void
 do_copy_move (GFile * root, struct StructureItem item, const char *target_dir,
 	      enum StructureExtraFlags extra_flags)
 {
@@ -695,7 +662,6 @@
     log ("       res = %d, error code %d = %s\n", res, error->code,
 	 error->message);
 
-
   /*  copying file/directory to itself (".")  */
   if (((item.extra_flags & TEST_NOT_EXISTS) != TEST_NOT_EXISTS) &&
       (extra_flags == TEST_ALREADY_EXISTS))
@@ -758,7 +724,6 @@
   int i;
   struct StructureItem item;
 
-
   log ("\n");
 
   g_assert (test_data != NULL);
@@ -814,10 +779,6 @@
   g_object_unref (root);
 }
 
-
-
-
-
 static void
 test_create (gconstpointer test_data)
 {
@@ -828,7 +789,6 @@
   struct StructureItem item;
   GFileOutputStream *os;
 
-
   g_assert (test_data != NULL);
   log ("\n");
 
@@ -837,7 +797,6 @@
   res = g_file_query_exists (root, NULL);
   g_assert_cmpint (res, ==, TRUE);
 
-
   for (i = 0; i < G_N_ELEMENTS (sample_struct); i++)
     {
       item = sample_struct[i];
@@ -866,7 +825,6 @@
 	  if (error)
 	    log ("       error code %d = %s\n", error->code, error->message);
 
-
 	  if (((item.extra_flags & TEST_NOT_EXISTS) == 0) &&
 	      ((item.extra_flags & TEST_CREATE) == TEST_CREATE))
 	    {
@@ -909,9 +867,6 @@
   g_object_unref (root);
 }
 
-
-
-
 static void
 test_open (gconstpointer test_data)
 {
@@ -922,7 +877,6 @@
   struct StructureItem item;
   GFileInputStream *input_stream;
 
-
   g_assert (test_data != NULL);
   log ("\n");
 
@@ -931,7 +885,6 @@
   res = g_file_query_exists (root, NULL);
   g_assert_cmpint (res, ==, TRUE);
 
-
   for (i = 0; i < G_N_ELEMENTS (sample_struct); i++)
     {
       item = sample_struct[i];
@@ -984,10 +937,6 @@
   g_object_unref (root);
 }
 
-
-
-
-
 static void
 test_delete (gconstpointer test_data)
 {
@@ -998,7 +947,6 @@
   int i;
   struct StructureItem item;
 
-
   g_assert (test_data != NULL);
   log ("\n");
 
@@ -1055,19 +1003,12 @@
 	      g_error_free (error);
 	    }
 
-
 	  g_object_unref (child);
 	}
     }
   g_object_unref (root);
 }
 
-
-
-
-
-
-
 int
 main (int argc, char *argv[])
 {
@@ -1115,8 +1056,6 @@
     }
   target_path = strdup (argv[1]);
 
-
-
   /*  Write test - create new testing structure  */
   if (write_test || create_struct)
     g_test_add_data_func ("/live-g-file/create_structure", target_path,

Modified: trunk/gio/xdgmime/xdgmimecache.c
==============================================================================
--- trunk/gio/xdgmime/xdgmimecache.c	(original)
+++ trunk/gio/xdgmime/xdgmimecache.c	Thu Mar  6 09:53:35 2008
@@ -910,7 +910,7 @@
 	    }
 	}
     }
-  all_parents[p++] = 0;
+  all_parents[p++] = NULL;
   
   result = (char **) malloc (p * sizeof (char *));
   memcpy (result, all_parents, p * sizeof (char *));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]