diff options
author | Eli Zaretskii <eliz@gnu.org> | 2012-10-01 13:37:37 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2012-10-01 13:37:37 +0200 |
commit | 2d7d1608381a4c14822e50ae42e2a6d748842cc3 (patch) | |
tree | b22ef7adf83c2aaf47cd7c6439a6e735f6b58551 /src/unexw32.c | |
parent | 7692b36bc6557b20f966801e3db346d8a166d32e (diff) |
Clean up the Windows x64 changes.
nt/preprep.c (RVA_TO_PTR): Use 'unsigned char *' instead of
'void *', for pointer arithmetics.
(OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_SECTION_OFFSET): Enclose all
macro arguments in parentheses.
src/unexw32.c (OFFSET_TO_RVA, RVA_TO_OFFSET)
(RVA_TO_SECTION_OFFSET): Encode all macro arguments in parentheses.
(RVA_TO_PTR): Cast the result of RVA_TO_OFFSET to 'unsigned char *',
as the previous version used 'void *'.
src/ralloc.c (ROUNDUP): Fix last change.
(MEM_ROUNDUP): Don't cast MEM_ALIGN, it is already of type
'size_t'.
Fixes: debbugs:12544
Diffstat (limited to 'src/unexw32.c')
-rw-r--r-- | src/unexw32.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unexw32.c b/src/unexw32.c index f8e755cbd2..3eefc9ce05 100644 --- a/src/unexw32.c +++ b/src/unexw32.c @@ -314,19 +314,19 @@ relocate_offset (DWORD_PTR offset, } #define OFFSET_TO_RVA(offset, section) \ - (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData)) + ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData)) #define RVA_TO_OFFSET(rva, section) \ - (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress)) + ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress)) #define RVA_TO_SECTION_OFFSET(rva, section) \ - ((DWORD_PTR)(rva) - section->VirtualAddress) + ((DWORD_PTR)(rva) - (section)->VirtualAddress) /* Convert address in executing image to RVA. */ #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL)) #define RVA_TO_PTR(var,section,filedata) \ - ((DWORD_PTR)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) + ((unsigned char *)(RVA_TO_OFFSET (var,section) + (filedata).file_base)) #define PTR_TO_OFFSET(ptr, pfile_data) \ ((unsigned char *)(ptr) - (pfile_data)->file_base) |