Fix potential corruption for GetOptHeader

This commit is contained in:
Dr. Chat
2015-07-03 10:41:43 -05:00
parent a25090f3ca
commit 0211135fd6
2 changed files with 17 additions and 12 deletions

View File

@@ -40,14 +40,14 @@ class XexModule : public xe::cpu::Module {
// Gets an optional header. Returns NULL if not found.
// Special case: if key & 0xFF == 0x00, this function will return the value,
// not a pointer!
// not a pointer! This assumes out_ptr points to uint32_t.
static bool GetOptHeader(const xex2_header* header, xe_xex2_header_keys key,
void** out_ptr);
bool GetOptHeader(xe_xex2_header_keys key, void** out_ptr) const;
// Ultra-cool templated version
// Special case: if key & 0xFF == 0x00, this function will return the value,
// not a pointer!
// not a pointer! This assumes out_ptr points to uint32_t.
template <typename T>
static bool GetOptHeader(const xex2_header* header, xe_xex2_header_keys key,
T* out_ptr) {