From 89c566ad640ca1fb2ca5e7ba9cde75e85429862c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Mon, 5 Sep 2005 10:18:07 +0000 Subject: [PATCH] Sync to Wine-20050830: Mike McCormack - Fix a gcc 4.0 -Wpointer-sign warning. - gcc 4.0 warning fix. svn path=/trunk/; revision=17658 --- reactos/tools/unicode/mbtowc.c | 4 +++- reactos/tools/unicode/wctomb.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/reactos/tools/unicode/mbtowc.c b/reactos/tools/unicode/mbtowc.c index 71c74fdeed4..0aff55230ee 100644 --- a/reactos/tools/unicode/mbtowc.c +++ b/reactos/tools/unicode/mbtowc.c @@ -251,9 +251,11 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table, /* return -1 on dst buffer overflow, -2 on invalid input char */ int wine_cp_mbstowcs( const union cptable *table, int flags, - const char *src, int srclen, + const char *s, int srclen, WCHAR *dst, int dstlen ) { + const unsigned char *src = (const unsigned char*) s; + if (table->info.char_size == 1) { if (flags & MB_ERR_INVALID_CHARS) diff --git a/reactos/tools/unicode/wctomb.c b/reactos/tools/unicode/wctomb.c index 902e454fab4..a7353f7c9f6 100644 --- a/reactos/tools/unicode/wctomb.c +++ b/reactos/tools/unicode/wctomb.c @@ -198,12 +198,16 @@ static int wcstombs_sbcs_slow( const struct sbcs_table *table, int flags, { const unsigned char * const uni2cp_low = table->uni2cp_low; const unsigned short * const uni2cp_high = table->uni2cp_high; - const unsigned char table_default = table->info.def_char & 0xff; + unsigned char def; unsigned int len; int tmp; WCHAR composed; - if (!defchar) defchar = (const char*)&table_default; + if (!defchar) + def = table->info.def_char & 0xff; + else + def = *defchar; + if (!used) used = &tmp; /* avoid checking on every char */ *used = 0; @@ -225,7 +229,7 @@ static int wcstombs_sbcs_slow( const struct sbcs_table *table, int flags, /* no mapping for the composed char, check the other flags */ if (flags & WC_DEFAULTCHAR) /* use the default char instead */ { - *dst = *defchar; + *dst = def; *used = 1; src++; /* skip the non-spacing char */ srclen--; @@ -242,7 +246,7 @@ static int wcstombs_sbcs_slow( const struct sbcs_table *table, int flags, *dst = uni2cp_low[uni2cp_high[wch >> 8] + (wch & 0xff)]; if (!is_valid_sbcs_mapping( table, flags, wch, *dst )) { - *dst = *defchar; + *dst = def; *used = 1; } }