mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 13:30:39 +00:00
Merge topic 'libarchive-win-codepage' into release-3.17
16e31523ba
libarchive: Add support for UTF-8 locale on Windowsf7c54d2049
libarchive: Fix WideCharToMultiByte output buffer size Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4332
This commit is contained in:
commit
ad17c37d34
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user