[llvm] r313833 - [llvm-readobj] Fix 'Teach readobj to dump .res files', pt 2.
Marek Sokolowski via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 16:07:39 PDT 2017
Author: mnbvmar
Date: Wed Sep 20 16:07:39 2017
New Revision: 313833
URL: http://llvm.org/viewvc/llvm-project?rev=313833&view=rev
Log:
[llvm-readobj] Fix 'Teach readobj to dump .res files', pt 2.
Another fix-up for r313790. Big-endian hosts swapped byte order in
UTF16 words.
Modified:
llvm/trunk/tools/llvm-readobj/WindowsResourceDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/WindowsResourceDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/WindowsResourceDumper.cpp?rev=313833&r1=313832&r2=313833&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/WindowsResourceDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/WindowsResourceDumper.cpp Wed Sep 20 16:07:39 2017
@@ -26,8 +26,11 @@ std::string stripUTF16(const ArrayRef<UT
Result.reserve(UTF16Str.size());
for (UTF16 Ch : UTF16Str) {
- if (Ch <= 0xFF)
- Result += Ch;
+ // UTF16Str will have swapped byte order in case of big-endian machines.
+ // Swap it back in such a case.
+ ulittle16_t ChValue = Ch;
+ if (ChValue <= 0xFF)
+ Result += ChValue;
else
Result += '?';
}
More information about the llvm-commits
mailing list