diff --git a/runtime-light/k2-platform/k2-api.h b/runtime-light/k2-platform/k2-api.h index 1bbf21333b..9eb8f2b445 100644 --- a/runtime-light/k2-platform/k2-api.h +++ b/runtime-light/k2-platform/k2-api.h @@ -36,6 +36,7 @@ inline constexpr size_t DEFAULT_MEMORY_ALIGN = 16; } // namespace k2_impl_ inline constexpr int32_t errno_ok = 0; +inline constexpr int32_t errno_e2big = E2BIG; inline constexpr int32_t errno_ebusy = EBUSY; inline constexpr int32_t errno_enodev = ENODEV; inline constexpr int32_t errno_einval = EINVAL; diff --git a/runtime-light/stdlib/system/system-functions.cpp b/runtime-light/stdlib/system/system-functions.cpp index 3b848c5389..428d3e9fe4 100644 --- a/runtime-light/stdlib/system/system-functions.cpp +++ b/runtime-light/stdlib/system/system-functions.cpp @@ -28,8 +28,9 @@ Optional f$iconv(const string& input_encoding, const string& output_enco char* input_buf{const_cast(input_str.c_str())}; char* output_buf{output_str.buffer()}; size_t res{}; - if (k2::iconv(std::addressof(res), cd, std::addressof(input_buf), std::addressof(input_len), std::addressof(output_buf), std::addressof(output_len)) == - k2::errno_ok) { + if (auto iconv_result{ + k2::iconv(std::addressof(res), cd, std::addressof(input_buf), std::addressof(input_len), std::addressof(output_buf), std::addressof(output_len))}; + iconv_result != k2::errno_e2big) { output_str.shrink(static_cast(output_buf - output_str.c_str())); return output_str; } diff --git a/tests/phpt/dl/475_convert_to_win.php b/tests/phpt/dl/475_convert_to_win.php index ac182bfa28..3437bbcb48 100644 --- a/tests/phpt/dl/475_convert_to_win.php +++ b/tests/phpt/dl/475_convert_to_win.php @@ -1,4 +1,4 @@ -@ok benchmark k2_skip +@ok benchmark