Re: glib patches
- From: Mark Murnane <Mark Murnane Sun COM>
- To: Sven Neumann <sven gimp org>
- Cc: gtk-devel-list gnome org
- Subject: Re: glib patches
- Date: Wed, 11 Jul 2001 15:56:50 +0100
Hi,
I was about to post a patch along similar lines for the shadowing
problem. By default on Sun's Forte compiler they are errors. I took
the view that the original len parameter was different to the len
variable being declared so I changed the variable to be length. The
parameter and the variable both use different types so is it appropriate
to simply remove the variable?
I've attached my patches in case anyone care to comment.
Thanks,
Mark
------------------------------
Mark Murnane
Desktop, Applications andMiddleware
Sun Microsystems Ireland
------------------------------
Index: glib/guniprop.c
===================================================================
RCS file: /cvs/gnome/glib/glib/guniprop.c,v
retrieving revision 1.9
diff -u -r1.9 guniprop.c
--- glib/guniprop.c 2001/07/07 02:42:47 1.9
+++ glib/guniprop.c 2001/07/11 14:56:14
@@ -711,7 +711,7 @@
g_utf8_strup (const gchar *str,
gssize len)
{
- gsize len;
+ gsize length;
LocaleType locale_type;
gchar *result;
@@ -722,9 +722,9 @@
/*
* We use a two pass approach to keep memory management simple
*/
- len = real_toupper (str, len, NULL, locale_type);
- result = g_malloc (len + 1);
- real_toupper (str, len, result, locale_type);
+ length = real_toupper (str, len, NULL, locale_type);
+ result = g_malloc (length + 1);
+ real_toupper (str, length, result, locale_type);
result[len] = '\0';
return result;
@@ -827,7 +827,7 @@
g_utf8_strdown (const gchar *str,
gssize len)
{
- gsize len;
+ gsize length;
LocaleType locale_type;
gchar *result;
@@ -838,9 +838,9 @@
/*
* We use a two pass approach to keep memory management simple
*/
- len = real_tolower (str, len, NULL, locale_type);
- result = g_malloc (len + 1);
- real_tolower (str, len, result, locale_type);
+ length = real_tolower (str, len, NULL, locale_type);
+ result = g_malloc (length + 1);
+ real_tolower (str, length, result, locale_type);
result[len] = '\0';
return result;
Index: glib/gunicollate.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gunicollate.c,v
retrieving revision 1.2
diff -u -r1.2 gunicollate.c
--- glib/gunicollate.c 2001/07/07 02:42:47 1.2
+++ glib/gunicollate.c 2001/07/11 14:56:14
@@ -165,7 +165,7 @@
gssize len)
{
gchar *result;
- size_t len;
+ size_t length;
#ifdef __STDC_ISO_10646__
@@ -176,16 +176,16 @@
setlocale (LC_COLLATE, "");
- len = wcsxfrm (NULL, (wchar_t *)str_norm, 0);
- result_wc = g_new (wchar_t, len + 1);
- wcsxfrm (result_wc, (wchar_t *)str_norm, len + 1);
+ length = wcsxfrm (NULL, (wchar_t *)str_norm, 0);
+ result_wc = g_new (wchar_t, length + 1);
+ wcsxfrm (result_wc, (wchar_t *)str_norm, length + 1);
- for (i=0; i < len; i++)
+ for (i=0; i < length; i++)
result_len += utf8_encode (NULL, result_wc[i]);
result = g_malloc (result_len + 1);
result_len = 0;
- for (i=0; i < len; i++)
+ for (i=0; i < length; i++)
result_len += utf8_encode (result + result_len, result_wc[i]);
result[result_len] = '\0';
@@ -201,9 +201,9 @@
if (g_get_charset (&charset))
{
- len = strxfrm (NULL, str_norm, 0);
- result = g_malloc (len + 1);
- strxfrm (result, str_norm, len + 1);
+ length = strxfrm (NULL, str_norm, 0);
+ result = g_malloc (length + 1);
+ strxfrm (result, str_norm, length + 1);
}
else
{
@@ -211,20 +211,20 @@
if (str_locale)
{
- len = strxfrm (NULL, str_locale, 0);
- result = g_malloc (len + 2);
+ length = strxfrm (NULL, str_locale, 0);
+ result = g_malloc (length + 2);
result[0] = 'A';
- strxfrm (result + 1, str_locale, len + 1);
+ strxfrm (result + 1, str_locale, length + 1);
g_free (str_locale);
}
else
{
len = strlen (str_norm);
- result = g_malloc (len + 2);
+ result = g_malloc (length + 2);
result[0] = 'B';
- memcpy (result + 1, str_norm, len);
- result[len+1] = '\0';
+ memcpy (result + 1, str_norm, length);
+ result[length+1] = '\0';
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]