first round of printf fixes (nw)

This commit is contained in:
Oliver Stöneberg 2014-02-25 11:55:35 +00:00
parent 9d8fbd5274
commit aa785afb99
10 changed files with 25 additions and 19 deletions

View File

@ -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:

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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:

View File

@ -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;
}
}

View File

@ -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());

View File

@ -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]))

View File

@ -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));
}
}