Debugger: Fix some format warnings in udis86.

This commit is contained in:
Unknown W. Brackets 2018-06-17 11:19:32 -07:00
parent 6592c6222a
commit 82dc4c0b72

View File

@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <inttypes.h>
#include "types.h"
#include "decode.h"
#include "syn.h"
@ -137,14 +138,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);
}
@ -171,7 +172,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);
}
uint64_t
@ -193,7 +194,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)
if (op->base == UD_R_RIP) {
ud_syn_print_addr(u, ud_syn_rip_target(u, op));
} else 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);
}
}
}