Fix warnings in udis86

This commit is contained in:
pancake 2016-04-26 03:08:20 +02:00
parent 94524c6577
commit 13e8e11026

View File

@ -27,6 +27,7 @@
#include "decode.h"
#include "syn.h"
#include "udint.h"
#include <inttypes.h>
/*
* Register Table - Order Matters (types.h)!
@ -143,14 +144,14 @@ ud_syn_print_addr(struct ud *u, uint64_t addr)
name = u->sym_resolver(u, addr, &offset);
if (name) {
if (offset) {
ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
ud_asmprintf(u, "%s%+" PRId64, name, offset);
} else {
ud_asmprintf(u, "%s", name);
}
return;
}
}
ud_asmprintf(u, "0x%" FMT64 "x", addr);
ud_asmprintf(u, "0x%" PRIx64, addr);
}
@ -177,7 +178,7 @@ ud_syn_print_imm(struct ud* u, const struct ud_operand *op)
default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
}
}
ud_asmprintf(u, "0x%" FMT64 "x", v);
ud_asmprintf(u, "0x%" PRIx64, v);
}
@ -195,7 +196,7 @@ ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *op, int sign)
case 64: v = op->lval.uqword; break;
default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
}
ud_asmprintf(u, "0x%" FMT64 "x", v);
ud_asmprintf(u, "0x%" PRIx64, v);
} else {
int64_t v;
UD_ASSERT(op->offset != 64);
@ -206,9 +207,9 @@ ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *op, int sign)
default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
}
if (v < 0) {
ud_asmprintf(u, "-0x%" FMT64 "x", -v);
ud_asmprintf(u, "-0x%" PRIx64, -v);
} else if (v > 0) {
ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v);
ud_asmprintf(u, "%s0x%" PRIx64, sign? "+" : "", v);
}
}
}