mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-12 10:45:13 +01:00
make static
2000-12-13 Havoc Pennington <hp@redhat.com> * gconvert.c (open_converter): make static * gutf8.c (g_utf8_validate): Simplify logic a bit, maybe speeding it up - now we just return FALSE if we had to bail out for any reason before getting to the end of the string, as defined by a nul byte if len was -1, defined by the len otherwise. This also fixes a bug where nul bytes were not treated as invalid when the length was specified.
This commit is contained in:
parent
484f2ee732
commit
b0baf3db03
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2000-12-13 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gconvert.c (open_converter): make static
|
||||||
|
|
||||||
|
* gutf8.c (g_utf8_validate): Simplify logic a bit, maybe
|
||||||
|
speeding it up - now we just return FALSE if we had to bail out
|
||||||
|
for any reason before getting to the end of the string, as defined
|
||||||
|
by a nul byte if len was -1, defined by the len otherwise. This
|
||||||
|
also fixes a bug where nul bytes were not treated as invalid
|
||||||
|
when the length was specified.
|
||||||
|
|
||||||
2000-12-12 Havoc Pennington <hp@pobox.com>
|
2000-12-12 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
* gmain.c (g_main_context_destroy): don't try to use thread stuff
|
||||||
|
@ -80,7 +80,7 @@ g_iconv_close (GIConv converter)
|
|||||||
return iconv_close (cd);
|
return iconv_close (cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIConv
|
static GIConv
|
||||||
open_converter (const gchar *to_codeset,
|
open_converter (const gchar *to_codeset,
|
||||||
const gchar *from_codeset,
|
const gchar *from_codeset,
|
||||||
GError **error)
|
GError **error)
|
||||||
|
@ -80,7 +80,7 @@ g_iconv_close (GIConv converter)
|
|||||||
return iconv_close (cd);
|
return iconv_close (cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
GIConv
|
static GIConv
|
||||||
open_converter (const gchar *to_codeset,
|
open_converter (const gchar *to_codeset,
|
||||||
const gchar *from_codeset,
|
const gchar *from_codeset,
|
||||||
GError **error)
|
GError **error)
|
||||||
|
22
glib/gutf8.c
22
glib/gutf8.c
@ -550,7 +550,6 @@ g_utf8_validate (const gchar *str,
|
|||||||
{
|
{
|
||||||
|
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
gboolean retval = TRUE;
|
|
||||||
|
|
||||||
if (end)
|
if (end)
|
||||||
*end = str;
|
*end = str;
|
||||||
@ -566,26 +565,17 @@ g_utf8_validate (const gchar *str,
|
|||||||
UTF8_COMPUTE (c, mask, len);
|
UTF8_COMPUTE (c, mask, len);
|
||||||
|
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
{
|
|
||||||
retval = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/* check that the expected number of bytes exists in str */
|
/* check that the expected number of bytes exists in str */
|
||||||
if (max_len >= 0 &&
|
if (max_len >= 0 &&
|
||||||
((max_len - (p - str)) < len))
|
((max_len - (p - str)) < len))
|
||||||
{
|
|
||||||
retval = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
UTF8_GET (result, p, i, mask, len);
|
UTF8_GET (result, p, i, mask, len);
|
||||||
|
|
||||||
if (result == (gunichar)-1)
|
if (result == (gunichar)-1)
|
||||||
{
|
|
||||||
retval = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
p += len;
|
p += len;
|
||||||
}
|
}
|
||||||
@ -593,7 +583,17 @@ g_utf8_validate (const gchar *str,
|
|||||||
if (end)
|
if (end)
|
||||||
*end = p;
|
*end = p;
|
||||||
|
|
||||||
return retval;
|
/* See that we covered the entire length if a length was
|
||||||
|
* passed in, or that we ended on a nul if not
|
||||||
|
*/
|
||||||
|
if (max_len >= 0 &&
|
||||||
|
p != (str + max_len))
|
||||||
|
return FALSE;
|
||||||
|
else if (max_len < 0 &&
|
||||||
|
*p != '\0')
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
22
gutf8.c
22
gutf8.c
@ -550,7 +550,6 @@ g_utf8_validate (const gchar *str,
|
|||||||
{
|
{
|
||||||
|
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
gboolean retval = TRUE;
|
|
||||||
|
|
||||||
if (end)
|
if (end)
|
||||||
*end = str;
|
*end = str;
|
||||||
@ -566,26 +565,17 @@ g_utf8_validate (const gchar *str,
|
|||||||
UTF8_COMPUTE (c, mask, len);
|
UTF8_COMPUTE (c, mask, len);
|
||||||
|
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
{
|
|
||||||
retval = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/* check that the expected number of bytes exists in str */
|
/* check that the expected number of bytes exists in str */
|
||||||
if (max_len >= 0 &&
|
if (max_len >= 0 &&
|
||||||
((max_len - (p - str)) < len))
|
((max_len - (p - str)) < len))
|
||||||
{
|
|
||||||
retval = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
UTF8_GET (result, p, i, mask, len);
|
UTF8_GET (result, p, i, mask, len);
|
||||||
|
|
||||||
if (result == (gunichar)-1)
|
if (result == (gunichar)-1)
|
||||||
{
|
|
||||||
retval = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
p += len;
|
p += len;
|
||||||
}
|
}
|
||||||
@ -593,7 +583,17 @@ g_utf8_validate (const gchar *str,
|
|||||||
if (end)
|
if (end)
|
||||||
*end = p;
|
*end = p;
|
||||||
|
|
||||||
return retval;
|
/* See that we covered the entire length if a length was
|
||||||
|
* passed in, or that we ended on a nul if not
|
||||||
|
*/
|
||||||
|
if (max_len >= 0 &&
|
||||||
|
p != (str + max_len))
|
||||||
|
return FALSE;
|
||||||
|
else if (max_len < 0 &&
|
||||||
|
*p != '\0')
|
||||||
|
return FALSE;
|
||||||
|
else
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user