[PATCH libX11] Clean up some pointer signedness and qualifier warnings

Alan Coopersmith Alan.Coopersmith at Sun.COM
Mon Mar 22 10:37:58 PDT 2010


Is removing unsigned from char variables/pointers that are expected to contain
8-bit characters really the right thing to do?

Seems odd...

	-alan-

Jeff Smith wrote:
> Signed-off-by: Jeff Smith <whydoubt at yahoo.com>
> ---
>  src/xlibi18n/lcUTF8.c |   74 +++++++++++++++++++++++++++++++++---------------
>  1 files changed, 51 insertions(+), 23 deletions(-)
> 
> diff --git a/src/xlibi18n/lcUTF8.c b/src/xlibi18n/lcUTF8.c
> index 08906c6..9fdaf9b 100644
> --- a/src/xlibi18n/lcUTF8.c
> +++ b/src/xlibi18n/lcUTF8.c
> @@ -1822,13 +1822,13 @@ iconv_cstombs(XlcConv conv, XPointer *from, int *from_left,
>  	      XPointer *to, int *to_left, XPointer *args, int num_args)
>  {
>      XlcCharSet charset;
> -    char *name;
> +    const char *name;
>      Utf8Conv convptr;
>      int i;
>      unsigned char const *src;
>      unsigned char const *srcend;
> -    unsigned char *dst;
> -    unsigned char *dstend;
> +    char *dst;
> +    char *dstend;
>      int unconv_num;
>  
>      if (from == NULL || *from == NULL)
> @@ -1849,7 +1849,7 @@ iconv_cstombs(XlcConv conv, XPointer *from, int *from_left,
>  
>      src = (unsigned char const *) *from;
>      srcend = src + *from_left;
> -    dst = (unsigned char *) *to;
> +    dst = (char *) *to;
>      dstend = dst + *to_left;
>      unconv_num = 0;
>  
> @@ -1895,7 +1895,11 @@ static XlcConvMethodsRec iconv_cstombs_methods = {
>  };
>  
>  static XlcConv
> -open_iconv_cstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_cstombs(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      lazy_init_all_charsets();
>      return create_conv(from_lcd, &iconv_cstombs_methods);
> @@ -1907,8 +1911,8 @@ iconv_mbstocs(XlcConv conv, XPointer *from, int *from_left,
>  {
>      Utf8Conv *preferred_charsets;
>      XlcCharSet last_charset = NULL;
> -    unsigned char const *src;
> -    unsigned char const *srcend;
> +    char const *src;
> +    char const *srcend;
>      unsigned char *dst;
>      unsigned char *dstend;
>      int unconv_num;
> @@ -1917,7 +1921,7 @@ iconv_mbstocs(XlcConv conv, XPointer *from, int *from_left,
>  	return 0;
>  
>      preferred_charsets = (Utf8Conv *) conv->state;
> -    src = (unsigned char const *) *from;
> +    src = (char const *) *from;
>      srcend = src + *from_left;
>      dst = (unsigned char *) *to;
>      dstend = dst + *to_left;
> @@ -1990,7 +1994,11 @@ static XlcConvMethodsRec iconv_mbstocs_methods = {
>  };
>  
>  static XlcConv
> -open_iconv_mbstocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_mbstocs(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      return create_tocs_conv(from_lcd, &iconv_mbstocs_methods);
>  }
> @@ -2003,8 +2011,8 @@ iconv_mbtocs(XlcConv conv, XPointer *from, int *from_left,
>  {
>      Utf8Conv *preferred_charsets;
>      XlcCharSet last_charset = NULL;
> -    unsigned char const *src;
> -    unsigned char const *srcend;
> +    char const *src;
> +    char const *srcend;
>      unsigned char *dst;
>      unsigned char *dstend;
>      int unconv_num;
> @@ -2013,7 +2021,7 @@ iconv_mbtocs(XlcConv conv, XPointer *from, int *from_left,
>  	return 0;
>  
>      preferred_charsets = (Utf8Conv *) conv->state;
> -    src = (unsigned char const *) *from;
> +    src = (char const *) *from;
>      srcend = src + *from_left;
>      dst = (unsigned char *) *to;
>      dstend = dst + *to_left;
> @@ -2085,7 +2093,11 @@ static XlcConvMethodsRec iconv_mbtocs_methods = {
>  };
>  
>  static XlcConv
> -open_iconv_mbtocs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_mbtocs(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      return create_tocs_conv(from_lcd, &iconv_mbtocs_methods );
>  }
> @@ -2096,8 +2108,8 @@ static int
>  iconv_mbstostr(XlcConv conv, XPointer *from, int *from_left,
>  	       XPointer *to, int *to_left, XPointer *args, int num_args)
>  {
> -    unsigned char const *src;
> -    unsigned char const *srcend;
> +    char const *src;
> +    char const *srcend;
>      unsigned char *dst;
>      unsigned char *dstend;
>      int unconv_num;
> @@ -2105,7 +2117,7 @@ iconv_mbstostr(XlcConv conv, XPointer *from, int *from_left,
>      if (from == NULL || *from == NULL)
>  	return 0;
>  
> -    src = (unsigned char const *) *from;
> +    src = (char const *) *from;
>      srcend = src + *from_left;
>      dst = (unsigned char *) *to;
>      dstend = dst + *to_left;
> @@ -2153,7 +2165,11 @@ static XlcConvMethodsRec iconv_mbstostr_methods = {
>  };
>  
>  static XlcConv
> -open_iconv_mbstostr(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_mbstostr(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      return create_conv(from_lcd, &iconv_mbstostr_methods);
>  }
> @@ -2165,15 +2181,15 @@ iconv_strtombs(XlcConv conv, XPointer *from, int *from_left,
>  {
>      unsigned char const *src;
>      unsigned char const *srcend;
> -    unsigned char *dst;
> -    unsigned char *dstend;
> +    char *dst;
> +    char *dstend;
>  
>      if (from == NULL || *from == NULL)
>  	return 0;
>  
>      src = (unsigned char const *) *from;
>      srcend = src + *from_left;
> -    dst = (unsigned char *) *to;
> +    dst = (char *) *to;
>      dstend = dst + *to_left;
>  
>      while (src < srcend) {
> @@ -2199,7 +2215,11 @@ static XlcConvMethodsRec iconv_strtombs_methods= {
>  };
>  
>  static XlcConv
> -open_iconv_strtombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_strtombs(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      return create_conv(from_lcd, &iconv_strtombs_methods);
>  }
> @@ -2260,7 +2280,11 @@ static XlcConvMethodsRec iconv_mbstowcs_methods = {
>  } ;
>  
>  static XlcConv
> -open_iconv_mbstowcs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_mbstowcs(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      return create_conv(from_lcd, &iconv_mbstowcs_methods);
>  }
> @@ -2307,7 +2331,11 @@ static XlcConvMethodsRec iconv_wcstombs_methods = {
>  } ;
>  
>  static XlcConv
> -open_iconv_wcstombs(XLCd from_lcd, char *from_type, XLCd to_lcd, char *to_type)
> +open_iconv_wcstombs(
> +    XLCd from_lcd,
> +    const char *from_type,
> +    XLCd to_lcd,
> +    const char *to_type)
>  {
>      return create_conv(from_lcd, &iconv_wcstombs_methods);
>  }

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list