diff options
author | Brad King <brad.king@kitware.com> | 2020-02-07 15:23:35 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-02-07 15:23:45 (GMT) |
commit | b42822486766f8319c968a7975672bc3c6a3aee9 (patch) | |
tree | b8357fc826b13a37ac966ec17c0c192b3ec041d3 /Utilities | |
parent | fe8017892ef7f3dd8a28fb2a8bb7b9d24e82d2c2 (diff) | |
parent | 16e31523ba9d4c53a38f6420b83561b4ca56cc79 (diff) | |
download | CMake-b42822486766f8319c968a7975672bc3c6a3aee9.zip CMake-b42822486766f8319c968a7975672bc3c6a3aee9.tar.gz CMake-b42822486766f8319c968a7975672bc3c6a3aee9.tar.bz2 |
Merge topic 'libarchive-win-codepage'
16e31523ba libarchive: Add support for UTF-8 locale on Windows
f7c54d2049 libarchive: Fix WideCharToMultiByte output buffer size
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4332
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_string.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_string.c b/Utilities/cmlibarchive/libarchive/archive_string.c index 554533e..85594cc 100644 --- a/Utilities/cmlibarchive/libarchive/archive_string.c +++ b/Utilities/cmlibarchive/libarchive/archive_string.c @@ -735,7 +735,8 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as, else dp = &defchar_used; count = WideCharToMultiByte(to_cp, 0, ws, wslen, - as->s + as->length, (int)as->buffer_length-1, NULL, dp); + as->s + as->length, + (int)as->buffer_length - as->length - 1, NULL, dp); if (count == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { /* Expand the MBS buffer and retry. */ @@ -1512,8 +1513,10 @@ get_current_codepage(void) p = strrchr(locale, '.'); if (p == NULL) return (GetACP()); + if (strcmp(p+1, "utf8") == 0) + return CP_UTF8; cp = my_atoi(p+1); - if (cp <= 0) + if ((int)cp <= 0) return (GetACP()); return (cp); } |