int result = 0;
if (key->st_value < sym->st_value) {
result = -1;
- } else if (key->st_value > sym->st_value + sym->st_size) {
+ } else if (key->st_value >= sym->st_value + sym->st_size) {
result = 1;
}
return result;
key.st_value = orig_addr;
sym = bsearch(&key, syms, s->disas_num_syms, sizeof(*syms), glue(symfind, SZ));
- if (sym != 0) {
+ if (sym != NULL) {
return s->disas_strtab + sym->st_name;
}
struct elf_phdr *phdr = NULL, *ph;
int size, i, total_size;
elf_word mem_size;
- uint64_t addr, low = 0, high = 0;
+ uint64_t addr, low = (uint64_t)-1, high = 0;
uint8_t *data = NULL;
if (read(fd, &ehdr, sizeof(ehdr)) != sizeof(ehdr))
cpu_physical_memory_write_rom(addr, data, mem_size);
total_size += mem_size;
- if (!low || addr < low)
+ if (addr < low)
low = addr;
- if (!high || (addr + mem_size) > high)
+ if ((addr + mem_size) > high)
high = addr + mem_size;
qemu_free(data);