[llvm-readobj] Fix big-endian byte swap in WindowsResourceDumper.

The previous version of dumper implemented UTF-16 byte swap incorrectly
on big-endian machines. This now gets fixed.

Thanks to Bill Seurer for testing the patch locally.

Differential Review: https://reviews.llvm.org/D38150

llvm-svn: 313912
This commit is contained in:
Marek Sokolowski 2017-09-21 20:36:38 +00:00
parent 142e0cf08e
commit b63355ef77
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ std::string stripUTF16(const ArrayRef<UTF16> &UTF16Str) {
for (UTF16 Ch : UTF16Str) {
// UTF16Str will have swapped byte order in case of big-endian machines.
// Swap it back in such a case.
support::ulittle16_t ChValue(Ch);
uint16_t ChValue = support::endian::byte_swap(Ch, support::little);
if (ChValue <= 0xFF)
Result += ChValue;
else