]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Use type 'ucs4_t' more often. Avoids gcc warnings on Cygwin.
authorBruno Haible <bruno@clisp.org>
Mon, 10 Aug 2009 08:08:21 +0000 (10:08 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 10 Aug 2009 13:19:33 +0000 (15:19 +0200)
12 files changed:
gettext-tools/src/ChangeLog
gettext-tools/src/po-lex.c
gettext-tools/src/read-properties.c
gettext-tools/src/read-stringtable.c
gettext-tools/src/write-csharp.c
gettext-tools/src/write-java.c
gettext-tools/src/write-properties.c
gettext-tools/src/write-qt.c
gettext-tools/src/write-tcl.c
gettext-tools/src/x-csharp.c
gettext-tools/src/x-java.c
gettext-tools/src/x-python.c

index 83588505b5d52de1efb06b7726a2ca3df0dd82bf..c5ba9fcd3c8f50292ba0e7a21fb6785ed3718d32 100644 (file)
@@ -1,3 +1,24 @@
+2009-08-10  Bruno Haible  <bruno@clisp.org>
+
+       Use type 'ucs4_t' more often. Avoids gcc warnings on Cygwin.
+       * po-lex.c (struct mbchar): Change type of 'uc'.
+       (mb_width): Update.
+       * read-properties.c (read_escaped_string): Change type of local
+       variable 'uc'.
+       * read-stringtable.c (phase2_getc): Likewise.
+       * write-properties.c (conv_to_java, write_escaped_string): Change type
+       of local variables 'uc', 'uc1', 'uc2'.
+       * write-java.c (string_hashcode, write_java_string): Likewise.
+       * write-csharp.c (construct_class_name, write_csharp_string): Change
+       type of local variable 'uc'.
+       * write-tcl.c (write_tcl_string): Likewise.
+       * write-qt.c (conv_to_iso_8859_1, conv_to_utf16): Likewise.
+       * x-python.c (phase2_getc, mixed_string_buffer_append): Likewise.
+       (mixed_string_buffer_append_unicode): Change argument type to 'ucs4_t'.
+       * x-java.c (string_buffer_append): Change type of local variable 'uc'.
+       (string_buffer_append_unicode): Change argument type to 'ucs4_t'.
+       * x-csharp.c (phase2_getc): Change type of local variable 'uc'.
+
 2009-08-04  Bruno Haible  <bruno@clisp.org>
 
        Port msgfilter to Woe32 platforms.
index 614abc43d7480684efa89eb7c1b98263d1802fd6..9de70068e63829e7029d61ea46e518523489e663 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995-1999, 2000-2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2009 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>.
    Multibyte character handling by Bruno Haible <haible@clisp.cons.org>.
@@ -132,7 +132,7 @@ struct mbchar
   size_t bytes;                /* number of bytes of current character, > 0 */
 #if HAVE_ICONV
   bool uc_valid;       /* true if uc is a valid Unicode character */
-  unsigned int uc;     /* if uc_valid: the current character */
+  ucs4_t uc;           /* if uc_valid: the current character */
 #endif
   char buf[MBCHAR_BUF_SIZE]; /* room for the bytes */
 };
@@ -262,7 +262,7 @@ mb_width (const mbchar_t mbc)
 #if HAVE_ICONV
   if (mbc->uc_valid)
     {
-      unsigned int uc = mbc->uc;
+      ucs4_t uc = mbc->uc;
       const char *encoding =
        (po_lex_iconv != (iconv_t)(-1) ? po_lex_charset : "");
       int w = uc_width (uc, encoding);
index 6a7ea3402405f2e680514b28e6c994827f56e636..82f676728bde87a028b726703e8c2db8867df191 100644 (file)
@@ -1,5 +1,5 @@
 /* Reading Java .properties files.
-   Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -431,7 +431,7 @@ read_escaped_string (bool in_key)
     utf8_string = XNMALLOC (3 * buflen + 1, unsigned char);
     for (pos = 0, q = utf8_string; pos < buflen; )
       {
-       unsigned int uc;
+       ucs4_t uc;
        int n;
 
        pos += u16_mbtouc (&uc, buffer + pos, buflen - pos);
index ea766ae953f8817d34b03848f4110e4e3a66e666..9f2e55c303494e533467ee084e6389795fad0589 100644 (file)
@@ -1,5 +1,5 @@
 /* Reading NeXTstep/GNUstep .strings files.
-   Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -219,7 +219,7 @@ phase2_getc ()
        unsigned char buf[6];
        unsigned int count;
        int c;
-       unsigned int uc;
+       ucs4_t uc;
 
        c = phase1_getc ();
        if (c == EOF)
index c6590b1ffd91ece8515445c7b31301b3eadd572f..e031e65a377906dec46d5079620b93808f38aaca 100644 (file)
@@ -133,7 +133,7 @@ construct_class_name (const char *resource_name)
       memcpy (b, "__UESCAPED__", 12); b += 12;
       while (str < str_limit)
        {
-         unsigned int uc;
+         ucs4_t uc;
          str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
          if (uc >= 0x10000)
            {
@@ -177,7 +177,7 @@ write_csharp_string (FILE *stream, const char *str)
   fprintf (stream, "\"");
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       if (uc == 0x0000)
        fprintf (stream, "\\0");
@@ -200,7 +200,7 @@ write_csharp_string (FILE *stream, const char *str)
       else if (uc == 0x005c)
        fprintf (stream, "\\\\");
       else if (uc >= 0x0020 && uc < 0x007f)
-       fprintf (stream, "%c", uc);
+       fprintf (stream, "%c", (int) uc);
       else if (uc < 0x10000)
        fprintf (stream, "\\u%c%c%c%c",
                 hexdigit[(uc >> 12) & 0x0f], hexdigit[(uc >> 8) & 0x0f],
index 370c235a8616321ed7369684551574e00d46180a..d6c76144e9e7ba1c013a54e7f27fe0dd7f3cf652 100644 (file)
@@ -117,7 +117,7 @@ string_hashcode (const char *str)
   int hash = 0;
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       if (uc < 0x10000)
        /* Single UCS-2 'char'.  */
@@ -125,8 +125,8 @@ string_hashcode (const char *str)
       else
        {
          /* UTF-16 surrogate: two 'char's.  */
-         unsigned int uc1 = 0xd800 + ((uc - 0x10000) >> 10);
-         unsigned int uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
+         ucs4_t uc1 = 0xd800 + ((uc - 0x10000) >> 10);
+         ucs4_t uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
          hash = 31 * hash + uc1;
          hash = 31 * hash + uc2;
        }
@@ -361,7 +361,7 @@ write_java_string (FILE *stream, const char *str)
   fprintf (stream, "\"");
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       if (uc < 0x10000)
        {
@@ -375,7 +375,7 @@ write_java_string (FILE *stream, const char *str)
          else if (uc == 0x005c)
            fprintf (stream, "\\\\");
          else if (uc >= 0x0020 && uc < 0x007f)
-           fprintf (stream, "%c", uc);
+           fprintf (stream, "%c", (int) uc);
          else
            fprintf (stream, "\\u%c%c%c%c",
                     hexdigit[(uc >> 12) & 0x0f], hexdigit[(uc >> 8) & 0x0f],
@@ -384,8 +384,8 @@ write_java_string (FILE *stream, const char *str)
       else
        {
          /* UTF-16 surrogate: two 'char's.  */
-         unsigned int uc1 = 0xd800 + ((uc - 0x10000) >> 10);
-         unsigned int uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
+         ucs4_t uc1 = 0xd800 + ((uc - 0x10000) >> 10);
+         ucs4_t uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
          fprintf (stream, "\\u%c%c%c%c",
                   hexdigit[(uc1 >> 12) & 0x0f], hexdigit[(uc1 >> 8) & 0x0f],
                   hexdigit[(uc1 >> 4) & 0x0f], hexdigit[uc1 & 0x0f]);
index 4888baf7b191832a27e7af0769afe15bd3519171..f53a7fc575ae5edc88b8bb0c3d2ea0aef5ee457a 100644 (file)
@@ -1,5 +1,5 @@
 /* Writing Java .properties files.
-   Copyright (C) 2003, 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -70,7 +70,7 @@ conv_to_java (const char *string)
 
     while (str < str_limit)
       {
-       unsigned int uc;
+       ucs4_t uc;
        str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
        length += (uc <= 0x007f ? 1 : uc < 0x10000 ? 6 : 12);
       }
@@ -85,7 +85,7 @@ conv_to_java (const char *string)
 
     while (str < str_limit)
       {
-       unsigned int uc;
+       ucs4_t uc;
        str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
        if (uc <= 0x007f)
          /* ASCII characters can be output literally.
@@ -104,8 +104,8 @@ conv_to_java (const char *string)
        else
          {
            /* UTF-16 surrogate: two 'char's.  */
-           unsigned int uc1 = 0xd800 + ((uc - 0x10000) >> 10);
-           unsigned int uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
+           ucs4_t uc1 = 0xd800 + ((uc - 0x10000) >> 10);
+           ucs4_t uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
            sprintf (newstr, "\\u%c%c%c%c",
                     hexdigit[(uc1 >> 12) & 0x0f], hexdigit[(uc1 >> 8) & 0x0f],
                     hexdigit[(uc1 >> 4) & 0x0f], hexdigit[uc1 & 0x0f]);
@@ -132,7 +132,7 @@ write_escaped_string (ostream_t stream, const char *str, bool in_key)
 
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       /* Whitespace must be escaped.  */
       if (uc == 0x0020 && (first || in_key))
@@ -182,8 +182,8 @@ write_escaped_string (ostream_t stream, const char *str, bool in_key)
       else
        {
          /* UTF-16 surrogate: two 'char's.  */
-         unsigned int uc1 = 0xd800 + ((uc - 0x10000) >> 10);
-         unsigned int uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
+         ucs4_t uc1 = 0xd800 + ((uc - 0x10000) >> 10);
+         ucs4_t uc2 = 0xdc00 + ((uc - 0x10000) & 0x3ff);
          char seq[6];
          seq[0] = '\\';
          seq[1] = 'u';
index c301a6eaa00aa7cc311c054804ed6ac69a3871f5..d94e2dc480692cdd8c82735649ce3865e35e6a5c 100644 (file)
@@ -1,5 +1,5 @@
 /* Writing Qt .qm files.
-   Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -293,7 +293,7 @@ conv_to_iso_8859_1 (const char *string)
 
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       /* It has already been verified that the string fits in ISO-8859-1.  */
       if (!(uc < 0x100))
@@ -321,7 +321,7 @@ conv_to_utf16 (const char *string, size_t *sizep)
 
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       str += u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       if (uc < 0x10000)
        /* UCS-2 character.  */
index ead0605deb61e9e0bb4848ff2165ac792bfb2548..eca949fa8b08766e9a60e66179f20b5f233b5846 100644 (file)
@@ -1,5 +1,5 @@
 /* Writing tcl/msgcat .msg files.
-   Copyright (C) 2002-2003, 2005, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005, 2007-2009 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
@@ -59,7 +59,7 @@ write_tcl_string (FILE *stream, const char *str)
   fprintf (stream, "\"");
   while (str < str_limit)
     {
-      unsigned int uc;
+      ucs4_t uc;
       unsigned int count;
       count = u8_mbtouc (&uc, (const unsigned char *) str, str_limit - str);
       if (uc < 0x10000)
@@ -88,7 +88,7 @@ write_tcl_string (FILE *stream, const char *str)
            fprintf (stream, "\\}");
 #endif
          else if (uc >= 0x0020 && uc < 0x007f)
-           fprintf (stream, "%c", uc);
+           fprintf (stream, "%c", (int) uc);
          else
            fprintf (stream, "\\u%c%c%c%c",
                     hexdigit[(uc >> 12) & 0x0f], hexdigit[(uc >> 8) & 0x0f],
index a307a64ec73b137ef0840d31a8074a9bbe2dea26..45e54a0f119f7bde92555648f6d530785e48df16 100644 (file)
@@ -319,7 +319,7 @@ Please specify the correct source encoding through --from-code.\n"),
            {
              size_t outbytes = sizeof (scratchbuf) - outsize;
              size_t bytes = bufcount - insize;
-             unsigned int uc;
+             ucs4_t uc;
 
              /* We expect that one character has been produced.  */
              if (bytes == 0)
@@ -357,7 +357,7 @@ Please specify the source encoding through --from-code.\n"),
       unsigned char buf[6];
       unsigned int count;
       int c;
-      unsigned int uc;
+      ucs4_t uc;
 
       c = phase1_getc ();
       if (c == EOF)
index bb52f81a49e3b6c68bbc4bec7a7d317785c0848b..4ba9a7c92790ebb55394052dccf673ae253bc9cc 100644 (file)
@@ -447,7 +447,7 @@ string_buffer_append_unicode_grow (struct string_buffer *bp, size_t count)
 /* Auxiliary function: Append a Unicode character to bp->utf8.
    uc must be < 0x110000.  */
 static inline void
-string_buffer_append_unicode (struct string_buffer *bp, unsigned int uc)
+string_buffer_append_unicode (struct string_buffer *bp, ucs4_t uc)
 {
   unsigned char utf8buf[6];
   int count = u8_uctomb (utf8buf, uc, 6);
@@ -552,7 +552,7 @@ string_buffer_append (struct string_buffer *bp, int c)
          && (c >= UNICODE (0xdc00) && c < UNICODE (0xe000)))
        {
          unsigned short utf16buf[2];
-         unsigned int uc;
+         ucs4_t uc;
 
          utf16buf[0] = bp->utf16_surr;
          utf16buf[1] = UTF16_VALUE (c);
index 0a7b2af03d49bc487f1573fcc482f432e0c4488a..50ea136d5fdd23c1159dc42b99cfee77ba837c0b 100644 (file)
@@ -336,7 +336,7 @@ comment as specified in http://www.python.org/peps/pep-0263.html.\n"),
            {
              size_t outbytes = sizeof (scratchbuf) - outsize;
              size_t bytes = bufcount - insize;
-             unsigned int uc;
+             ucs4_t uc;
 
              /* We expect that one character has been produced.  */
              if (bytes == 0)
@@ -375,7 +375,7 @@ as specified in http://www.python.org/peps/pep-0263.html.\n"),
       unsigned char buf[6];
       unsigned int count;
       int c;
-      unsigned int uc;
+      ucs4_t uc;
 
       c = phase1_getc ();
       if (c == EOF)
@@ -843,7 +843,7 @@ mixed_string_buffer_append_unicode_grow (struct mixed_string_buffer *bp, size_t
 /* Auxiliary function: Append a Unicode character to bp->utf8.
    uc must be < 0x110000.  */
 static inline void
-mixed_string_buffer_append_unicode (struct mixed_string_buffer *bp, unsigned int uc)
+mixed_string_buffer_append_unicode (struct mixed_string_buffer *bp, ucs4_t uc)
 {
   unsigned char utf8buf[6];
   int count = u8_uctomb (utf8buf, uc, 6);
@@ -913,7 +913,7 @@ mixed_string_buffer_append (struct mixed_string_buffer *bp, int c)
          && (c >= UNICODE (0xdc00) && c < UNICODE (0xe000)))
        {
          unsigned short utf16buf[2];
-         unsigned int uc;
+         ucs4_t uc;
 
          utf16buf[0] = bp->utf16_surr;
          utf16buf[1] = UNICODE_VALUE (c);