aboutsummaryrefslogtreecommitdiff
path: root/backends/plugins/elf/ppc-loader.cpp
diff options
context:
space:
mode:
authorAndre Heider2010-09-05 12:52:49 +0000
committerAndre Heider2010-09-05 12:52:49 +0000
commit3b2a9734d15b1ddd5955e2634639122a1d4416cb (patch)
treed48c88a6c9608df8e8dd3a9d6786896c6a95ac71 /backends/plugins/elf/ppc-loader.cpp
parentc4a88559a5577e816793b02a6eaaa3ab69c8ecdb (diff)
downloadscummvm-rg350-3b2a9734d15b1ddd5955e2634639122a1d4416cb.tar.gz
scummvm-rg350-3b2a9734d15b1ddd5955e2634639122a1d4416cb.tar.bz2
scummvm-rg350-3b2a9734d15b1ddd5955e2634639122a1d4416cb.zip
PLUGINS: Type cleanup.
Use our types, get rid of some casts. svn-id: r52557
Diffstat (limited to 'backends/plugins/elf/ppc-loader.cpp')
-rw-r--r--backends/plugins/elf/ppc-loader.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/backends/plugins/elf/ppc-loader.cpp b/backends/plugins/elf/ppc-loader.cpp
index 21a9a6c8a0..dff8143e43 100644
--- a/backends/plugins/elf/ppc-loader.cpp
+++ b/backends/plugins/elf/ppc-loader.cpp
@@ -30,7 +30,7 @@
#include "common/debug.h"
-bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long offset, unsigned long size, void *relSegment) {
+bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, Elf32_Off offset, Elf32_Word size, byte *relSegment) {
Elf32_Rela *rel = NULL;
if (!(rel = (Elf32_Rela *)malloc(size))) {
@@ -38,26 +38,25 @@ bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long off
return false;
}
- if (DLFile->seek(offset, SEEK_SET) < 0 ||
- DLFile->read(rel, size) != size) {
+ if (!DLFile->seek(offset, SEEK_SET) || DLFile->read(rel, size) != size) {
warning("elfloader: Relocation table load failed.");
free(rel);
return false;
}
- int cnt = size / sizeof(*rel);
+ uint32 cnt = size / sizeof(*rel);
debug(2, "elfloader: Loaded relocation table. %d entries. base address=%p\n", cnt, relSegment);
uint32 *src;
uint32 value;
- for (int i = 0; i < cnt; i++) {
+ for (uint32 i = 0; i < cnt; i++) {
// Get the symbol this relocation entry is referring to
- Elf32_Sym *sym = (Elf32_Sym *)(_symtab) + (REL_INDEX(rel[i].r_info));
+ Elf32_Sym *sym = _symtab + (REL_INDEX(rel[i].r_info));
// Get the target instruction in the code
- src = (uint32 *)((char *)relSegment + rel[i].r_offset - _segmentVMA);
+ src = (uint32 *) ((char *) relSegment + rel[i].r_offset - _segmentVMA);
value = sym->st_value + rel[i].r_addend;
//debug(8, "elfloader: i=%05d %p +0x%04x: (0x%08x) 0x%08x ", i, src, rel[i].r_addend, sym->st_value, *src);
@@ -99,12 +98,12 @@ bool PPCDLObject::relocate(Common::SeekableReadStream* DLFile, unsigned long off
}
bool PPCDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *ehdr, Elf32_Shdr *shdr) {
- for (int i = 0; i < ehdr->e_shnum; i++) {
+ for (uint32 i = 0; i < ehdr->e_shnum; i++) {
Elf32_Shdr *curShdr = &(shdr[i]);
if ((curShdr->sh_type == SHT_REL) &&
curShdr->sh_entsize == sizeof(Elf32_Rel) &&
- (int)curShdr->sh_link == _symtab_sect &&
+ int32(curShdr->sh_link) == _symtab_sect &&
curShdr->sh_info < ehdr->e_shnum &&
(shdr[curShdr->sh_info].sh_flags & SHF_ALLOC)) {
warning("elfloader: REL entries not supported!\n");
@@ -113,7 +112,7 @@ bool PPCDLObject::relocateRels(Common::SeekableReadStream* DLFile, Elf32_Ehdr *e
if ((curShdr->sh_type == SHT_RELA) &&
curShdr->sh_entsize == sizeof(Elf32_Rela) &&
- (int)curShdr->sh_link == _symtab_sect &&
+ int32(curShdr->sh_link) == _symtab_sect &&
curShdr->sh_info < ehdr->e_shnum &&
(shdr[curShdr->sh_info].sh_flags & SHF_ALLOC)) {
if (!relocate(DLFile, curShdr->sh_offset, curShdr->sh_size, _segment))