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

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 25 10:34:59 PST 2022


Quuxplusone accepted this revision.
Quuxplusone added a comment.
This revision is now accepted and ready to land.

LGTM! One nit.



================
Comment at: libcxx/src/locale.cpp:1527
     int r = __libcpp_wctob_l(c, __l);
-    return r != static_cast<int>(WEOF) ? static_cast<char>(r) : dfault;
+    return r != static_cast<int>(EOF) ? static_cast<char>(r) : dfault;
 }
----------------
mstorsjo wrote:
> Quuxplusone wrote:
> > I don't think the cast to `int` is doing anything anymore; what goes wrong if you remove it? Ditto below.
> Sure, it should work just fine to drop the cast.
Here and below, I'd now prefer parens
`return (r != EOF) ? static_cast<char>(r) : dfault;`
for clarity, although it's no big deal.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120088



More information about the libcxx-commits mailing list