mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 10:07:13 +02:00
When using the vsnprintf() implementation, '\0'-terminate the resulting
1999-04-20 Havoc Pennington <hp@pobox.com> * gutils.c (g_vsnprintf): When using the vsnprintf() implementation, '\0'-terminate the resulting string and return its length rather than -1.
This commit is contained in:
committed by
Havoc Pennington
parent
ca97a570cd
commit
dfa88ed86d
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
1999-04-20 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* gutils.c (g_vsnprintf): When using the vsnprintf()
|
||||||
|
implementation, '\0'-terminate the resulting string
|
||||||
|
and return its length rather than -1.
|
||||||
|
|
||||||
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
Mon Apr 19 13:42:21 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gmain.c (g_main_iterate): Added missing
|
* gmain.c (g_main_iterate): Added missing
|
||||||
|
@@ -175,6 +175,12 @@ g_vsnprintf (gchar *str,
|
|||||||
|
|
||||||
retval = vsnprintf (str, n, fmt, args);
|
retval = vsnprintf (str, n, fmt, args);
|
||||||
|
|
||||||
|
if (retval < 0)
|
||||||
|
{
|
||||||
|
str[n-1] = '\0';
|
||||||
|
retval = strlen (str);
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
#else /* !HAVE_VSNPRINTF */
|
#else /* !HAVE_VSNPRINTF */
|
||||||
gchar *printed;
|
gchar *printed;
|
||||||
|
6
gutils.c
6
gutils.c
@@ -175,6 +175,12 @@ g_vsnprintf (gchar *str,
|
|||||||
|
|
||||||
retval = vsnprintf (str, n, fmt, args);
|
retval = vsnprintf (str, n, fmt, args);
|
||||||
|
|
||||||
|
if (retval < 0)
|
||||||
|
{
|
||||||
|
str[n-1] = '\0';
|
||||||
|
retval = strlen (str);
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
#else /* !HAVE_VSNPRINTF */
|
#else /* !HAVE_VSNPRINTF */
|
||||||
gchar *printed;
|
gchar *printed;
|
||||||
|
Reference in New Issue
Block a user