From 73b44c94291c4d086477167a76fd7db239936c3b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 6 Mar 2016 18:02:37 +1100 Subject: Turn core_file into a proper class that gets cleaned up safely using unique_ptr Subverted somewhat by chd_file class --- src/lib/util/corefile.h | 122 ++++++++++++++++++++++++++---------------------- 1 file changed, 66 insertions(+), 56 deletions(-) (limited to 'src/lib/util/corefile.h') diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h index 36060631f35..a5837e6de21 100644 --- a/src/lib/util/corefile.h +++ b/src/lib/util/corefile.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Vas Crabb /*************************************************************************** corefile.h @@ -15,10 +15,14 @@ #include #include "corestr.h" -#include #include "coretmpl.h" +#include +#include +#include + +namespace util { /*************************************************************************** ADDITIONAL OPEN FLAGS @@ -32,98 +36,104 @@ #define FCOMPRESS_MAX 9 /* maximum compression */ - /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ -struct core_file; - - +class core_file +{ +public: + typedef std::unique_ptr ptr; -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ + // ----- file open/close ----- -/* ----- file open/close ----- */ + // open a file with the specified filename + static file_error open(const char *filename, std::uint32_t openflags, ptr &file); -/* open a file with the specified filename */ -file_error core_fopen(const char *filename, UINT32 openflags, core_file **file); + // open a RAM-based "file" using the given data and length (read-only) + static file_error open_ram(const void *data, std::size_t length, std::uint32_t openflags, ptr &file); -/* open a RAM-based "file" using the given data and length (read-only) */ -file_error core_fopen_ram(const void *data, size_t length, UINT32 openflags, core_file **file); + // open a RAM-based "file" using the given data and length (read-only), copying the data + static file_error open_ram_copy(const void *data, std::size_t length, std::uint32_t openflags, ptr &file); -/* open a RAM-based "file" using the given data and length (read-only), copying the data */ -file_error core_fopen_ram_copy(const void *data, size_t length, UINT32 openflags, core_file **file); + // open a proxy "file" that forwards requests to another file object + static file_error open_proxy(core_file &file, ptr &proxy); -/* close an open file */ -void core_fclose(core_file *file); + // close an open file + virtual ~core_file(); -/* enable/disable streaming file compression via zlib; level is 0 to disable compression, or up to 9 for max compression */ -file_error core_fcompress(core_file *file, int level); + // enable/disable streaming file compression via zlib; level is 0 to disable compression, or up to 9 for max compression + virtual file_error compress(int level) = 0; + // ----- file positioning ----- -/* ----- file positioning ----- */ + // adjust the file pointer within the file + virtual int seek(std::int64_t offset, int whence) = 0; -/* adjust the file pointer within the file */ -int core_fseek(core_file *file, INT64 offset, int whence); + // return the current file pointer + virtual std::uint64_t tell() const = 0; -/* return the current file pointer */ -UINT64 core_ftell(core_file *file); + // return true if we are at the EOF + virtual bool eof() const = 0; -/* return true if we are at the EOF */ -int core_feof(core_file *file); + // return the total size of the file + virtual std::uint64_t size() const = 0; -/* return the total size of the file */ -UINT64 core_fsize(core_file *file); + // ----- file read ----- + // standard binary read from a file + virtual std::uint32_t read(void *buffer, std::uint32_t length) = 0; -/* ----- file read ----- */ + // read one character from the file + virtual int getc() = 0; -/* standard binary read from a file */ -UINT32 core_fread(core_file *file, void *buffer, UINT32 length); + // put back one character from the file + virtual int ungetc(int c) = 0; -/* read one character from the file */ -int core_fgetc(core_file *file); + // read a full line of text from the file + virtual char *gets(char *s, int n) = 0; -/* put back one character from the file */ -int core_ungetc(int c, core_file *file); + // get a pointer to a buffer that holds the full file data in RAM + // this function may cause the full file data to be read + virtual const void *buffer() = 0; -/* read a full line of text from the file */ -char *core_fgets(char *s, int n, core_file *file); + // open a file with the specified filename, read it into memory, and return a pointer + static file_error load(const char *filename, void **data, std::uint32_t &length); + static file_error load(const char *filename, dynamic_buffer &data); -/* get a pointer to a buffer that holds the full file data in RAM */ -/* this function may cause the full file data to be read */ -const void *core_fbuffer(core_file *file); -/* open a file with the specified filename, read it into memory, and return a pointer */ -file_error core_fload(const char *filename, void **data, UINT32 *length); -file_error core_fload(const char *filename, dynamic_buffer &data); + // ----- file write ----- + // standard binary write to a file + virtual std::uint32_t write(const void *buffer, std::uint32_t length) = 0; + // write a line of text to the file + virtual int puts(const char *s) = 0; -/* ----- file write ----- */ + // printf-style text write to a file + virtual int vprintf(const char *fmt, va_list va) = 0; + int CLIB_DECL printf(const char *fmt, ...) ATTR_PRINTF(2,3); -/* standard binary write to a file */ -UINT32 core_fwrite(core_file *file, const void *buffer, UINT32 length); + // file truncation + virtual file_error truncate(std::uint64_t offset) = 0; -/* write a line of text to the file */ -int core_fputs(core_file *f, const char *s); + // flush file buffers + virtual file_error flush() = 0; -/* printf-style text write to a file */ -int core_vfprintf(core_file *f, const char *fmt, va_list va); -int CLIB_DECL core_fprintf(core_file *f, const char *fmt, ...) ATTR_PRINTF(2,3); -/* file truncation */ -file_error core_truncate(core_file *f, UINT64 offset); +protected: + core_file(); +}; -/* flush file buffers */ -file_error core_fflush(core_file *f); +} // namespace util +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ /* ----- filename utilities ----- */ -- cgit v1.2.3-70-g09d2 From 5aea0893a03648efe27025f88d6b98cd48129869 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 9 Mar 2016 18:02:13 +1100 Subject: Use type-safe printf for core_file and emu_file, surprisingly few knock-on effects Properly fix up a couple of places I64FMT was being used, still more to deal with --- src/devices/sound/discrete.cpp | 17 ++++++++--------- src/devices/sound/esqpump.cpp | 10 +++++----- src/emu/cheat.cpp | 3 +++ src/emu/cheat.h | 2 +- src/emu/fileio.cpp | 19 ++----------------- src/emu/fileio.h | 7 +++++-- src/lib/util/corefile.cpp | 36 +++++++++++++----------------------- src/lib/util/corefile.h | 9 ++++++--- src/mame/drivers/ssem.cpp | 41 ++++++++++++++++++++++++----------------- src/tools/chdman.cpp | 33 ++++++++++++++------------------- 10 files changed, 81 insertions(+), 96 deletions(-) (limited to 'src/lib/util/corefile.h') diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp index dc66910707f..e09c47c9bf0 100644 --- a/src/devices/sound/discrete.cpp +++ b/src/devices/sound/discrete.cpp @@ -39,6 +39,7 @@ #include "sound/wavwrite.h" #include "discrete.h" #include +#include /* for_each collides with c++ standard libraries - include it here */ #define for_each(_T, _e, _l) for (_T _e = (_l)->begin_ptr() ; _e <= (_l)->end_ptr(); _e++) @@ -647,15 +648,15 @@ void discrete_device::display_profiling(void) total = list_run_time(m_node_list); count = m_node_list.count(); /* print statistics */ - printf("%s",string_format("Total Samples : %16I64d\n", m_total_samples).c_str()); + util::stream_format(std::cout, "Total Samples : %16d\n", m_total_samples); tresh = total / count; - printf("%s",string_format("Threshold (mean): %16I64d\n", tresh / m_total_samples).c_str()); + util::stream_format(std::cout, "Threshold (mean): %16d\n", tresh / m_total_samples ); for_each(discrete_base_node **, node, &m_node_list) { discrete_step_interface *step; if ((*node)->interface(step)) if (step->run_time > tresh) - printf("%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), (double) step->run_time / (double) total * 100.0, ((double) step->run_time) / (double) m_total_samples); + util::stream_format(std::cout, "%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), double(step->run_time) / double(total) * 100.0, double(step->run_time) / double(m_total_samples)); } /* Task information */ @@ -663,10 +664,10 @@ void discrete_device::display_profiling(void) { tt = step_list_run_time((*task)->step_list); - printf("Task(%d): %8.2f %15.2f\n", (*task)->task_group, tt / (double) total * 100.0, tt / (double) m_total_samples); + util::stream_format(std::cout, "Task(%d): %8.2f %15.2f\n", (*task)->task_group, tt / double(total) * 100.0, tt / double(m_total_samples)); } - printf("Average samples/double->update: %8.2f\n", (double) m_total_samples / (double) m_total_stream_updates); + util::stream_format(std::cout, "Average samples/double->update: %8.2f\n", double(m_total_samples) / double(m_total_stream_updates)); } @@ -737,7 +738,7 @@ void discrete_device::init_nodes(const sound_block_list_t &block_list) task->task_group = block->initial[0]; if (task->task_group < 0 || task->task_group >= DISCRETE_MAX_TASK_GROUPS) fatalerror("discrete_dso_task: illegal task_group %d\n", task->task_group); - //printf("task group %d\n", task->task_group); + //util::stream_format(std::cout, "task group %d\n", task->task_group); task_list.add(task); } break; @@ -870,7 +871,6 @@ void discrete_device::device_start() //m_stream = machine().sound().stream_alloc(*this, 0, 2, 22257); const discrete_block *intf_start = m_intf; - char name[128]; /* If a clock is specified we will use it, otherwise run at the audio sample rate. */ if (this->clock()) @@ -884,9 +884,8 @@ void discrete_device::device_start() m_total_stream_updates = 0; /* create the logfile */ - sprintf(name, "discrete%s.log", this->tag()); if (DISCRETE_DEBUGLOG) - m_disclogfile = fopen(name, "w"); + m_disclogfile = fopen(util::string_format("discrete%s.log", this->tag()).c_str(), "w"); /* enable profiling */ m_profiling = 0; diff --git a/src/devices/sound/esqpump.cpp b/src/devices/sound/esqpump.cpp index e9ad6cedf85..9873029e056 100644 --- a/src/devices/sound/esqpump.cpp +++ b/src/devices/sound/esqpump.cpp @@ -112,7 +112,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample e[(ei + 0x1d0f) % 0x4000] = e_next; if (l != e[ei]) { - fprintf(stderr, "expected (%d) but have (%d)\n", e[ei], l); + util::stream_format(std::cerr, "expected (%d) but have (%d)\n", e[ei], l); } ei = (ei + 1) % 0x4000; #endif @@ -133,9 +133,9 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample bool silence = silent_for >= 500; if (was_silence != silence) { if (!silence) { - fprintf(stderr, ".-*\n"); + util::stream_format(std::cerr, ".-*\n"); } else { - fprintf(stderr, "*-.\n"); + util::stream_format(std::cerr, "*-.\n"); } was_silence = silence; } @@ -148,7 +148,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample { osd_ticks_t elapsed = now - last_ticks; osd_ticks_t tps = osd_ticks_per_second(); - fprintf(stderr, "%s",string_format("Pump: %d samples in %I64d ticks for %f Hz\n", last_samples, elapsed, last_samples * (double)tps / (double)elapsed).c_str()); + util::stream_format(std::cerr, "Pump: %d samples in %d ticks for %f Hz\n", last_samples, elapsed, last_samples * (double)tps / (double)elapsed); last_ticks = now; while (next_report_ticks <= now) { next_report_ticks += tps; @@ -156,7 +156,7 @@ void esq_5505_5510_pump::sound_stream_update(sound_stream &stream, stream_sample last_samples = 0; #if !PUMP_FAKE_ESP_PROCESSING - fprintf(stderr, "%s",string_format(" ESP spent %I64d ticks on %d samples, %f ticks per sample\n", ticks_spent_processing, samples_processed, (double)ticks_spent_processing / (double)samples_processed).c_str()); + util::stream_format(std::cerr, " ESP spent %d ticks on %d samples, %f ticks per sample\n", ticks_spent_processing, samples_processed, (double)ticks_spent_processing / (double)samples_processed); ticks_spent_processing = 0; samples_processed = 0; #endif diff --git a/src/emu/cheat.cpp b/src/emu/cheat.cpp index 6b24b22fc35..0a799ca6f13 100644 --- a/src/emu/cheat.cpp +++ b/src/emu/cheat.cpp @@ -1031,6 +1031,9 @@ std::unique_ptr &cheat_entry::script_for_state(script_state state) // CHEAT MANAGER //************************************************************************** +const int cheat_manager::CHEAT_VERSION; + + //------------------------------------------------- // cheat_manager - constructor //------------------------------------------------- diff --git a/src/emu/cheat.h b/src/emu/cheat.h index 6badabd14d6..20772e25640 100644 --- a/src/emu/cheat.h +++ b/src/emu/cheat.h @@ -329,7 +329,7 @@ private: symbol_table m_symtable; // global symbol table // constants - static const int CHEAT_VERSION = 1; + static constexpr int CHEAT_VERSION = 1; }; diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp index 23f21f8b9b7..79bf746fbfa 100644 --- a/src/emu/fileio.cpp +++ b/src/emu/fileio.cpp @@ -617,25 +617,10 @@ int emu_file::puts(const char *s) // vfprintf - vfprintf to a text file //------------------------------------------------- -int emu_file::vprintf(const char *fmt, va_list va) +int emu_file::vprintf(util::format_argument_pack const &args) { // write the data if we can - return (m_file) ? m_file->vprintf(fmt, va) : 0; -} - - -//------------------------------------------------- -// printf - vfprintf to a text file -//------------------------------------------------- - -int CLIB_DECL emu_file::printf(const char *fmt, ...) -{ - int rc; - va_list va; - va_start(va, fmt); - rc = vprintf(fmt, va); - va_end(va); - return rc; + return m_file ? m_file->vprintf(args) : 0; } diff --git a/src/emu/fileio.h b/src/emu/fileio.h index 9a65349614f..22f36f5362e 100644 --- a/src/emu/fileio.h +++ b/src/emu/fileio.h @@ -135,8 +135,11 @@ public: // writing UINT32 write(const void *buffer, UINT32 length); int puts(const char *s); - int vprintf(const char *fmt, va_list va); - int printf(const char *fmt, ...) ATTR_PRINTF(2,3); + int vprintf(util::format_argument_pack const &args); + template int printf(Format &&fmt, Params &&...args) + { + return vprintf(util::make_format_argument_pack(std::forward(fmt), std::forward(args)...)); + } // buffers void flush(); diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index b4a246d81f6..fd98c8be59f 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -8,14 +8,15 @@ ***************************************************************************/ -#include - #include "corefile.h" + #include "unicode.h" +#include "vecstream.h" + #include #include -#include +#include #include #include @@ -157,7 +158,7 @@ public: virtual std::uint32_t write(const void *buffer, std::uint32_t length) override { return m_file.write(buffer, length); } virtual int puts(const char *s) override { return m_file.puts(s); } - virtual int vprintf(const char *fmt, va_list va) override { return m_file.vprintf(fmt, va); } + virtual int vprintf(util::format_argument_pack const &args) override { return m_file.vprintf(args); } virtual file_error truncate(std::uint64_t offset) override { return m_file.truncate(offset); } virtual file_error flush() override { return m_file.flush(); } @@ -184,7 +185,7 @@ public: virtual int ungetc(int c) override; virtual char *gets(char *s, int n) override; virtual int puts(char const *s) override; - virtual int vprintf(char const *fmt, va_list va) override; + virtual int vprintf(util::format_argument_pack const &args) override; protected: core_text_file(std::uint32_t openflags) @@ -192,6 +193,7 @@ protected: , m_text_type(text_file_type::OSD) , m_back_char_head(0) , m_back_char_tail(0) + , m_printf_buffer() { } @@ -208,6 +210,7 @@ private: char m_back_chars[UTF8_CHAR_MAX]; // buffer to hold characters for ungetc int m_back_char_head; // head of ungetc buffer int m_back_char_tail; // tail of ungetc buffer + ovectorstream m_printf_buffer; // persistent buffer for formatted output }; @@ -608,11 +611,12 @@ int core_text_file::puts(char const *s) vprintf - vfprintf to a text file -------------------------------------------------*/ -int core_text_file::vprintf(char const *fmt, va_list va) +int core_text_file::vprintf(util::format_argument_pack const &args) { - char buf[1024]; - vsnprintf(buf, sizeof(buf), fmt, va); - return puts(buf); + m_printf_buffer.seekp(0, ovectorstream::beg); + util::stream_format(m_printf_buffer, args); + m_printf_buffer.put('\0'); + return puts(&m_printf_buffer.vec()[0]); } @@ -1248,20 +1252,6 @@ file_error core_file::load(char const *filename, dynamic_buffer &data) } -/*------------------------------------------------- - printf - printf to a text file --------------------------------------------------*/ - -int CLIB_DECL core_file::printf(char const *fmt, ...) -{ - va_list va; - va_start(va, fmt); - auto const rc = vprintf(fmt, va); - va_end(va); - return rc; -} - - /*------------------------------------------------- protected constructor -------------------------------------------------*/ diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h index a5837e6de21..7ec76af7cb5 100644 --- a/src/lib/util/corefile.h +++ b/src/lib/util/corefile.h @@ -13,9 +13,9 @@ #ifndef __COREFILE_H__ #define __COREFILE_H__ -#include #include "corestr.h" #include "coretmpl.h" +#include "strformat.h" #include #include @@ -114,8 +114,11 @@ public: virtual int puts(const char *s) = 0; // printf-style text write to a file - virtual int vprintf(const char *fmt, va_list va) = 0; - int CLIB_DECL printf(const char *fmt, ...) ATTR_PRINTF(2,3); + virtual int vprintf(util::format_argument_pack const &args) = 0; + template int printf(Format &&fmt, Params &&...args) + { + return vprintf(util::make_format_argument_pack(std::forward(fmt), std::forward(args)...)); + } // file truncation virtual file_error truncate(std::uint64_t offset) = 0; diff --git a/src/mame/drivers/ssem.cpp b/src/mame/drivers/ssem.cpp index 2fdc6eefebe..a35cb104d92 100644 --- a/src/mame/drivers/ssem.cpp +++ b/src/mame/drivers/ssem.cpp @@ -18,21 +18,29 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_store(*this, "store"), - m_screen(*this, "screen") { } - - required_device m_maincpu; - required_shared_ptr m_store; - required_device m_screen; + m_screen(*this, "screen") + { + } - UINT8 m_store_line; virtual void machine_start() override; virtual void machine_reset() override; UINT32 screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_INPUT_CHANGED_MEMBER(panel_check); DECLARE_QUICKLOAD_LOAD_MEMBER(ssem_store); inline UINT32 reverse(UINT32 v); - void glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...) ATTR_PRINTF(5,6); void strlower(char *buf); + +private: + template + void glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, Format &&fmt, Params &&...args); + + required_device m_maincpu; + required_shared_ptr m_store; + required_device m_screen; + + UINT8 m_store_line; + + util::ovectorstream m_glyph_print_buf; }; @@ -403,20 +411,18 @@ static const UINT8 char_glyphs[0x80][8] = { 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff }, }; -void ssem_state::glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, const char *msg, ...) +template +void ssem_state::glyph_print(bitmap_rgb32 &bitmap, INT32 x, INT32 y, Format &&fmt, Params &&...args) { - va_list arg_list; - char buf[32768]; - INT32 index = 0; const rectangle &visarea = m_screen->visible_area(); - va_start( arg_list, msg ); - vsprintf( buf, msg, arg_list ); - va_end( arg_list ); + m_glyph_print_buf.seekp(0, util::ovectorstream::beg); + util::stream_format(m_glyph_print_buf, std::forward(fmt), std::forward(args)...); + m_glyph_print_buf.put('\0'); - for(index = 0; index < strlen(buf) && index < 32768; index++) + for(char const *buf = &m_glyph_print_buf.vec()[0]; *buf; buf++) { - UINT8 cur = (UINT8)buf[index]; + UINT8 cur = UINT8(*buf); if(cur < 0x80) { INT32 line = 0; @@ -493,7 +499,7 @@ UINT32 ssem_state::screen_update_ssem(screen_device &screen, bitmap_rgb32 &bitma (m_store[(m_store_line << 2) | 1] << 16) | (m_store[(m_store_line << 2) | 2] << 8) | (m_store[(m_store_line << 2) | 3] << 0)); - glyph_print(bitmap, 0, 272, "%s",string_format("LINE:%02d VALUE:%08x HALT:%I64d", m_store_line, word, m_maincpu->state_int(SSEM_HALT)).c_str()); + glyph_print(bitmap, 0, 272, "LINE:%02u VALUE:%08x HALT:%d", m_store_line, word, m_maincpu->state_int(SSEM_HALT)); return 0; } @@ -609,6 +615,7 @@ QUICKLOAD_LOAD_MEMBER(ssem_state, ssem_store) void ssem_state::machine_start() { save_item(NAME(m_store_line)); + m_glyph_print_buf.reserve(1024); } void ssem_state::machine_reset() diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 0358a4c5620..1a80bc76e13 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -23,8 +23,10 @@ #include #include #include -#include + +#include #include +#include @@ -105,7 +107,7 @@ const int MODE_GDI = 2; typedef std::unordered_map parameters_t; -static void report_error(int error, const char *format, ...) ATTR_PRINTF(2,3); +template static void report_error(int error, Format &&fmt, Params &&...args); static void do_info(parameters_t ¶ms); static void do_verify(parameters_t ¶ms); static void do_create_raw(parameters_t ¶ms); @@ -727,15 +729,11 @@ static const command_description s_commands[] = // report_error - report an error //------------------------------------------------- -static void report_error(int error, const char *format, ...) +template static void report_error(int error, Format &&fmt, Params &&...args) { // output to stderr - va_list arg; - va_start(arg, format); - vfprintf(stderr, format, arg); - fflush(stderr); - va_end(arg); - fprintf(stderr, "\n"); + util::stream_format(std::cerr, std::forward(fmt), std::forward(args)...); + std::cerr << std::endl; // reset time for progress and return the error lastprogress = 0; @@ -747,7 +745,7 @@ static void report_error(int error, const char *format, ...) // progress - generic progress callback //------------------------------------------------- -static void ATTR_PRINTF(2,3) progress(bool forceit, const char *format, ...) +template static void progress(bool forceit, Format &&fmt, Params &&...args) { // skip if it hasn't been long enough clock_t curtime = clock(); @@ -756,11 +754,8 @@ static void ATTR_PRINTF(2,3) progress(bool forceit, const char *format, ...) lastprogress = curtime; // standard vfprintf stuff here - va_list arg; - va_start(arg, format); - vfprintf(stderr, format, arg); - fflush(stderr); - va_end(arg); + util::stream_format(std::cerr, std::forward(fmt), std::forward(args)...); + std::cerr << std::flush; } @@ -1237,7 +1232,7 @@ void output_track_metadata(int mode, util::core_file &file, int tracknum, const break; } bool needquote = strchr(filename, ' ') != nullptr; - file.printf("%s",string_format("%d %d %d %d %s%s%s %I64d\n", tracknum+1, frameoffs, mode, size, needquote?"\"":"", filename, needquote?"\"":"", discoffs).c_str()); + file.printf("%d %d %d %d %s%s%s %d\n", tracknum+1, frameoffs, mode, size, needquote?"\"":"", filename, needquote?"\"":"", discoffs); } else if (mode == MODE_CUEBIN) { @@ -2598,7 +2593,7 @@ static void do_extract_ld(parameters_t ¶ms) if (err != CHDERR_NONE) { UINT64 filepos = static_cast(input_chd).tell(); - report_error(1, "%s",string_format("Error reading hunk %I64d at offset %I64d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->second->c_str(), chd_file::error_string(err)).c_str()); + report_error(1, "Error reading hunk %d at offset %d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->second->c_str(), chd_file::error_string(err)); } // write audio @@ -2606,7 +2601,7 @@ static void do_extract_ld(parameters_t ¶ms) { avi_error avierr = avi_append_sound_samples(output_file, chnum, avconfig.audio[chnum], actsamples, 0); if (avierr != AVIERR_NONE) - report_error(1, "%s",string_format("Error writing samples for hunk %I64d to file (%s): %s\n", framenum, output_file_str->second->c_str(), avi_error_string(avierr)).c_str()); + report_error(1, "Error writing samples for hunk %d to file (%s): %s\n", framenum, output_file_str->second->c_str(), avi_error_string(avierr)); } // write video @@ -2614,7 +2609,7 @@ static void do_extract_ld(parameters_t ¶ms) { avi_error avierr = avi_append_video_frame(output_file, fullbitmap); if (avierr != AVIERR_NONE) - report_error(1, "%s",string_format("Error writing video for hunk %I64d to file (%s): %s\n", framenum, output_file_str->second->c_str(), avi_error_string(avierr)).c_str()); + report_error(1, "Error writing video for hunk %d to file (%s): %s\n", framenum, output_file_str->second->c_str(), avi_error_string(avierr)); } } -- cgit v1.2.3-70-g09d2