From 1fe02b28ad2e689d5d93cf389eeafa3d84f5fea6 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 19 May 2000 10:01:08 +0000 Subject: [PATCH] added argument assertments. Fri May 19 11:39:29 2000 Tim Janik * gutils.c (g_snprintf): (g_vsnprintf): added argument assertments. * gstring.c (g_string_assign): added argument assertments. (g_string_truncate): make len a guint. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-12 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ glib.h | 2 +- glib/glib.h | 2 +- glib/gstring.c | 2 +- glib/gutils.c | 16 ++++++++++++++++ gstring.c | 2 +- gutils.c | 16 ++++++++++++++++ 14 files changed, 108 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1dd862e1..79c419ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1dd862e1..79c419ae 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Fri May 19 11:39:29 2000 Tim Janik + + + * gutils.c (g_snprintf): + (g_vsnprintf): added argument assertments. + + * gstring.c (g_string_assign): added argument assertments. + (g_string_truncate): make len a guint. + Fri May 19 09:00:44 2000 Tim Janik * gmem.c (g_free): fixed SIZEOF_LONG==4 assumption with diff --git a/glib.h b/glib.h index 23aa72cc..ea31dbb2 100644 --- a/glib.h +++ b/glib.h @@ -1864,7 +1864,7 @@ void g_string_free (GString *string, GString* g_string_assign (GString *string, const gchar *rval); GString* g_string_truncate (GString *string, - gint len); + guint len); GString* g_string_insert_len (GString *string, gint pos, const gchar *val, diff --git a/glib/glib.h b/glib/glib.h index 23aa72cc..ea31dbb2 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -1864,7 +1864,7 @@ void g_string_free (GString *string, GString* g_string_assign (GString *string, const gchar *rval); GString* g_string_truncate (GString *string, - gint len); + guint len); GString* g_string_insert_len (GString *string, gint pos, const gchar *val, diff --git a/glib/gstring.c b/glib/gstring.c index aba8b127..299b2423 100644 --- a/glib/gstring.c +++ b/glib/gstring.c @@ -280,7 +280,7 @@ g_string_assign (GString *string, GString* g_string_truncate (GString *fstring, - gint len) + guint len) { GRealString *string = (GRealString *) fstring; diff --git a/glib/gutils.c b/glib/gutils.c index 7e99bb0b..09646ccb 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -149,6 +149,10 @@ g_snprintf (gchar *str, va_list args; gint retval; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + va_start (args, fmt); retval = vsnprintf (str, n, fmt, args); va_end (args); @@ -164,6 +168,10 @@ g_snprintf (gchar *str, gchar *printed; va_list args; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + va_start (args, fmt); printed = g_strdup_vprintf (fmt, args); va_end (args); @@ -186,6 +194,10 @@ g_vsnprintf (gchar *str, #ifdef HAVE_VSNPRINTF gint retval; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + retval = vsnprintf (str, n, fmt, args); if (retval < 0) @@ -198,6 +210,10 @@ g_vsnprintf (gchar *str, #else /* !HAVE_VSNPRINTF */ gchar *printed; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + printed = g_strdup_vprintf (fmt, args); strncpy (str, printed, n); str[n-1] = '\0'; diff --git a/gstring.c b/gstring.c index aba8b127..299b2423 100644 --- a/gstring.c +++ b/gstring.c @@ -280,7 +280,7 @@ g_string_assign (GString *string, GString* g_string_truncate (GString *fstring, - gint len) + guint len) { GRealString *string = (GRealString *) fstring; diff --git a/gutils.c b/gutils.c index 7e99bb0b..09646ccb 100644 --- a/gutils.c +++ b/gutils.c @@ -149,6 +149,10 @@ g_snprintf (gchar *str, va_list args; gint retval; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + va_start (args, fmt); retval = vsnprintf (str, n, fmt, args); va_end (args); @@ -164,6 +168,10 @@ g_snprintf (gchar *str, gchar *printed; va_list args; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + va_start (args, fmt); printed = g_strdup_vprintf (fmt, args); va_end (args); @@ -186,6 +194,10 @@ g_vsnprintf (gchar *str, #ifdef HAVE_VSNPRINTF gint retval; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + retval = vsnprintf (str, n, fmt, args); if (retval < 0) @@ -198,6 +210,10 @@ g_vsnprintf (gchar *str, #else /* !HAVE_VSNPRINTF */ gchar *printed; + g_return_val_if_fail (str != NULL, 0); + g_return_val_if_fail (n > 0, 0); + g_return_val_if_fail (fmt != NULL, 0); + printed = g_strdup_vprintf (fmt, args); strncpy (str, printed, n); str[n-1] = '\0'; -- 2.34.1