From 83402051c978d95ce9b0b3b7b9e80858d0208cde Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 2 Jul 2016 13:46:41 +0000 Subject: [PATCH] [UNICODE] Sync with Wine Staging 1.9.11. CORE-11368 svn path=/trunk/; revision=71746 --- reactos/media/doc/README.WINE | 2 +- reactos/sdk/tools/unicode/fold.c | 4 ++-- reactos/sdk/tools/unicode/mbtowc.c | 8 ++++---- reactos/sdk/tools/unicode/string.c | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 16f33e1e2ed..5273cef0301 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -15,7 +15,7 @@ wine-patches@winehq.com and ros-dev@reactos.org The following build tools are shared with Wine. -reactos/tools/unicode # Synced to WineStaging-1.9.4 +reactos/tools/unicode # Synced to WineStaging-1.9.11 reactos/tools/widl # Synced to WineStaging-1.7.55 reactos/tools/wpp # Synced to WineStaging-1.9.4 diff --git a/reactos/sdk/tools/unicode/fold.c b/reactos/sdk/tools/unicode/fold.c index 87a4a418faa..738469c8d77 100644 --- a/reactos/sdk/tools/unicode/fold.c +++ b/reactos/sdk/tools/unicode/fold.c @@ -22,13 +22,13 @@ static inline WCHAR to_unicode_digit( WCHAR ch ) { - extern const WCHAR wine_digitmap[]; + extern const WCHAR wine_digitmap[] DECLSPEC_HIDDEN; return ch + wine_digitmap[wine_digitmap[ch >> 8] + (ch & 0xff)]; } static inline WCHAR to_unicode_native( WCHAR ch ) { - extern const WCHAR wine_compatmap[]; + extern const WCHAR wine_compatmap[] DECLSPEC_HIDDEN; return ch + wine_compatmap[wine_compatmap[ch >> 8] + (ch & 0xff)]; } diff --git a/reactos/sdk/tools/unicode/mbtowc.c b/reactos/sdk/tools/unicode/mbtowc.c index 9a4bc2381f1..5e32367099e 100644 --- a/reactos/sdk/tools/unicode/mbtowc.c +++ b/reactos/sdk/tools/unicode/mbtowc.c @@ -131,7 +131,7 @@ static inline int get_length_dbcs( const struct dbcs_table *table, for (len = 0; srclen; srclen--, src++, len++) { - if (cp2uni_lb[*src] && srclen > 1) + if (cp2uni_lb[*src] && srclen > 1 && src[1]) { src++; srclen--; @@ -183,7 +183,7 @@ static inline int mbstowcs_dbcs( const struct dbcs_table *table, for (len = dstlen; srclen && len; len--, srclen--, src++, dst++) { unsigned char off = cp2uni_lb[*src]; - if (off && srclen > 1) + if (off && srclen > 1 && src[1]) { src++; srclen--; @@ -212,7 +212,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table, for (len = 0; srclen; srclen--, src++) { unsigned char off = cp2uni_lb[*src]; - if (off && srclen > 1) + if (off && srclen > 1 && src[1]) { src++; srclen--; @@ -227,7 +227,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table, for (len = dstlen; srclen && len; srclen--, src++) { unsigned char off = cp2uni_lb[*src]; - if (off && srclen > 1) + if (off && srclen > 1 && src[1]) { src++; srclen--; diff --git a/reactos/sdk/tools/unicode/string.c b/reactos/sdk/tools/unicode/string.c index 85ef2ba8bda..6b1e1453360 100644 --- a/reactos/sdk/tools/unicode/string.c +++ b/reactos/sdk/tools/unicode/string.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -164,6 +165,7 @@ long int strtolW( const WCHAR *nptr, WCHAR **endptr, int base ) if (overflow) { + errno = ERANGE; return negative ? LONG_MIN : LONG_MAX; } @@ -276,6 +278,7 @@ unsigned long int strtoulW( const WCHAR *nptr, WCHAR **endptr, int base ) if (overflow) { + errno = ERANGE; return ULONG_MAX; }