[PATCH] D33014: Fix the Endianness bug by adding the little endian UTF marker.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 12:26:56 PDT 2017
Ruiu@ that's quite an involved fixed though just for getting bots green. I
discussed with eric earlier though and i do agree it's the best permanent
fix
On Tue, May 9, 2017 at 12:15 PM Ulrich Weigand via Phabricator <
reviews at reviews.llvm.org> wrote:
> uweigand added inline comments.
>
>
> ================
> Comment at: llvm/tools/llvm-readobj/COFFDumper.cpp:1565-1572
> + std::vector<UTF16>
> EndianCorrectedNameString(RawEntryNameString.size() +
> + 1);
> + std::copy(RawEntryNameString.begin(), RawEntryNameString.end(),
> + EndianCorrectedNameString.begin() + 1);
> + EndianCorrectedNameString[0] = 0xFEFF;
> std::string EntryNameString;
> + if (!llvm::convertUTF16ToUTF8String(EndianCorrectedNameString,
> ----------------
> zturner wrote:
> > How about this:
> >
> > ```
> > ArrayRef<UTF16> RawEntryNameString =
> unwrapOrError(RSF.getEntryNameString(Entry));
> > std::vector<UTF16> EndianCorrectedString;
> > if (llvm::sys::IsBigEndianHost) {
> > EndianCorrectedString.resize(RawEntryNameString.size() + 1);
> > std::copy(RawEntryNameString.begin(), RawEntryNameString.end(),
> EndianCorrectedString.begin() + 1);
> > EndianCorrectedString[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;
> > RawEntryNameString = makeArrayRef(EndianCorrectedString);
> > }
> > ```
> This does fix the problem for me.
>
>
> https://reviews.llvm.org/D33014
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170509/04387a58/attachment.html>
More information about the llvm-commits
mailing list