[PATCH] D33014: Fix the Endianness bug by adding the little endian UTF marker.
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 12:04:38 PDT 2017
zturner 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,
----------------
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);
}
```
https://reviews.llvm.org/D33014
More information about the llvm-commits
mailing list