Fix warnings.

* 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.
This commit is contained in:
Elliot Lee 2000-11-28 23:44:21 +00:00
parent 55c7329d51
commit 790a7bd3be
22 changed files with 142 additions and 25 deletions

View 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:

View 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:

View 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:

View 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:

View 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:

View 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:

View 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:

View 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:

View 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

View 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

View 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

View 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

View 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);

View 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) \

View 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))

View 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);

View 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 ().

View 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;
}

View 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))

View 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) \

View 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))

View 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;