[libcxx-commits] [PATCH] D91137: [5/N] [libcxx] Convert paths to/from the right narrow code page for narrow strings on windows

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 9 14:44:22 PST 2020


curdeius added inline comments.


================
Comment at: libcxx/include/filesystem:1448
+  _VSTD::wstring __w;
+  _CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
+  return path(__w);
----------------
It's there a patch where you add `_w.reserve(...)`? If not, this one seems like a good candidate.
If I'm not mistaken, widening can decrease the number of characters, so that might get tricky (like going through the input twice, once to count the output size, then doing the real conversion), but at least a FIXME note would be great.
BTW, you probably know that, `MultiByteToWideChar` will return the required output buffer size without doing the conversion if you pass 0 as `cchWideChar`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91137



More information about the libcxx-commits mailing list