summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Oliver Stöneberg <firewave@users.noreply.github.com>2014-02-25 11:55:35 +0000
committer Oliver Stöneberg <firewave@users.noreply.github.com>2014-02-25 11:55:35 +0000
commitaa785afb99f2f9e91b793cc28650d382be9a79a5 (patch)
tree6d8480092326b53a38658ee34eb289e906f9687b
parent9d8fbd52746de2870e924e88be4b1f6c7a501c60 (diff)
first round of printf fixes (nw)
-rw-r--r--src/emu/audit.c4
-rw-r--r--src/emu/clifront.c8
-rw-r--r--src/emu/devcpu.c2
-rw-r--r--src/emu/dimemory.c2
-rw-r--r--src/emu/machine/nvram.c2
-rw-r--r--src/emu/netlist/nl_parser.h4
-rw-r--r--src/emu/netlist/nl_setup.c4
-rw-r--r--src/emu/tilemap.c4
-rw-r--r--src/osd/osdcomm.h6
-rw-r--r--src/tools/chdman.c8
10 files changed, 25 insertions, 19 deletions
diff --git a/src/emu/audit.c b/src/emu/audit.c
index 31b6d5f7ccb..51a92abbf8d 100644
--- a/src/emu/audit.c
+++ b/src/emu/audit.c
@@ -342,7 +342,7 @@ media_auditor::summary media_auditor::summarize(const char *name, astring *strin
{
string->catprintf("%-12s: %s", name, record->name());
if (record->expected_length() > 0)
- string->catprintf(" (%d bytes)", record->expected_length());
+ string->catprintf(" (%" I64FMT "d bytes)", record->expected_length());
string->catprintf(" - ");
}
@@ -370,7 +370,7 @@ media_auditor::summary media_auditor::summarize(const char *name, astring *strin
break;
case audit_record::SUBSTATUS_FOUND_WRONG_LENGTH:
- if (string != NULL) string->catprintf("INCORRECT LENGTH: %d bytes\n", record->actual_length());
+ if (string != NULL) string->catprintf("INCORRECT LENGTH: %" I64FMT "d bytes\n", record->actual_length());
break;
case audit_record::SUBSTATUS_NOT_FOUND:
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index 9499fc88175..6e9846aa0bc 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -198,7 +198,7 @@ int cli_frontend::execute(int argc, char **argv)
if (!found)
{
software_display_matches(config,m_options, NULL,m_options.software_name());
- throw emu_fatalerror(MAMERR_FATALERROR, "");
+ throw emu_fatalerror(MAMERR_FATALERROR, NULL);
}
}
// parse the command line, adding any system-specific options
@@ -1592,11 +1592,11 @@ void cli_frontend::romident(const char *filename)
if (ident.matches() == ident.total())
return;
else if (ident.matches() == ident.total() - ident.nonroms())
- throw emu_fatalerror(MAMERR_IDENT_NONROMS, "");
+ throw emu_fatalerror(MAMERR_IDENT_NONROMS, NULL);
else if (ident.matches() > 0)
- throw emu_fatalerror(MAMERR_IDENT_PARTIAL, "");
+ throw emu_fatalerror(MAMERR_IDENT_PARTIAL, NULL);
else
- throw emu_fatalerror(MAMERR_IDENT_NONE, "");
+ throw emu_fatalerror(MAMERR_IDENT_NONE, NULL);
}
diff --git a/src/emu/devcpu.c b/src/emu/devcpu.c
index 8f48eff2b65..802faf1d7a7 100644
--- a/src/emu/devcpu.c
+++ b/src/emu/devcpu.c
@@ -151,7 +151,7 @@ void legacy_cpu_device::device_start()
if (string != NULL && string[0] != 0)
{
astring flagstr;
- flagstr.printf("%%%ds", strlen(string));
+ flagstr.printf("%%%"SIZETFMT"s", strlen(string));
state_add(STATE_GENFLAGS, "GENFLAGS", m_state_io).callimport().callexport().formatstr(flagstr).noshow();
}
}
diff --git a/src/emu/dimemory.c b/src/emu/dimemory.c
index 0a638e842c1..1f1cce4ddd4 100644
--- a/src/emu/dimemory.c
+++ b/src/emu/dimemory.c
@@ -116,7 +116,7 @@ void device_memory_interface::static_set_addrmap(device_t &device, address_space
if (!device.interface(memory))
throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called on device '%s' with no memory interface", device.tag());
if (spacenum >= ARRAY_LENGTH(memory->m_address_map))
- throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called with out-of-range space number %d", device.tag(), spacenum);
+ throw emu_fatalerror("MCFG_DEVICE_ADDRESS_MAP called on device '%s' with out-of-range space number %d", device.tag(), spacenum);
memory->m_address_map[spacenum] = map;
}
diff --git a/src/emu/machine/nvram.c b/src/emu/machine/nvram.c
index c3a097d19b6..3973cbeb1eb 100644
--- a/src/emu/machine/nvram.c
+++ b/src/emu/machine/nvram.c
@@ -167,5 +167,5 @@ void nvram_device::determine_final_base()
// if we are region-backed for the default, find it now and make sure it's the right size
if (m_region != NULL && m_region->bytes() != m_length)
- throw emu_fatalerror("NVRAM device '%s' has a default region, but it should be 0x%X bytes", tag(), m_length);
+ throw emu_fatalerror("NVRAM device '%s' has a default region, but it should be 0x%"I64FMT"X bytes", tag(), m_length);
}
diff --git a/src/emu/netlist/nl_parser.h b/src/emu/netlist/nl_parser.h
index ca3a3dbb809..1f0905bfbdf 100644
--- a/src/emu/netlist/nl_parser.h
+++ b/src/emu/netlist/nl_parser.h
@@ -107,7 +107,7 @@ public:
}
token_t get_token_internal();
- void error(const char *format, ...);
+ void error(const char *format, ...) ATTR_PRINTF(2,3);
protected:
void reset(const char *p) { m_px = p; m_line = 1; m_line_ptr = p; }
@@ -266,7 +266,7 @@ public:
if (m_list[i].parse(setup, name))
return;
}
- setup.netlist().error("unable to find %s in source collection");
+ setup.netlist().error("unable to find %s in source collection", name.cstr());
}
private:
diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c
index 5e3c6f7df41..23d705b6551 100644
--- a/src/emu/netlist/nl_setup.c
+++ b/src/emu/netlist/nl_setup.c
@@ -259,10 +259,10 @@ void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name
}
break;
case netlist_terminal_t::DEVICE:
- netlist().error("Device registration not yet supported - \n", name.cstr());
+ netlist().error("Device registration not yet supported - %s\n", name.cstr());
break;
case netlist_terminal_t::NETLIST:
- netlist().error("Netlist registration not yet supported - \n", name.cstr());
+ netlist().error("Netlist registration not yet supported - %s\n", name.cstr());
break;
}
}
diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c
index b840114ff49..5fa27bb0a4f 100644
--- a/src/emu/tilemap.c
+++ b/src/emu/tilemap.c
@@ -1715,9 +1715,9 @@ void tilemap_device::device_start()
{
// check configuration
if (m_get_info.isnull())
- throw emu_fatalerror("Tilemap device '%s' has no get info callback!");
+ throw emu_fatalerror("Tilemap device '%s' has no get info callback!", tag());
if (m_standard_mapper == TILEMAP_STANDARD_COUNT && m_mapper.isnull())
- throw emu_fatalerror("Tilemap device '%s' has no mapper callback!");
+ throw emu_fatalerror("Tilemap device '%s' has no mapper callback!", tag());
// bind our callbacks
m_get_info.bind_relative_to(*owner());
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h
index 595f5b595ce..375db9d9058 100644
--- a/src/osd/osdcomm.h
+++ b/src/osd/osdcomm.h
@@ -164,6 +164,12 @@ __extension__ typedef signed long long INT64;
#define I64FMT "ll"
#endif
+#if defined(_MSVC_VER) || defined(__MINGW32__)
+#define SIZETFMT "I64u"
+#else
+#define SIZETFMT "zu"
+#endif
+
/* Highly useful macro for compile-time knowledge of an array size */
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))
diff --git a/src/tools/chdman.c b/src/tools/chdman.c
index d0bd1429822..5c1068c8099 100644
--- a/src/tools/chdman.c
+++ b/src/tools/chdman.c
@@ -95,7 +95,7 @@ const int MODE_GDI = 2;
typedef tagmap_t<astring *> parameters_t;
-static void report_error(int error, const char *format, ...);
+static void report_error(int error, const char *format, ...) ATTR_PRINTF(2,3);
static void do_info(parameters_t &params);
static void do_verify(parameters_t &params);
static void do_create_raw(parameters_t &params);
@@ -2519,14 +2519,14 @@ static void do_extract_ld(parameters_t &params)
// read the hunk into the buffers
chd_error err = input_chd.read_hunk(framenum, NULL);
if (err != CHDERR_NONE)
- report_error(1, "Error reading hunk %d from CHD file (%s): %s\n", framenum, params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
+ report_error(1, "Error reading hunk %"I64FMT"d from CHD file (%s): %s\n", framenum, params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
// write audio
for (int chnum = 0; chnum < channels; chnum++)
{
avi_error avierr = avi_append_sound_samples(output_file, chnum, avconfig.audio[chnum], actsamples, 0);
if (avierr != AVIERR_NONE)
- report_error(1, "Error writing samples for hunk %d to file (%s): %s\n", framenum, output_file_str->cstr(), avi_error_string(avierr));
+ report_error(1, "Error writing samples for hunk %"I64FMT"d to file (%s): %s\n", framenum, output_file_str->cstr(), avi_error_string(avierr));
}
// write video
@@ -2534,7 +2534,7 @@ static void do_extract_ld(parameters_t &params)
{
avi_error avierr = avi_append_video_frame(output_file, fullbitmap);
if (avierr != AVIERR_NONE)
- report_error(1, "Error writing video for hunk %d to file (%s): %s\n", framenum, output_file_str->cstr(), avi_error_string(avierr));
+ report_error(1, "Error writing video for hunk %"I64FMT"d to file (%s): %s\n", framenum, output_file_str->cstr(), avi_error_string(avierr));
}
}