mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-12 13:49:22 +01:00
don't overwrite errors
2001-02-09 Havoc Pennington <hp@redhat.com> * gconvert.c (g_convert): don't overwrite errors * gerror.c (g_set_error): improve warning message if an error is overwritten (g_propagate_error): ditto
This commit is contained in:
parent
41e2001d85
commit
a8786011f3
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2001-02-09 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (g_convert): don't overwrite errors
|
||||||
|
|
||||||
|
* gerror.c (g_set_error): improve warning message if an error is
|
||||||
|
overwritten
|
||||||
|
(g_propagate_error): ditto
|
||||||
|
|
||||||
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
* gthread.c, gthread.h: Added functions g_static_rec_mutex_init,
|
||||||
|
11
gconvert.c
11
gconvert.c
@ -233,9 +233,12 @@ g_convert (const gchar *str,
|
|||||||
{
|
{
|
||||||
if ((p - str) != len)
|
if ((p - str) != len)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
|
if (!have_error)
|
||||||
_("Partial character sequence at end of input"));
|
{
|
||||||
have_error = TRUE;
|
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
|
||||||
|
_("Partial character sequence at end of input"));
|
||||||
|
have_error = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +340,8 @@ g_convert_with_fallback (const gchar *str,
|
|||||||
else
|
else
|
||||||
g_error_free (local_error);
|
g_error_free (local_error);
|
||||||
|
|
||||||
|
local_error = NULL;
|
||||||
|
|
||||||
/* No go; to proceed, we need a converter from "UTF-8" to
|
/* No go; to proceed, we need a converter from "UTF-8" to
|
||||||
* to_codeset, and the string as UTF-8.
|
* to_codeset, and the string as UTF-8.
|
||||||
*/
|
*/
|
||||||
|
21
gerror.c
21
gerror.c
@ -169,7 +169,8 @@ g_error_matches (const GError *error,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
|
#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
|
||||||
"This indicates a bug in someone's code. You must ensure an error is NULL before it's set."
|
"This indicates a bug in someone's code. You must ensure an error is NULL before it's set.\n" \
|
||||||
|
"The overwriting error message was: %s"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_set_error:
|
* g_set_error:
|
||||||
@ -189,17 +190,21 @@ g_set_error (GError **err,
|
|||||||
const gchar *format,
|
const gchar *format,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
|
GError *new;
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (err == NULL)
|
if (err == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*err != NULL)
|
|
||||||
g_warning (ERROR_OVERWRITTEN_WARNING);
|
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
*err = g_error_new_valist (domain, code, format, args);
|
new = g_error_new_valist (domain, code, format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
|
if (*err == NULL)
|
||||||
|
*err = new;
|
||||||
|
else
|
||||||
|
g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,9 +230,9 @@ g_propagate_error (GError **dest,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*dest != NULL)
|
if (*dest != NULL)
|
||||||
g_warning (ERROR_OVERWRITTEN_WARNING);
|
g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
|
||||||
|
else
|
||||||
*dest = src;
|
*dest = src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,9 +233,12 @@ g_convert (const gchar *str,
|
|||||||
{
|
{
|
||||||
if ((p - str) != len)
|
if ((p - str) != len)
|
||||||
{
|
{
|
||||||
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
|
if (!have_error)
|
||||||
_("Partial character sequence at end of input"));
|
{
|
||||||
have_error = TRUE;
|
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
|
||||||
|
_("Partial character sequence at end of input"));
|
||||||
|
have_error = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +340,8 @@ g_convert_with_fallback (const gchar *str,
|
|||||||
else
|
else
|
||||||
g_error_free (local_error);
|
g_error_free (local_error);
|
||||||
|
|
||||||
|
local_error = NULL;
|
||||||
|
|
||||||
/* No go; to proceed, we need a converter from "UTF-8" to
|
/* No go; to proceed, we need a converter from "UTF-8" to
|
||||||
* to_codeset, and the string as UTF-8.
|
* to_codeset, and the string as UTF-8.
|
||||||
*/
|
*/
|
||||||
|
@ -169,7 +169,8 @@ g_error_matches (const GError *error,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
|
#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
|
||||||
"This indicates a bug in someone's code. You must ensure an error is NULL before it's set."
|
"This indicates a bug in someone's code. You must ensure an error is NULL before it's set.\n" \
|
||||||
|
"The overwriting error message was: %s"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_set_error:
|
* g_set_error:
|
||||||
@ -189,17 +190,21 @@ g_set_error (GError **err,
|
|||||||
const gchar *format,
|
const gchar *format,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
|
GError *new;
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
if (err == NULL)
|
if (err == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*err != NULL)
|
|
||||||
g_warning (ERROR_OVERWRITTEN_WARNING);
|
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
*err = g_error_new_valist (domain, code, format, args);
|
new = g_error_new_valist (domain, code, format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
|
if (*err == NULL)
|
||||||
|
*err = new;
|
||||||
|
else
|
||||||
|
g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,9 +230,9 @@ g_propagate_error (GError **dest,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*dest != NULL)
|
if (*dest != NULL)
|
||||||
g_warning (ERROR_OVERWRITTEN_WARNING);
|
g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
|
||||||
|
else
|
||||||
*dest = src;
|
*dest = src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user