From 8bf17329625320b45d6742feed43771dd3306291 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Mon, 2 Feb 2015 16:14:59 -0700 Subject: [PATCH] msvcrt: Bump MSVCRT_MB_LEN_MAX to 5 and use it in MSVCRT__wctomb_l for default buffer lengthSet MB_LEN_MAX to 5 to match MSVCRT_MB_LEN_MAX. --- dlls/msvcrt/msvcrt.h | 2 +- dlls/msvcrt/wcs.c | 2 +- include/msvcrt/limits.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 41f31b90a62..806c4bf4498 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -47,7 +47,7 @@ #define MSVCRT_I64_MAX (((__int64)0x7fffffff << 32) | 0xffffffff) #define MSVCRT_I64_MIN (-MSVCRT_I64_MAX-1) #define MSVCRT_UI64_MAX (((unsigned __int64)0xffffffff << 32) | 0xffffffff) -#define MSVCRT_MB_LEN_MAX 2 +#define MSVCRT_MB_LEN_MAX 5 #ifdef _WIN64 #define MSVCRT_SIZE_MAX MSVCRT_UI64_MAX #else diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 5bc544cf03a..98bc686dfb6 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -1474,7 +1474,7 @@ int CDECL MSVCRT__wctomb_l(char *dst, MSVCRT_wchar_t ch, MSVCRT__locale_t locale { int len; - MSVCRT__wctomb_s_l(&len, dst, dst ? 6 : 0, ch, locale); + MSVCRT__wctomb_s_l(&len, dst, dst ? MSVCRT_MB_LEN_MAX : 0, ch, locale); return len; } diff --git a/include/msvcrt/limits.h b/include/msvcrt/limits.h index d0f058b1711..ece8c68e947 100644 --- a/include/msvcrt/limits.h +++ b/include/msvcrt/limits.h @@ -4,7 +4,7 @@ #include #define CHAR_BIT 8 -#define MB_LEN_MAX 2 +#define MB_LEN_MAX 5 #define SCHAR_MIN (-0x80) #define SCHAR_MAX 0x7f