[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] portable printf format specifiers
From: |
Billy Donahue |
Subject: |
[PATCH 2/2] portable printf format specifiers |
Date: |
Thu, 25 Feb 2021 02:53:09 -0500 |
switch format specifiers from "l?" to `PRI?64` macros.
MacOS in particular uses `long long` for `int64_t`.
---
libsim/avrreadelf.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libsim/avrreadelf.cpp b/libsim/avrreadelf.cpp
index 393b815..33e1f0f 100644
--- a/libsim/avrreadelf.cpp
+++ b/libsim/avrreadelf.cpp
@@ -26,6 +26,7 @@
#include <string>
#include <map>
#include <limits>
+#include <cinttypes>
#include "elfio/elfio.hpp"
@@ -105,7 +106,7 @@ void ELFLoad(const AvrDevice * core) {
} else if(value >= 0x840000 && value < 0x840400) {
/* signature space starting from 0x840000, do nothing */;
} else
- avr_warning("Unknown symbol address range found!
(symbol='%s', address=0x%lx)",
+ avr_warning("Unknown symbol address range found!
(symbol='%s', address=0x%" PRIx64 ")",
name.c_str(),
value);
@@ -148,7 +149,7 @@ void ELFLoad(const AvrDevice * core) {
} else if(vma >= 0x840000 && vma < 0x840400) {
// read and check signature, if available, space from 0x840000
to 0x840400
if(filesize != 3)
- avr_error("wrong device signature size in elf file,
expected=3, given=%lu",
+ avr_error("wrong device signature size in elf file,
expected=3, given=%" PRIu64 "",
filesize);
else {
unsigned int sig = (((data[2] << 8) + data[1]) << 8) +
data[0];
@@ -190,7 +191,7 @@ unsigned int ELFGetSignature(const char *filename) {
if(vma >= 0x840000 && vma < 0x840400) {
// read and check signature, if available, space from 0x840000
to 0x840400
if(filesize != 3)
- avr_error("wrong device signature size in elf file,
expected=3, given=%lu",
+ avr_error("wrong device signature size in elf file,
expected=3, given=%" PRIu64 "",
filesize);
else {
const unsigned char* data = (const unsigned
char*)pseg->get_data();
--
2.24.3 (Apple Git-128)