Fix empty wide string conversion on Windows

This commit is contained in:
subotac committed 2026-08-06 21:29:20 +03:00
1 parent b3b2f54e10
commit ea6bff4f92
2 files changed
+4 -8

No files matched your search

+4
View File
@@ -785,6 +785,10 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as,
r = WideCharToMultiByte(to_cp, 0, ws, (int)wslen,
as->s + as->length,
(int)(as->buffer_length - as->length - 1), NULL, dp);
if (r == 0 && wslen == 0) {
count = 0;
break;
}
if (r == 0 &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
/* Expand the MBS buffer and retry. */
-8
View File
@@ -70,13 +70,6 @@ DEFINE_TEST(test_option_ignore_zeros_mode_x)
DEFINE_TEST(test_option_ignore_zeros_mode_c)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
// The first command run by systemf below prints this to stderr:
// bsdtar.exe: a: Can't translate uname '(null)' to UTF-8
// bsdtar.exe: b: Can't translate uname '(null)' to UTF-8
skipping("TODO: figure out why this test fails on github workflows with MSVC");
return;
#else
if (make_files())
return;
@@ -96,7 +89,6 @@ DEFINE_TEST(test_option_ignore_zeros_mode_c)
assertEqualFile("out/a", "in/a");
assertEqualFile("out/b", "in/b");
assertEqualFile("out/c", "in/c");
#endif
}
static void