[PATCH] D34159: Fix a bug introduced in r305092 on big-endian systems.

Eric Beckmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 13:54:09 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305322: Fix a bug introduced in r305092 on big-endian systems. (authored by ecbeckmann).

Changed prior to commit:
  https://reviews.llvm.org/D34159?vs=102402&id=102403#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34159

Files:
  llvm/trunk/lib/Object/WindowsResource.cpp


Index: llvm/trunk/lib/Object/WindowsResource.cpp
===================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp
+++ llvm/trunk/lib/Object/WindowsResource.cpp
@@ -691,10 +691,8 @@
   // Now write the directory string table for .rsrc$01
   uint32_t TotalStringTableSize = 0;
   for (auto String : StringTable) {
-    auto *LengthField =
-        reinterpret_cast<uint16_t *>(BufferStart + CurrentOffset);
     uint16_t Length = String.size();
-    *LengthField = Length;
+    support::endian::write16le(BufferStart + CurrentOffset, Length);
     CurrentOffset += sizeof(uint16_t);
     auto *Start = reinterpret_cast<UTF16 *>(BufferStart + CurrentOffset);
     std::copy(String.begin(), String.end(), Start);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34159.102403.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/6e790539/attachment.bin>


More information about the llvm-commits mailing list