2009-02-10 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@silver-wind.(none)>
Tue, 10 Feb 2009 13:12:06 +0000 (13:12 +0000)
committerMark Doffman <mdoff@silver-wind.(none)>
Tue, 10 Feb 2009 20:59:21 +0000 (20:59 +0000)
        Fix some warnings when -Wall used.
        These included non-void functions with
        no return values that caused make distcheck to fail.

atk-adaptor/Makefile.am
atk-adaptor/accessible-register.c
dbind/dbind-any.c
dbind/dbind.c
droute/Makefile.am
droute/droute-pairhash.c
droute/droute-pairhash.h
droute/droute-test.c
droute/droute.c

index c47cefc..2ae7a74 100644 (file)
@@ -24,7 +24,7 @@ libspiatk_la_SOURCES =                \
        accessible-register.c   \
        accessible-register.h   \
        action-adaptor.c        \
        accessible-register.c   \
        accessible-register.h   \
        action-adaptor.c        \
-       adaptor.h               \
+       adaptors.h              \
        application-adaptor.c   \
        bridge.c                \
        bridge.h                \
        application-adaptor.c   \
        bridge.c                \
        bridge.h                \
index af9f752..f92c078 100644 (file)
@@ -120,6 +120,7 @@ assign_reference(void)
   /* Reference of 0 not allowed as used as direct key in hash table */
   if (counter == 0)
     counter++;
   /* Reference of 0 not allowed as used as direct key in hash table */
   if (counter == 0)
     counter++;
+  return counter;
 }
 
 /*
 }
 
 /*
index 83a87ba..0d0ecf9 100644 (file)
@@ -8,15 +8,13 @@
 
 #undef DEBUG
 
 
 #undef DEBUG
 
-/* Align a value upward to a boundary, expressed as a number of bytes.
-   E.g. align to an 8-byte boundary with argument of 8.  */
-
-/*
+/*  Align a value upward to a boundary, expressed as a number of bytes.
+ *  E.g. align to an 8-byte boundary with argument of 8.
+ *
  *   (this + boundary - 1)
  *          &
  *    ~(boundary - 1)
  */
  *   (this + boundary - 1)
  *          &
  *    ~(boundary - 1)
  */
-
 #define ALIGN_VALUE(this, boundary) \
   (( ((gulong)(this)) + (((gulong)(boundary)) -1)) & (~(((gulong)(boundary))-1)))
 
 #define ALIGN_VALUE(this, boundary) \
   (( ((gulong)(this)) + (((gulong)(boundary)) -1)) & (~(((gulong)(boundary))-1)))
 
@@ -51,7 +49,7 @@ warn_braces ()
 static unsigned int
 dbind_find_c_alignment_r (char **type)
 {
 static unsigned int
 dbind_find_c_alignment_r (char **type)
 {
-        unsigned int retval = 1;
+    unsigned int retval = 1;
 
     char t = **type;
     (*type)++;
 
     char t = **type;
     (*type)++;
@@ -82,7 +80,7 @@ dbind_find_c_alignment_r (char **type)
     case DBUS_TYPE_SIGNATURE:
     case DBUS_TYPE_ARRAY:
         return DBIND_ALIGNOF_DBIND_POINTER;
     case DBUS_TYPE_SIGNATURE:
     case DBUS_TYPE_ARRAY:
         return DBIND_ALIGNOF_DBIND_POINTER;
-        case DBUS_STRUCT_BEGIN_CHAR:
+    case DBUS_STRUCT_BEGIN_CHAR:
 #if DBIND_ALIGNOF_DBIND_STRUCT > 1
                 retval = MAX (retval, DBIND_ALIGNOF_DBIND_STRUCT);
 #endif
 #if DBIND_ALIGNOF_DBIND_STRUCT > 1
                 retval = MAX (retval, DBIND_ALIGNOF_DBIND_STRUCT);
 #endif
@@ -91,7 +89,7 @@ dbind_find_c_alignment_r (char **type)
                         retval = MAX (retval, elem_align);
         }
         (*type)++;
                         retval = MAX (retval, elem_align);
         }
         (*type)++;
-                return retval;
+        return retval;
     case DBUS_TYPE_STRUCT:
     case DBUS_TYPE_DICT_ENTRY:
         warn_braces ();
     case DBUS_TYPE_STRUCT:
     case DBUS_TYPE_DICT_ENTRY:
         warn_braces ();
@@ -99,9 +97,9 @@ dbind_find_c_alignment_r (char **type)
     case '\0':
         g_assert_not_reached();
         break;
     case '\0':
         g_assert_not_reached();
         break;
-        default:
+    default:
                 return 1;
                 return 1;
-        }
+  }
 }
 
 /*---------------------------------------------------------------------------*/
 }
 
 /*---------------------------------------------------------------------------*/
@@ -110,23 +108,25 @@ dbind_find_c_alignment_r (char **type)
 static size_t
 dbind_gather_alloc_info_r (char **type)
 {
 static size_t
 dbind_gather_alloc_info_r (char **type)
 {
-    char t = **type;
-    (*type)++;
-    if (t == DBUS_TYPE_ARRAY) {
-        switch (**type) {
-            case DBUS_STRUCT_BEGIN_CHAR:
-                while (**type != DBUS_STRUCT_END_CHAR && **type != '\0') (*type)++;
-                if (**type != '\0') (*type)++;
-                break;
-            case '\0':
-                break;
-            default:
-                (*type)++;
-                break;
-            }
+  char t = **type;
+  (*type)++;
+  if (t == DBUS_TYPE_ARRAY)
+    {
+      switch (**type)
+        {
+          case DBUS_STRUCT_BEGIN_CHAR:
+              while (**type != DBUS_STRUCT_END_CHAR && **type != '\0') (*type)++;
+              if (**type != '\0') (*type)++;
+              break;
+          case '\0':
+              break;
+          default:
+              (*type)++;
+              break;
         }
         }
+    }
 
 
-        switch (t) {
+  switch (t) {
     case DBUS_TYPE_BYTE:
         return sizeof (char);
     case DBUS_TYPE_BOOLEAN:
     case DBUS_TYPE_BYTE:
         return sizeof (char);
     case DBUS_TYPE_BOOLEAN:
@@ -167,15 +167,15 @@ dbind_gather_alloc_info_r (char **type)
     case DBUS_TYPE_STRUCT:
     case DBUS_TYPE_DICT_ENTRY:
         warn_braces ();
     case DBUS_TYPE_STRUCT:
     case DBUS_TYPE_DICT_ENTRY:
         warn_braces ();
-        default:
-                return 0;
-        }
+    default:
+        return 0;
+  }
 }
 
 static size_t
 dbind_gather_alloc_info (char *type)
 {
 }
 
 static size_t
 dbind_gather_alloc_info (char *type)
 {
-    return dbind_gather_alloc_info_r (&type);
+  return dbind_gather_alloc_info_r (&type);
 }
 
 /*---------------------------------------------------------------------------*/
 }
 
 /*---------------------------------------------------------------------------*/
@@ -183,8 +183,6 @@ dbind_gather_alloc_info (char *type)
 static void
 dbind_any_free_r (char **type, void **data)
 {
 static void
 dbind_any_free_r (char **type, void **data)
 {
-    size_t len;
-
 #ifdef DEBUG
     fprintf (stderr, "any free '%c' to %p\n", **type, *data);
 #endif
 #ifdef DEBUG
     fprintf (stderr, "any free '%c' to %p\n", **type, *data);
 #endif
@@ -208,7 +206,7 @@ dbind_any_free_r (char **type, void **data)
         int i;
         GArray *vals = **(void ***)data;
         size_t elem_size, elem_align;
         int i;
         GArray *vals = **(void ***)data;
         size_t elem_size, elem_align;
-        char *saved_child_type, *child_type_string;
+        char *saved_child_type;
 
         (*type)++;
         saved_child_type = *type;
 
         (*type)++;
         saved_child_type = *type;
index 0103b4b..0b5224f 100644 (file)
@@ -54,7 +54,7 @@ dbind_method_call_reentrant_va (DBusConnection *cnx,
     DBusMessage *msg = NULL, *reply = NULL;
     DBusMessageIter iter;
     DBusError *err, real_err;
     DBusMessage *msg = NULL, *reply = NULL;
     DBusMessageIter iter;
     DBusError *err, real_err;
-    char *p;
+    const char *p;
 
     if (opt_error)
         err = opt_error;
 
     if (opt_error)
         err = opt_error;
index 9ce04f1..8d7e957 100644 (file)
@@ -8,7 +8,7 @@ libdroute_la_CFLAGS = $(DBUS_GLIB_CFLAGS) \
 libdrouteinclude_HEADERS = \
                droute.h
                droute-variant.h
 libdrouteinclude_HEADERS = \
                droute.h
                droute-variant.h
-libdrouteincludedir=$(includedir)/dbind-0.1
+libdrouteincludedir=$(includedir)/droute
 
 libdroute_la_SOURCES =\
                droute.c\
 
 libdroute_la_SOURCES =\
                droute.c\
@@ -20,14 +20,12 @@ libdroute_la_SOURCES =\
 
 TESTS = droute-test
 
 
 TESTS = droute-test
 
-droute_test_CFLAGS = $(DBUS_GLIB_CFLAGS) \
-                     -I$(top_builddir)
-
 check_PROGRAMS = droute-test
 droute_test_SOURCES  = droute-test.c
 check_PROGRAMS = droute-test
 droute_test_SOURCES  = droute-test.c
-droute_test_CPPFLAGS = $(DBUS_GLIB_CFLAGS) \
-                      -I$(top_builddir)\
-                      -DTEST_INTROSPECTION_DIRECTORY=\"$(top_srcdir)/droute\"
+droute_test_CFLAGS = $(DBUS_GLIB_CFLAGS) \
+                    -I$(top_builddir)\
+                    -I$(top_srcdir)\
+                    -DTEST_INTROSPECTION_DIRECTORY=\"$(top_srcdir)/droute\"
 
 droute_test_LDFLAGS  = $(top_builddir)/dbind/libdbind.la\
                       libdroute.la\
 
 droute_test_LDFLAGS  = $(top_builddir)/dbind/libdbind.la\
                       libdroute.la\
index 0c4ace5..f3b8da2 100644 (file)
@@ -25,7 +25,7 @@
 /*---------------------------------------------------------------------------*/
 
 static guint
 /*---------------------------------------------------------------------------*/
 
 static guint
-str_hash (guint32 h, const signed char *p)
+str_hash (guint32 h, const char *p)
 {
   for (p += 1; *p != '\0'; p++)
       h = (h << 5) - h + *p;
 {
   for (p += 1; *p != '\0'; p++)
       h = (h << 5) - h + *p;
@@ -46,15 +46,15 @@ str_pair_new (const gchar *one, const gchar *two)
     return pair;
 }
 
     return pair;
 }
 
-gint
+guint
 str_pair_hash (gconstpointer key)
 {
     StrPair *pair = (StrPair *) key;
     guint hash = 0;
 
     /*g_return_val_if_fail (pair      != NULL, 0);
 str_pair_hash (gconstpointer key)
 {
     StrPair *pair = (StrPair *) key;
     guint hash = 0;
 
     /*g_return_val_if_fail (pair      != NULL, 0);
-    g_return_val_if_fail (pair->one != NULL, 0);
-    g_return_val_if_fail (pair->two != NULL, 0);
+      g_return_val_if_fail (pair->one != NULL, 0);
+      g_return_val_if_fail (pair->two != NULL, 0);
     */
 
     if (*(pair->two) != '\0')
     */
 
     if (*(pair->two) != '\0')
index 50d4b34..1491c2d 100644 (file)
@@ -34,7 +34,7 @@ struct _StrPair
 StrPair *str_pair_new     (const gchar *one,
                            const gchar *two);
 
 StrPair *str_pair_new     (const gchar *one,
                            const gchar *two);
 
-gint     str_pair_hash    (gconstpointer key);
+guint    str_pair_hash    (gconstpointer key);
 gboolean str_pair_equal   (gconstpointer a,
                            gconstpointer b);
 
 gboolean str_pair_equal   (gconstpointer a,
                            gconstpointer b);
 
index 1895fb6..8b3fb7c 100644 (file)
@@ -2,6 +2,7 @@
 #include <glib.h>
 #include <string.h>
 #include <droute/droute.h>
 #include <glib.h>
 #include <string.h>
 #include <droute/droute.h>
+#include <dbind/dbind.h>
 
 #include "dbus/dbus-glib-lowlevel.h"
 
 
 #include "dbus/dbus-glib-lowlevel.h"
 
@@ -37,9 +38,7 @@ static gboolean       success = TRUE;
 static DBusMessage *
 impl_null (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
 static DBusMessage *
 impl_null (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
-    AnObject    *object = (AnObject *) user_data;
     DBusMessage *reply;
     DBusMessage *reply;
-    DBusError    error;
 
     reply = dbus_message_new_method_return (message);
     return reply;
 
     reply = dbus_message_new_method_return (message);
     return reply;
@@ -107,7 +106,6 @@ impl_setString (DBusConnection *bus, DBusMessage *message, void *user_data)
 static DBusMessage *
 impl_getInterfaceOne (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
 static DBusMessage *
 impl_getInterfaceOne (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
-    AnObject    *object = (AnObject *) user_data;
     DBusMessage *reply;
     DBusError    error;
     gchar       *itf = TEST_INTERFACE_ONE;
     DBusMessage *reply;
     DBusError    error;
     gchar       *itf = TEST_INTERFACE_ONE;
@@ -122,7 +120,6 @@ impl_getInterfaceOne (DBusConnection *bus, DBusMessage *message, void *user_data
 static DBusMessage *
 impl_getInterfaceTwo (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
 static DBusMessage *
 impl_getInterfaceTwo (DBusConnection *bus, DBusMessage *message, void *user_data)
 {
-    AnObject    *object = (AnObject *) user_data;
     DBusMessage *reply;
     DBusError    error;
     gchar       *itf = TEST_INTERFACE_TWO;
     DBusMessage *reply;
     DBusError    error;
     gchar       *itf = TEST_INTERFACE_TWO;
@@ -161,8 +158,8 @@ static DRouteProperty test_properties[] = {
 gboolean
 do_tests_func (gpointer data)
 {
 gboolean
 do_tests_func (gpointer data)
 {
-    DBusError  error;
-    gchar     *bus_name;
+    DBusError    error;
+    const gchar *bus_name;
 
     gchar     *expected_string;
     gchar     *result_string;
 
     gchar     *expected_string;
     gchar     *result_string;
index 3b4d9e3..5b749ae 100644 (file)
@@ -34,7 +34,7 @@
 #if defined DROUTE_DEBUG
     #define _DROUTE_DEBUG(format, args...) g_print (format , ## args)
 #else
 #if defined DROUTE_DEBUG
     #define _DROUTE_DEBUG(format, args...) g_print (format , ## args)
 #else
-    #define _DROUTE_DEBUG
+    #define _DROUTE_DEBUG(format, args...)
 #endif
 
 struct _DRouteContext
 #endif
 
 struct _DRouteContext
@@ -129,6 +129,8 @@ droute_new (DBusConnection *bus, const char *introspect_dir)
     cnx->bus = bus;
     cnx->registered_paths = g_ptr_array_new ();
     cnx->introspect_dir = g_strdup(introspect_dir);
     cnx->bus = bus;
     cnx->registered_paths = g_ptr_array_new ();
     cnx->introspect_dir = g_strdup(introspect_dir);
+
+    return cnx;
 }
 
 void
 }
 
 void
@@ -162,10 +164,12 @@ droute_add_one (DRouteContext *cnx,
                 const void    *data)
 {
     DRoutePath *new_path;
                 const void    *data)
 {
     DRoutePath *new_path;
+    gboolean registered;
 
     new_path = path_new (cnx, (void *) data, NULL);
 
 
     new_path = path_new (cnx, (void *) data, NULL);
 
-    if (!dbus_connection_register_object_path (cnx->bus, path, &droute_vtable, new_path))
+    registered = dbus_connection_register_object_path (cnx->bus, path, &droute_vtable, new_path);
+    if (!registered)
         oom();
 
     g_ptr_array_add (cnx->registered_paths, new_path);
         oom();
 
     g_ptr_array_add (cnx->registered_paths, new_path);