diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:19:30 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:19:30 +0900 |
commit | fb13060136a8ffa9d00b546c0ddda80b52adf6f1 (patch) | |
tree | 108f06675773293f5bf8460ac3a08f4045f9df0a /Utilities | |
parent | 01310be508e7384e4a05bba3154f6fa458197696 (diff) | |
download | cmake-fb13060136a8ffa9d00b546c0ddda80b52adf6f1.tar.gz cmake-fb13060136a8ffa9d00b546c0ddda80b52adf6f1.tar.bz2 cmake-fb13060136a8ffa9d00b546c0ddda80b52adf6f1.zip |
Imported Upstream version 3.16.5upstream/3.16.5
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 554533ecb..85594cc9e 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); } |