[PATCH] D33180: Add functionality to cvtres to parse all entries in res file.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 17:06:45 PDT 2017


zturner added inline comments.


================
Comment at: llvm/lib/Object/ResFile.cpp:37-38
+ResEntryRef ResFile::HeadEntry() {
+  size_t LeadingSize = sizeof(ResourceMagic) + sizeof(NullEntry);
+  ArrayRef<uint8_t> Ref(reinterpret_cast<const uint8_t*>(Data.getBufferStart() + LeadingSize), Data.getBufferSize() - LeadingSize);
+  return ResEntryRef(Ref, this);
----------------
zturner wrote:
> If the `BBS` is in the `ResFile` instead of the `ResFileRef`, and the `ResFileRef` instead stores a `BinaryStreamRef`, you can just write:
> 
> `return ResEntryRef(BBS.slice(LeadingSize, BBS.size()-LeadingSize));`
Alternatively, `return ResEntryRef(BBS.drop_front(LeadingSize).drop_back(LeadingSize));`


https://reviews.llvm.org/D33180





More information about the llvm-commits mailing list