[libcxx-commits] [PATCH] D120088: [libcxx] Fix the error checking for wctob_l, fixing locale narrow function on Windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 25 13:49:05 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f5d0d4e820e: [libcxx] Fix the error checking for wctob_l, fixing locale narrow function on… (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D120088?vs=411052&id=411516#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120088/new/

https://reviews.llvm.org/D120088

Files:
  libcxx/src/locale.cpp
  libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
  libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp


Index: libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
@@ -8,7 +8,6 @@
 
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_CA.ISO8859-1
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: libcpp-has-no-wide-characters
 
 // <locale>
Index: libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
@@ -8,7 +8,6 @@
 
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_CA.ISO8859-1
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: libcpp-has-no-wide-characters
 
 // <locale>
Index: libcxx/src/locale.cpp
===================================================================
--- libcxx/src/locale.cpp
+++ libcxx/src/locale.cpp
@@ -1524,7 +1524,7 @@
 ctype_byname<wchar_t>::do_narrow(char_type c, char dfault) const
 {
     int r = __libcpp_wctob_l(c, __l);
-    return r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault;
+    return (r != EOF) ? static_cast<char>(r) : dfault;
 }
 
 const wchar_t*
@@ -1533,7 +1533,7 @@
     for (; low != high; ++low, ++dest)
     {
         int r = __libcpp_wctob_l(*low, __l);
-        *dest = r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault;
+        *dest = (r != EOF) ? static_cast<char>(r) : dfault;
     }
     return low;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120088.411516.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220225/97d22d0b/attachment.bin>


More information about the libcxx-commits mailing list