[libcxx-commits] [PATCH] D90228: [libcxx] Don't truncate intermediates to wchar_t when widening
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 27 05:51:23 PDT 2020
mstorsjo created this revision.
mstorsjo added a reviewer: libc++.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
mstorsjo requested review of this revision.
On windows, wchar_t is 16 bit, while we might be widening chars to char32_t.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D90228
Files:
libcxx/include/__locale
Index: libcxx/include/__locale
===================================================================
--- libcxx/include/__locale
+++ libcxx/include/__locale
@@ -1407,7 +1407,7 @@
if (__r == codecvt_base::error || __nn == __nb)
__throw_runtime_error("locale not supported");
for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = (wchar_t)*__p;
+ *__s = *__p;
__nb = __nn;
}
return __s;
@@ -1441,7 +1441,7 @@
if (__r == codecvt_base::error || __nn == __nb)
__throw_runtime_error("locale not supported");
for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
- *__s = (wchar_t)*__p;
+ *__s = *__p;
__nb = __nn;
}
return __s;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90228.300966.patch
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201027/4ed63330/attachment-0001.bin>
More information about the libcxx-commits
mailing list