[PATCH] D106753: ConvertUTF: Created wrapper convertUTF32ToUTF8String

Marcus Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 27 19:46:22 PDT 2021


MarcusJohnson91 added inline comments.


================
Comment at: llvm/lib/Support/ConvertUTFWrapper.cpp:176
+  // enough that we can fit a null terminator without reallocating.
+  Out.resize(SrcBytes.size() * UNI_MAX_UTF8_BYTES_PER_CODE_POINT + 1);
+  UTF8 *Dst = reinterpret_cast<UTF8 *>(&Out[0]);
----------------
efriedma wrote:
> `SrcBytes.size() * UNI_MAX_UTF8_BYTES_PER_CODE_POINT + 1` seems like way too much memory.
I copied that from the UTF16 code


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

https://reviews.llvm.org/D106753



More information about the cfe-commits mailing list