+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.
/* 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>.
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 */
};
#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);
/* 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
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);
/* 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
unsigned char buf[6];
unsigned int count;
int c;
- unsigned int uc;
+ ucs4_t uc;
c = phase1_getc ();
if (c == EOF)
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)
{
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");
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],
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'. */
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;
}
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)
{
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],
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]);
/* 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
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);
}
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.
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]);
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))
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';
/* 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
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))
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. */
/* 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
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)
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],
{
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)
unsigned char buf[6];
unsigned int count;
int c;
- unsigned int uc;
+ ucs4_t uc;
c = phase1_getc ();
if (c == EOF)
/* 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);
&& (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);
{
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)
unsigned char buf[6];
unsigned int count;
int c;
- unsigned int uc;
+ ucs4_t uc;
c = phase1_getc ();
if (c == EOF)
/* 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);
&& (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);