Skip to content

Commit 9406cac

Browse files
committed
Fixed printf warnings on some platforms
uint32_t gets declared as long on some platforms
1 parent 0fb25ea commit 9406cac

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/chips/vgm_file_dumper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020

2121
#include "vgm_file_dumper.h"
22+
#include <inttypes.h>
2223
#include <cstring>
2324
#include <cassert>
2425

@@ -273,7 +274,7 @@ void VGMFileDumper::writeLoopStart()
273274
flushWait();
274275
m_vgm_head.offset_loop = VGM_LOOP_START_BASE + m_bytes_written;
275276
m_samples_loop = 0;
276-
std::printf(" - MIDI2VGM: Loop start at 0x%04X\n", m_vgm_head.offset_loop);
277+
std::printf(" - MIDI2VGM: Loop start at 0x%04" PRIX32 "\n", m_vgm_head.offset_loop);
277278
std::fflush(stdout);
278279
}
279280

@@ -283,7 +284,7 @@ void VGMFileDumper::writeLoopEnd()
283284
return;
284285
m_end_caught = true;
285286
flushWait();
286-
std::printf(" - MIDI2VGM: Loop end with total wait in %u samples\n", m_samples_loop);
287+
std::printf(" - MIDI2VGM: Loop end with total wait in %" PRIu32 " samples\n", m_samples_loop);
287288
std::fflush(stdout);
288289
}
289290

src/chips/ymfm/ymfm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <cassert>
4141
#include <cstdint>
4242
#include <cstdio>
43+
#include <cinttypes>
4344
#include <cstring>
4445
#include <algorithm>
4546
#include <memory>

src/chips/ymfm/ymfm_opn.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ std::string opn_registers_base<IsOpnA>::log_keyon(uint32_t choffs, uint32_t opof
412412
char buffer[256];
413413
char *end = &buffer[0];
414414

415-
end += sprintf(end, "%u.%02u freq=%04X dt=%u fb=%u alg=%X mul=%X tl=%02X ksr=%u adsr=%02X/%02X/%02X/%X sl=%X",
415+
end += sprintf(end, "%" PRIu32 ".%02" PRIu32 " freq=%04" PRIX32 " dt=%" PRIu32 " fb=%" PRIu32 " alg=%" PRIX32 " mul=%" PRIX32 "tl=%02" PRIX32 " ksr=%" PRIu32 " adsr=%02" PRIX32 "/%02" PRIX32 "/%02" PRIX32 "/%" PRIX32 " sl=%" PRIX32 "",
416416
chnum, opnum,
417417
block_freq,
418418
op_detune(opoffs),
@@ -432,15 +432,15 @@ std::string opn_registers_base<IsOpnA>::log_keyon(uint32_t choffs, uint32_t opof
432432
ch_output_0(choffs) ? 'L' : '-',
433433
ch_output_1(choffs) ? 'R' : '-');
434434
if (op_ssg_eg_enable(opoffs))
435-
end += sprintf(end, " ssg=%X", op_ssg_eg_mode(opoffs));
435+
end += sprintf(end, " ssg=%" PRIX32 "", op_ssg_eg_mode(opoffs));
436436
bool am = (op_lfo_am_enable(opoffs) && ch_lfo_am_sens(choffs) != 0);
437437
if (am)
438-
end += sprintf(end, " am=%u", ch_lfo_am_sens(choffs));
438+
end += sprintf(end, " am=%" PRIu32 "", ch_lfo_am_sens(choffs));
439439
bool pm = (ch_lfo_pm_sens(choffs) != 0);
440440
if (pm)
441-
end += sprintf(end, " pm=%u", ch_lfo_pm_sens(choffs));
441+
end += sprintf(end, " pm=%" PRIu32 "", ch_lfo_pm_sens(choffs));
442442
if (am || pm)
443-
end += sprintf(end, " lfo=%02X", lfo_rate());
443+
end += sprintf(end, " lfo=%02" PRIX32 "", lfo_rate());
444444
if (multi_freq() && choffs == 2)
445445
end += sprintf(end, " multi=1");
446446

0 commit comments

Comments
 (0)