Piotr Caban : msvcrt: Add support for multibyte characters in _Strftime.
Alexandre Julliard
julliard at winehq.org
Thu Aug 11 09:37:47 CDT 2016
Module: wine
Branch: master
Commit: d6948bf356a99f96305298d19d76c98010b380f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d6948bf356a99f96305298d19d76c98010b380f1
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Aug 10 17:18:05 2016 +0200
msvcrt: Add support for multibyte characters in _Strftime.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/tests/time.c | 10 ++++++++++
dlls/msvcrt/time.c | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/dlls/msvcrt/tests/time.c b/dlls/msvcrt/tests/time.c
index e26648d..6865e3d 100644
--- a/dlls/msvcrt/tests/time.c
+++ b/dlls/msvcrt/tests/time.c
@@ -746,6 +746,16 @@ static void test_strftime(void)
ok(retA == 17, "expected 17, got %ld\n", retA);
ok(!strcmp(bufA, "02/30/70 00:00:00"), "got %s\n", bufA);
}
+
+ if(!setlocale(LC_ALL, "Japanese_Japan.932")) {
+ win_skip("Japanese_Japan.932 locale not available\n");
+ return;
+ }
+
+ /* test with multibyte character */
+ retA = strftime(bufA, 256, "\x82%c", gmt_tm);
+ ok(retA == 3, "expected 3, got %ld\n", retA);
+ ok(!strcmp(bufA, "\x82%c"), "got %s\n", bufA);
}
static void test_asctime(void)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index e6e3eee..ed88e3c 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -1078,6 +1078,11 @@ MSVCRT_size_t CDECL _Strftime(char *str, MSVCRT_size_t max, const char *format,
for(ret=0; *format && ret<max; format++) {
if(*format != '%') {
+ if(MSVCRT_isleadbyte((unsigned char)*format)) {
+ str[ret++] = *(format++);
+ if(ret == max) continue;
+ if(!str[ret]) goto einval_error;
+ }
str[ret++] = *format;
continue;
}
More information about the wine-cvs
mailing list