diff options
author | Bruno Haible <bruno@clisp.org> | 2009-08-10 10:08:21 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-08-10 15:19:33 +0200 |
commit | 1a6abceb69f19fc4a949a8ee629c35a94a2e4692 (patch) | |
tree | 6d7068f00640a03b98eb97a2ebae6eef9a605ec6 /gettext-tools/src | |
parent | de9c49f23c81890afddf773d32795da51d64298f (diff) | |
download | external_gettext-1a6abceb69f19fc4a949a8ee629c35a94a2e4692.zip external_gettext-1a6abceb69f19fc4a949a8ee629c35a94a2e4692.tar.gz external_gettext-1a6abceb69f19fc4a949a8ee629c35a94a2e4692.tar.bz2 |
Use type 'ucs4_t' more often. Avoids gcc warnings on Cygwin.
Diffstat (limited to 'gettext-tools/src')
-rw-r--r-- | gettext-tools/src/ChangeLog | 21 | ||||
-rw-r--r-- | gettext-tools/src/po-lex.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/read-properties.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/read-stringtable.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/write-csharp.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/write-java.c | 14 | ||||
-rw-r--r-- | gettext-tools/src/write-properties.c | 16 | ||||
-rw-r--r-- | gettext-tools/src/write-qt.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/write-tcl.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/x-csharp.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-java.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-python.c | 8 |
12 files changed, 60 insertions, 39 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 8358850..c5ba9fc 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -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. diff --git a/gettext-tools/src/po-lex.c b/gettext-tools/src/po-lex.c index 614abc4..9de7006 100644 --- a/gettext-tools/src/po-lex.c +++ b/gettext-tools/src/po-lex.c @@ -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); diff --git a/gettext-tools/src/read-properties.c b/gettext-tools/src/read-properties.c index 6a7ea34..82f6767 100644 --- a/gettext-tools/src/read-properties.c +++ b/gettext-tools/src/read-properties.c @@ -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); diff --git a/gettext-tools/src/read-stringtable.c b/gettext-tools/src/read-stringtable.c index ea766ae..9f2e55c 100644 --- a/gettext-tools/src/read-stringtable.c +++ b/gettext-tools/src/read-stringtable.c @@ -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) diff --git a/gettext-tools/src/write-csharp.c b/gettext-tools/src/write-csharp.c index c6590b1..e031e65 100644 --- a/gettext-tools/src/write-csharp.c +++ b/gettext-tools/src/write-csharp.c @@ -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], diff --git a/gettext-tools/src/write-java.c b/gettext-tools/src/write-java.c index 370c235..d6c7614 100644 --- a/gettext-tools/src/write-java.c +++ b/gettext-tools/src/write-java.c @@ -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]); diff --git a/gettext-tools/src/write-properties.c b/gettext-tools/src/write-properties.c index 4888baf..f53a7fc 100644 --- a/gettext-tools/src/write-properties.c +++ b/gettext-tools/src/write-properties.c @@ -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'; diff --git a/gettext-tools/src/write-qt.c b/gettext-tools/src/write-qt.c index c301a6e..d94e2dc 100644 --- a/gettext-tools/src/write-qt.c +++ b/gettext-tools/src/write-qt.c @@ -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. */ diff --git a/gettext-tools/src/write-tcl.c b/gettext-tools/src/write-tcl.c index ead0605..eca949f 100644 --- a/gettext-tools/src/write-tcl.c +++ b/gettext-tools/src/write-tcl.c @@ -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], diff --git a/gettext-tools/src/x-csharp.c b/gettext-tools/src/x-csharp.c index a307a64..45e54a0 100644 --- a/gettext-tools/src/x-csharp.c +++ b/gettext-tools/src/x-csharp.c @@ -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) diff --git a/gettext-tools/src/x-java.c b/gettext-tools/src/x-java.c index bb52f81..4ba9a7c 100644 --- a/gettext-tools/src/x-java.c +++ b/gettext-tools/src/x-java.c @@ -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); diff --git a/gettext-tools/src/x-python.c b/gettext-tools/src/x-python.c index 0a7b2af..50ea136 100644 --- a/gettext-tools/src/x-python.c +++ b/gettext-tools/src/x-python.c @@ -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); |