Fix warnings.
authorElliot Lee <sopwith@src.gnome.org>
Tue, 28 Nov 2000 23:44:21 +0000 (23:44 +0000)
committerElliot Lee <sopwith@src.gnome.org>
Tue, 28 Nov 2000 23:44:21 +0000 (23:44 +0000)
* gmarkup.c: Fix warnings.

* guniprop.c, gunidecomp.c: Make warnings go away by using
GPOINTER_TO_INT() instead of (int).

* gcompletion.[ch]: Add g_completion_set_compare(),
to allow (for example) using case-insensitive completion.

* gobject/gsignal.c: Fix warnings about possible use of uninitialized
variables, and fix logic that would leave 'node' unset in cases
that it might be used in.

* gobject/glib-genmarshal.c: Fix warning about printf format.

22 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gcompletion.c
gcompletion.h
glib/gcompletion.c
glib/gcompletion.h
glib/gmarkup.c
glib/gunidecomp.c
glib/guniprop.c
gmarkup.c
gobject/ChangeLog
gobject/glib-genmarshal.c
gobject/gsignal.c
gunidecomp.c
guniprop.c
tests/shell-test.c

index 5582acd..8be7822 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index 5582acd..8be7822 100644 (file)
@@ -1,3 +1,13 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gmarkup.c: Fix warnings.
+
+       * guniprop.c, gunidecomp.c: Make warnings go away by using
+       GPOINTER_TO_INT() instead of (int).
+
+       * gcompletion.[ch]: Add g_completion_set_compare(),
+       to allow (for example) using case-insensitive completion.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        Patches by Hans Breuer:
index cf1ca01..21bf69c 100644 (file)
@@ -44,6 +44,7 @@ g_completion_new (GCompletionFunc func)
   gcomp->cache = NULL;
   gcomp->prefix = NULL;
   gcomp->func = func;
+  gcomp->strncmp_func = strncmp;
 
   return gcomp;
 }
@@ -175,13 +176,13 @@ g_completion_complete (GCompletion* cmp,
   if (cmp->prefix && cmp->cache)
     {
       plen = strlen (cmp->prefix);
-      if (plen <= len && !strncmp (prefix, cmp->prefix, plen))
+      if (plen <= len && ! cmp->strncmp_func (prefix, cmp->prefix, plen))
        { 
          /* use the cache */
          list = cmp->cache;
          while (list)
            {
-             if (strncmp (prefix,
+             if (cmp->strncmp_func (prefix,
                           cmp->func ? cmp->func (list->data) : (gchar*) list->data,
                           len))
                {
@@ -204,7 +205,7 @@ g_completion_complete (GCompletion* cmp,
       list = cmp->items;
       while (*prefix && list)
        {
-         if (!strncmp (prefix,
+         if (!cmp->strncmp_func (prefix,
                        cmp->func ? cmp->func (list->data) : (gchar*) list->data,
                        len))
            cmp->cache = g_list_prepend (cmp->cache, list->data);
@@ -232,6 +233,13 @@ g_completion_free (GCompletion* cmp)
   g_free (cmp);
 }
 
+void
+g_completion_set_compare(GCompletion *cmp,
+                        GCompletionStrncmpFunc strncmp_func)
+{
+  cmp->strncmp_func = strncmp_func;
+}
+
 #ifdef TEST_COMPLETION
 #include <stdio.h>
 int
index 5af9475..6ad6533 100644 (file)
@@ -28,6 +28,7 @@
 #define __G_COMPLETION_H__
 
 #include <glist.h>
+#include <unistd.h>
 
 G_BEGIN_DECLS
 
@@ -38,6 +39,9 @@ typedef gchar*          (*GCompletionFunc)      (gpointer);
 /* GCompletion
  */
 
+typedef int (*GCompletionStrcmpFunc)(const char *s1, const char *s2);
+typedef int (*GCompletionStrncmpFunc)(const char *s1, const char *s2, size_t n);
+
 struct _GCompletion
 {
   GList* items;
@@ -45,6 +49,7 @@ struct _GCompletion
  
   gchar* prefix;
   GList* cache;
+  GCompletionStrncmpFunc strncmp_func;
 };
 
 GCompletion* g_completion_new          (GCompletionFunc func);
@@ -56,6 +61,8 @@ void         g_completion_clear_items  (GCompletion*    cmp);
 GList*       g_completion_complete     (GCompletion*    cmp,
                                         gchar*          prefix,
                                         gchar**         new_prefix);
+void         g_completion_set_compare (GCompletion *cmp,
+                                      GCompletionStrncmpFunc strncmp_func);
 void         g_completion_free         (GCompletion*    cmp);
 
 G_END_DECLS
index cf1ca01..21bf69c 100644 (file)
@@ -44,6 +44,7 @@ g_completion_new (GCompletionFunc func)
   gcomp->cache = NULL;
   gcomp->prefix = NULL;
   gcomp->func = func;
+  gcomp->strncmp_func = strncmp;
 
   return gcomp;
 }
@@ -175,13 +176,13 @@ g_completion_complete (GCompletion* cmp,
   if (cmp->prefix && cmp->cache)
     {
       plen = strlen (cmp->prefix);
-      if (plen <= len && !strncmp (prefix, cmp->prefix, plen))
+      if (plen <= len && ! cmp->strncmp_func (prefix, cmp->prefix, plen))
        { 
          /* use the cache */
          list = cmp->cache;
          while (list)
            {
-             if (strncmp (prefix,
+             if (cmp->strncmp_func (prefix,
                           cmp->func ? cmp->func (list->data) : (gchar*) list->data,
                           len))
                {
@@ -204,7 +205,7 @@ g_completion_complete (GCompletion* cmp,
       list = cmp->items;
       while (*prefix && list)
        {
-         if (!strncmp (prefix,
+         if (!cmp->strncmp_func (prefix,
                        cmp->func ? cmp->func (list->data) : (gchar*) list->data,
                        len))
            cmp->cache = g_list_prepend (cmp->cache, list->data);
@@ -232,6 +233,13 @@ g_completion_free (GCompletion* cmp)
   g_free (cmp);
 }
 
+void
+g_completion_set_compare(GCompletion *cmp,
+                        GCompletionStrncmpFunc strncmp_func)
+{
+  cmp->strncmp_func = strncmp_func;
+}
+
 #ifdef TEST_COMPLETION
 #include <stdio.h>
 int
index 5af9475..6ad6533 100644 (file)
@@ -28,6 +28,7 @@
 #define __G_COMPLETION_H__
 
 #include <glist.h>
+#include <unistd.h>
 
 G_BEGIN_DECLS
 
@@ -38,6 +39,9 @@ typedef gchar*          (*GCompletionFunc)      (gpointer);
 /* GCompletion
  */
 
+typedef int (*GCompletionStrcmpFunc)(const char *s1, const char *s2);
+typedef int (*GCompletionStrncmpFunc)(const char *s1, const char *s2, size_t n);
+
 struct _GCompletion
 {
   GList* items;
@@ -45,6 +49,7 @@ struct _GCompletion
  
   gchar* prefix;
   GList* cache;
+  GCompletionStrncmpFunc strncmp_func;
 };
 
 GCompletion* g_completion_new          (GCompletionFunc func);
@@ -56,6 +61,8 @@ void         g_completion_clear_items  (GCompletion*    cmp);
 GList*       g_completion_complete     (GCompletion*    cmp,
                                         gchar*          prefix,
                                         gchar**         new_prefix);
+void         g_completion_set_compare (GCompletion *cmp,
+                                      GCompletionStrncmpFunc strncmp_func);
 void         g_completion_free         (GCompletion*    cmp);
 
 G_END_DECLS
index 4606491..58f9438 100644 (file)
@@ -1263,8 +1263,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
                   if (context->parser->start_element)
                     (* context->parser->start_element) (context,
                                                         start_name,
-                                                        attr_names,
-                                                        attr_values,
+                                                        (const gchar *)attr_names,
+                                                        (const gchar *)attr_values,
                                                         context->user_data,
                                                         &tmp_error);
 
index 19d39e8..e6cf97f 100644 (file)
@@ -29,9 +29,9 @@
 /* We cheat a bit and cast type values to (char *).  We detect these
    using the &0xff trick.  */
 #define CC(Page, Char) \
-  (((((int) (combining_class_table[Page])) & 0xff) \
-    == ((int) combining_class_table[Page])) \
-   ? ((int) combining_class_table[Page]) \
+  ((((GPOINTER_TO_INT(combining_class_table[Page])) & 0xff) \
+    == GPOINTER_TO_INT(combining_class_table[Page])) \
+   ? GPOINTER_TO_INT(combining_class_table[Page]) \
    : (combining_class_table[Page][Char]))
 
 #define COMBINING_CLASS(Char) \
index 8a1b41d..b1513c1 100644 (file)
@@ -34,8 +34,8 @@
 /* We cheat a bit and cast type values to (char *).  We detect these
    using the &0xff trick.  */
 #define TTYPE(Page, Char) \
-  (((((int) type_table[Page]) & 0xff) == ((int) type_table[Page])) \
-   ? ((int) (type_table[Page])) \
+  (((GPOINTER_TO_INT(type_table[Page]) & 0xff) == GPOINTER_TO_INT(type_table[Page])) \
+   ? GPOINTER_TO_INT(type_table[Page]) \
    : (type_table[Page][Char]))
 
 #define TYPE(Char) (((Char) > (G_UNICODE_LAST_CHAR)) ? G_UNICODE_UNASSIGNED : TTYPE ((Char) >> 8, (Char) & 0xff))
index 4606491..58f9438 100644 (file)
--- a/gmarkup.c
+++ b/gmarkup.c
@@ -1263,8 +1263,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context,
                   if (context->parser->start_element)
                     (* context->parser->start_element) (context,
                                                         start_name,
-                                                        attr_names,
-                                                        attr_values,
+                                                        (const gchar *)attr_names,
+                                                        (const gchar *)attr_values,
                                                         context->user_data,
                                                         &tmp_error);
 
index 973493e..082a0a5 100644 (file)
@@ -1,3 +1,11 @@
+2000-11-28  Elliot Lee  <sopwith@redhat.com>
+
+       * gsignal.c: Fix warnings about possible use of uninitialized
+       variables, and fix logic that would leave 'node' unset in cases
+       that it might be used in.
+
+       * glib-genmarshal.c: Fix warning about printf format.
+
 2000-11-28  Tor Lillqvist  <tml@iki.fi>
 
        * gboxed.c: Include <string.h> for memset ().
index d702dad..0c3214a 100644 (file)
@@ -201,7 +201,7 @@ pad (const gchar *string)
     {
       g_free (buffer);
       buffer = g_strdup_printf ("%s ", string);
-      g_warning ("overfull string (%u bytes) for padspace", strlen (string));
+      g_warning ("overfull string (%lu bytes) for padspace", strlen (string));
 
       return buffer;
     }
index beb6dbd..3964c1f 100644 (file)
@@ -376,9 +376,9 @@ handlers_find (gpointer         instance,
     {
       HandlerList *hlist = handler_list_lookup (signal_id, instance);
       Handler *handler;
-      SignalNode *node;
+      SignalNode *node = NULL;
       
-      if (mask & G_SIGNAL_MATCH_FUNC)
+      if (!(mask & G_SIGNAL_MATCH_FUNC))
        {
          node = LOOKUP_SIGNAL_NODE (signal_id);
          if (!node || !node->c_marshaller)
@@ -413,7 +413,7 @@ handlers_find (gpointer         instance,
           for (i = 0; i < hlbsa->n_nodes; i++)
             {
               HandlerList *hlist = g_bsearch_array_get_nth (hlbsa, i);
-             SignalNode *node;
+             SignalNode *node = NULL;
               Handler *handler;
               
              if (!(mask & G_SIGNAL_MATCH_FUNC))
index 19d39e8..e6cf97f 100644 (file)
@@ -29,9 +29,9 @@
 /* We cheat a bit and cast type values to (char *).  We detect these
    using the &0xff trick.  */
 #define CC(Page, Char) \
-  (((((int) (combining_class_table[Page])) & 0xff) \
-    == ((int) combining_class_table[Page])) \
-   ? ((int) combining_class_table[Page]) \
+  ((((GPOINTER_TO_INT(combining_class_table[Page])) & 0xff) \
+    == GPOINTER_TO_INT(combining_class_table[Page])) \
+   ? GPOINTER_TO_INT(combining_class_table[Page]) \
    : (combining_class_table[Page][Char]))
 
 #define COMBINING_CLASS(Char) \
index 8a1b41d..b1513c1 100644 (file)
@@ -34,8 +34,8 @@
 /* We cheat a bit and cast type values to (char *).  We detect these
    using the &0xff trick.  */
 #define TTYPE(Page, Char) \
-  (((((int) type_table[Page]) & 0xff) == ((int) type_table[Page])) \
-   ? ((int) (type_table[Page])) \
+  (((GPOINTER_TO_INT(type_table[Page]) & 0xff) == GPOINTER_TO_INT(type_table[Page])) \
+   ? GPOINTER_TO_INT(type_table[Page]) \
    : (type_table[Page][Char]))
 
 #define TYPE(Char) (((Char) > (G_UNICODE_LAST_CHAR)) ? G_UNICODE_UNASSIGNED : TTYPE ((Char) >> 8, (Char) & 0xff))
index aa5c8c6..c71b10d 100644 (file)
@@ -164,7 +164,6 @@ do_argv_test (const gchar *cmdline, const TestResult *result)
 static void
 run_tests (void)
 {
-  GError *err;
   gint i;
   
   i = 0;