mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 00:06:24 +01:00
make "endptr" const since it's always a pointer into the const string
2008-08-28 Michael Natterer <mitch@imendio.com> * glib/gstrfuncs.c (g_parse_long_long): make "endptr" const since it's always a pointer into the const string passed. Remove some casting to (gchar*) in this function. (g_ascii_strtoull) (g_ascii_strtoll): cast "endptr" to (const gchar**) here when passing it to above function. svn path=/trunk/; revision=7410
This commit is contained in:
parent
f84518e35b
commit
13fe35b66d
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2008-08-28 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
|
* glib/gstrfuncs.c (g_parse_long_long): make "endptr" const since
|
||||||
|
it's always a pointer into the const string passed. Remove some
|
||||||
|
casting to (gchar*) in this function.
|
||||||
|
|
||||||
|
(g_ascii_strtoull)
|
||||||
|
(g_ascii_strtoll): cast "endptr" to (const gchar**) here when
|
||||||
|
passing it to above function.
|
||||||
|
|
||||||
2008-08-28 Bastien Nocera <hadess@hadess.net>
|
2008-08-28 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
Bug 548612 – g_strstr_len() should use memmem when available
|
Bug 548612 – g_strstr_len() should use memmem when available
|
||||||
|
@ -627,7 +627,7 @@ g_ascii_formatd (gchar *buffer,
|
|||||||
|
|
||||||
static guint64
|
static guint64
|
||||||
g_parse_long_long (const gchar *nptr,
|
g_parse_long_long (const gchar *nptr,
|
||||||
gchar **endptr,
|
const gchar **endptr,
|
||||||
guint base,
|
guint base,
|
||||||
gboolean *negative)
|
gboolean *negative)
|
||||||
{
|
{
|
||||||
@ -729,7 +729,7 @@ g_parse_long_long (const gchar *nptr,
|
|||||||
/* Store in ENDPTR the address of one character
|
/* Store in ENDPTR the address of one character
|
||||||
past the last character we converted. */
|
past the last character we converted. */
|
||||||
if (endptr)
|
if (endptr)
|
||||||
*endptr = (gchar*) s;
|
*endptr = s;
|
||||||
|
|
||||||
if (G_UNLIKELY (overflow))
|
if (G_UNLIKELY (overflow))
|
||||||
{
|
{
|
||||||
@ -748,10 +748,10 @@ g_parse_long_long (const gchar *nptr,
|
|||||||
{
|
{
|
||||||
if (save - nptr >= 2 && TOUPPER (save[-1]) == 'X'
|
if (save - nptr >= 2 && TOUPPER (save[-1]) == 'X'
|
||||||
&& save[-2] == '0')
|
&& save[-2] == '0')
|
||||||
*endptr = (gchar*) &save[-1];
|
*endptr = &save[-1];
|
||||||
else
|
else
|
||||||
/* There was no number to convert. */
|
/* There was no number to convert. */
|
||||||
*endptr = (gchar*) nptr;
|
*endptr = nptr;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -792,7 +792,7 @@ g_ascii_strtoull (const gchar *nptr,
|
|||||||
gboolean negative;
|
gboolean negative;
|
||||||
guint64 result;
|
guint64 result;
|
||||||
|
|
||||||
result = g_parse_long_long (nptr, endptr, base, &negative);
|
result = g_parse_long_long (nptr, (const gchar **) endptr, base, &negative);
|
||||||
|
|
||||||
/* Return the result of the appropriate sign. */
|
/* Return the result of the appropriate sign. */
|
||||||
return negative ? -result : result;
|
return negative ? -result : result;
|
||||||
@ -834,7 +834,7 @@ g_ascii_strtoll (const gchar *nptr,
|
|||||||
gboolean negative;
|
gboolean negative;
|
||||||
guint64 result;
|
guint64 result;
|
||||||
|
|
||||||
result = g_parse_long_long (nptr, endptr, base, &negative);
|
result = g_parse_long_long (nptr, (const gchar **) endptr, base, &negative);
|
||||||
|
|
||||||
if (negative && result > (guint64) G_MININT64)
|
if (negative && result > (guint64) G_MININT64)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user