summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/chdman.c130
-rw-r--r--src/tools/nltool.c2
-rw-r--r--src/tools/pngcmp.c12
-rw-r--r--src/tools/regrep.c18
-rw-r--r--src/tools/split.c26
-rw-r--r--src/tools/src2html.c36
6 files changed, 112 insertions, 112 deletions
diff --git a/src/tools/chdman.c b/src/tools/chdman.c
index 87e22bd2dbf..69f0f89a34e 100644
--- a/src/tools/chdman.c
+++ b/src/tools/chdman.c
@@ -327,7 +327,7 @@ public:
m_lastfile = m_info.track[tracknum].fname;
file_error filerr = core_fopen(m_lastfile, OPEN_FLAG_READ, &m_file);
if (filerr != FILERR_NONE)
- report_error(1, "Error opening input file (%s)'", m_lastfile.cstr());
+ report_error(1, "Error opening input file (%s)'", m_lastfile.c_str());
}
// iterate over frames
@@ -351,7 +351,7 @@ public:
core_fseek(m_file, src_frame_start, SEEK_SET);
UINT32 count = core_fread(m_file, dest, bytesperframe);
if (count != bytesperframe)
- report_error(1, "Error reading input file (%s)'", m_lastfile.cstr());
+ report_error(1, "Error reading input file (%s)'", m_lastfile.c_str());
}
// swap if appropriate
@@ -940,7 +940,7 @@ static void parse_input_chd_parameters(const parameters_t &params, chd_file &inp
{
chd_error err = input_parent_chd.open(*input_chd_parent_str);
if (err != CHDERR_NONE)
- report_error(1, "Error opening parent CHD file (%s): %s", input_chd_parent_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error opening parent CHD file (%s): %s", input_chd_parent_str->c_str(), chd_file::error_string(err));
}
// process input file
@@ -949,7 +949,7 @@ static void parse_input_chd_parameters(const parameters_t &params, chd_file &inp
{
chd_error err = input_chd.open(*input_chd_str, writeable, input_parent_chd.opened() ? &input_parent_chd : NULL);
if (err != CHDERR_NONE)
- report_error(1, "Error opening CHD file (%s): %s", input_chd_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error opening CHD file (%s): %s", input_chd_str->c_str(), chd_file::error_string(err));
}
}
@@ -1028,7 +1028,7 @@ static astring *parse_output_chd_parameters(const parameters_t &params, chd_file
{
chd_error err = output_parent_chd.open(*output_chd_parent_str);
if (err != CHDERR_NONE)
- report_error(1, "Error opening parent CHD file (%s): %s", output_chd_parent_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error opening parent CHD file (%s): %s", output_chd_parent_str->c_str(), chd_file::error_string(err));
}
// process output file
@@ -1083,10 +1083,10 @@ static void parse_compression(const parameters_t &params, chd_codec_type compres
{
astring name(*compression_str, start, (end == -1) ? -1 : end - start);
if (name.len() != 4)
- report_error(1, "Invalid compressor '%s' specified", name.cstr());
+ report_error(1, "Invalid compressor '%s' specified", name.c_str());
chd_codec_type type = CHD_MAKE_TAG(name[0], name[1], name[2], name[3]);
if (!chd_codec_list::codec_exists(type))
- report_error(1, "Invalid compressor '%s' specified", name.cstr());
+ report_error(1, "Invalid compressor '%s' specified", name.c_str());
compression[index++] = type;
if (end == -1)
break;
@@ -1258,7 +1258,7 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_
}
// output TRACK entry
- core_fprintf(file, " TRACK %02d %s\n", tracknum + 1, tempstr.cstr());
+ core_fprintf(file, " TRACK %02d %s\n", tracknum + 1, tempstr.c_str());
// output PREGAP tag if pregap sectors are not in the file
if ((info.pregap > 0) && (info.pgdatasize == 0))
@@ -1296,7 +1296,7 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_
modesubmode.format("%s %s", cdrom_get_type_string(info.trktype), cdrom_get_subtype_string(info.subtype));
else
modesubmode.format("%s", cdrom_get_type_string(info.trktype));
- core_fprintf(file, "TRACK %s\n", modesubmode.cstr());
+ core_fprintf(file, "TRACK %s\n", modesubmode.c_str());
// write out the attributes
core_fprintf(file, "NO COPY\n");
@@ -1309,7 +1309,7 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_
// output pregap
astring tempstr;
if (info.pregap > 0)
- core_fprintf(file, "ZERO %s %s\n", modesubmode.cstr(), msf_string_from_frames(tempstr, info.pregap));
+ core_fprintf(file, "ZERO %s %s\n", modesubmode.c_str(), msf_string_from_frames(tempstr, info.pregap));
// all tracks but the first one have a file offset
if (tracknum > 0)
@@ -1340,7 +1340,7 @@ static void do_info(parameters_t &params)
// print filename and version
astring tempstr;
- printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str());
printf("File Version: %d\n", input_chd.version());
if (input_chd.version() < 3)
report_error(1, "Unsupported version (%d); use an older chdman to upgrade to version 3 or later", input_chd.version());
@@ -1504,7 +1504,7 @@ static void do_verify(parameters_t &params)
UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_chd.logical_bytes() - offset);
chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read);
if (err != CHDERR_NONE)
- report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
+ report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->c_str(), chd_file::error_string(err));
// add to the checksum
rawsha1.append(buffer, bytes_to_read);
@@ -1568,7 +1568,7 @@ static void do_create_raw(parameters_t &params)
{
file_error filerr = core_fopen(*input_file_str, OPEN_FLAG_READ, &input_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", input_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", input_file_str->c_str());
}
// process output CHD
@@ -1604,10 +1604,10 @@ static void do_create_raw(parameters_t &params)
// print some info
astring tempstr;
- printf("Output CHD: %s\n", output_chd_str->cstr());
+ printf("Output CHD: %s\n", output_chd_str->c_str());
if (output_parent.opened())
- printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr());
- printf("Input file: %s\n", input_file_str->cstr());
+ printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str());
+ printf("Input file: %s\n", input_file_str->c_str());
if (input_start != 0 || input_end != core_fsize(input_file))
{
printf("Input start: %s\n", big_int_string(tempstr, input_start));
@@ -1629,7 +1629,7 @@ static void do_create_raw(parameters_t &params)
else
err = chd->create(*output_chd_str, input_end - input_start, hunk_size, unit_size, compression);
if (err != CHDERR_NONE)
- report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err));
// if we have a parent, copy forward all the metadata
if (output_parent.opened())
@@ -1665,7 +1665,7 @@ static void do_create_hd(parameters_t &params)
{
file_error filerr = core_fopen(*input_file_str, OPEN_FLAG_READ, &input_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", input_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", input_file_str->c_str());
}
// process output CHD
@@ -1740,11 +1740,11 @@ static void do_create_hd(parameters_t &params)
// load the file
file_error filerr = core_fload(*ident_str, identdata);
if (filerr != FILERR_NONE)
- report_error(1, "Error reading ident file (%s)", ident_str->cstr());
+ report_error(1, "Error reading ident file (%s)", ident_str->c_str());
// must be at least 14 bytes; extract CHS data from there
if (identdata.count() < 14)
- report_error(1, "Ident file '%s' is invalid (too short)", ident_str->cstr());
+ report_error(1, "Ident file '%s' is invalid (too short)", ident_str->c_str());
cylinders = (identdata[3] << 8) | identdata[2];
heads = (identdata[7] << 8) | identdata[6];
sectors = (identdata[13] << 8) | identdata[12];
@@ -1775,12 +1775,12 @@ static void do_create_hd(parameters_t &params)
// print some info
astring tempstr;
- printf("Output CHD: %s\n", output_chd_str->cstr());
+ printf("Output CHD: %s\n", output_chd_str->c_str());
if (output_parent.opened())
- printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr());
+ printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str());
if (input_file != NULL)
{
- printf("Input file: %s\n", input_file_str->cstr());
+ printf("Input file: %s\n", input_file_str->c_str());
if (input_start != 0 || input_end != core_fsize(input_file))
{
printf("Input start: %s\n", big_int_string(tempstr, input_start));
@@ -1807,7 +1807,7 @@ static void do_create_hd(parameters_t &params)
else
err = chd->create(*output_chd_str, UINT64(totalsectors) * UINT64(sector_size), hunk_size, sector_size, compression);
if (err != CHDERR_NONE)
- report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err));
// add the standard hard disk metadata
astring metadata;
@@ -1856,7 +1856,7 @@ static void do_create_cd(parameters_t &params)
{
chd_error err = chdcd_parse_toc(*input_file_str, toc, track_info);
if (err != CHDERR_NONE)
- report_error(1, "Error parsing input file (%s: %s)\n", input_file_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error parsing input file (%s: %s)\n", input_file_str->c_str(), chd_file::error_string(err));
}
// process output CHD
@@ -1889,10 +1889,10 @@ static void do_create_cd(parameters_t &params)
// print some info
astring tempstr;
- printf("Output CHD: %s\n", output_chd_str->cstr());
+ printf("Output CHD: %s\n", output_chd_str->c_str());
if (output_parent.opened())
- printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr());
- printf("Input file: %s\n", input_file_str->cstr());
+ printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str());
+ printf("Input file: %s\n", input_file_str->c_str());
printf("Input tracks: %d\n", toc.numtrks);
printf("Input length: %s\n", msf_string_from_frames(tempstr, origtotalsectors));
printf("Compression: %s\n", compression_string(tempstr, compression));
@@ -1910,7 +1910,7 @@ static void do_create_cd(parameters_t &params)
else
err = chd->create(*output_chd_str, UINT64(totalsectors) * UINT64(CD_FRAME_SIZE), hunk_size, CD_FRAME_SIZE, compression);
if (err != CHDERR_NONE)
- report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err));
// add the standard CD metadata; we do this even if we have a parent because it might be different
err = cdrom_write_metadata(chd, &toc);
@@ -1947,7 +1947,7 @@ static void do_create_ld(parameters_t &params)
{
avi_error avierr = avi_open(*input_file_str, &input_file);
if (avierr != AVIERR_NONE)
- report_error(1, "Error opening AVI file (%s): %s\n", input_file_str->cstr(), avi_error_string(avierr));
+ report_error(1, "Error opening AVI file (%s): %s\n", input_file_str->c_str(), avi_error_string(avierr));
}
const avi_movie_info *aviinfo = avi_get_movie_info(input_file);
@@ -1999,10 +1999,10 @@ static void do_create_ld(parameters_t &params)
// print some info
astring tempstr;
- printf("Output CHD: %s\n", output_chd_str->cstr());
+ printf("Output CHD: %s\n", output_chd_str->c_str());
if (output_parent.opened())
- printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr());
- printf("Input file: %s\n", input_file_str->cstr());
+ printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str());
+ printf("Input file: %s\n", input_file_str->c_str());
if (input_start != 0 && input_end != aviinfo->video_numsamples)
printf("Input start: %s\n", big_int_string(tempstr, input_start));
printf("Input length: %s (%02d:%02d:%02d)\n", big_int_string(tempstr, input_end - input_start),
@@ -2028,7 +2028,7 @@ static void do_create_ld(parameters_t &params)
else
err = chd->create(*output_chd_str, UINT64(input_end - input_start) * hunk_size, hunk_size, info.bytes_per_frame, compression);
if (err != CHDERR_NONE)
- report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err));
// write the core A/V metadata
astring metadata;
@@ -2112,10 +2112,10 @@ static void do_copy(parameters_t &params)
// print some info
astring tempstr;
- printf("Output CHD: %s\n", output_chd_str->cstr());
+ printf("Output CHD: %s\n", output_chd_str->c_str());
if (output_parent.opened())
- printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->cstr());
- printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str());
+ printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str());
if (input_start != 0 || input_end != input_chd.logical_bytes())
{
printf("Input start: %s\n", big_int_string(tempstr, input_start));
@@ -2137,7 +2137,7 @@ static void do_copy(parameters_t &params)
else
err = chd->create(*output_chd_str, input_end - input_start, hunk_size, input_chd.unit_bytes(), compression);
if (err != CHDERR_NONE)
- report_error(1, "Error creating CHD file (%s): %s", output_chd_str->cstr(), chd_file::error_string(err));
+ report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err));
// clone all the metadata, upgrading where appropriate
dynamic_buffer metadata;
@@ -2221,8 +2221,8 @@ static void do_extract_raw(parameters_t &params)
// print some info
astring tempstr;
- printf("Output File: %s\n", output_file_str->cstr());
- printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Output File: %s\n", output_file_str->c_str());
+ printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str());
if (input_start != 0 || input_end != input_chd.logical_bytes())
{
printf("Input start: %s\n", big_int_string(tempstr, input_start));
@@ -2236,7 +2236,7 @@ static void do_extract_raw(parameters_t &params)
// process output file
file_error filerr = core_fopen(*output_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", output_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", output_file_str->c_str());
// copy all data
dynamic_buffer buffer((TEMP_BUFFER_SIZE / input_chd.hunk_bytes()) * input_chd.hunk_bytes());
@@ -2248,12 +2248,12 @@ static void do_extract_raw(parameters_t &params)
UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_end - offset);
chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read);
if (err != CHDERR_NONE)
- report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
+ report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->c_str(), chd_file::error_string(err));
// write to the output
UINT32 count = core_fwrite(output_file, buffer, bytes_to_read);
if (count != bytes_to_read)
- report_error(1, "Error writing to file; check disk space (%s)", output_file_str->cstr());
+ report_error(1, "Error writing to file; check disk space (%s)", output_file_str->c_str());
// advance
offset += bytes_to_read;
@@ -2306,7 +2306,7 @@ static void do_extract_cd(parameters_t &params)
if (chop != -1)
default_name.substr(0, chop);
char basename[128];
- strncpy(basename, default_name.cstr(), 127);
+ strncpy(basename, default_name.c_str(), 127);
default_name.cat(".bin");
if (output_bin_file_str == NULL)
output_bin_file_str = &default_name;
@@ -2314,9 +2314,9 @@ static void do_extract_cd(parameters_t &params)
// print some info
astring tempstr;
- printf("Output TOC: %s\n", output_file_str->cstr());
- printf("Output Data: %s\n", output_bin_file_str->cstr());
- printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Output TOC: %s\n", output_file_str->c_str());
+ printf("Output Data: %s\n", output_bin_file_str->c_str());
+ printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str());
// catch errors so we can close & delete the output file
core_file *output_bin_file = NULL;
@@ -2337,14 +2337,14 @@ static void do_extract_cd(parameters_t &params)
// process output file
file_error filerr = core_fopen(*output_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &output_toc_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", output_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", output_file_str->c_str());
// process output BIN file
if (mode != MODE_GDI)
{
filerr = core_fopen(*output_bin_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", output_bin_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", output_bin_file_str->c_str());
}
// determine total frames
@@ -2384,7 +2384,7 @@ static void do_extract_cd(parameters_t &params)
filerr = core_fopen(trackbin_name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_bin_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", trackbin_name.cstr());
+ report_error(1, "Unable to open file (%s)", trackbin_name.c_str());
outputoffs = 0;
}
@@ -2449,7 +2449,7 @@ static void do_extract_cd(parameters_t &params)
core_fseek(output_bin_file, outputoffs, SEEK_SET);
UINT32 byteswritten = core_fwrite(output_bin_file, buffer, bufferoffs);
if (byteswritten != bufferoffs)
- report_error(1, "Error writing frame %d to file (%s): %s\n", frame, output_file_str->cstr(), chd_file::error_string(CHDERR_WRITE_ERROR));
+ report_error(1, "Error writing frame %d to file (%s): %s\n", frame, output_file_str->c_str(), chd_file::error_string(CHDERR_WRITE_ERROR));
outputoffs += bufferoffs;
bufferoffs = 0;
}
@@ -2548,8 +2548,8 @@ static void do_extract_ld(parameters_t &params)
// print some info
astring tempstr;
- printf("Output File: %s\n", output_file_str->cstr());
- printf("Input CHD: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Output File: %s\n", output_file_str->c_str());
+ printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str());
if (input_start != 0 || input_end != input_chd.hunk_count())
{
printf("Input start: %s\n", big_int_string(tempstr, input_start));
@@ -2563,7 +2563,7 @@ static void do_extract_ld(parameters_t &params)
// process output file
avi_error avierr = avi_create(*output_file_str, &info, &output_file);
if (avierr != AVIERR_NONE)
- report_error(1, "Unable to open file (%s)", output_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", output_file_str->c_str());
// create the codec configuration
avhuff_decompress_config avconfig;
@@ -2592,7 +2592,7 @@ static void do_extract_ld(parameters_t &params)
if (err != CHDERR_NONE)
{
UINT64 filepos = core_ftell(input_chd);
- report_error(1, "Error reading hunk %" I64FMT "d at offset %" I64FMT "d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err));
+ report_error(1, "Error reading hunk %" I64FMT "d at offset %" I64FMT "d from CHD file (%s): %s\n", framenum, filepos, params.find(OPTION_INPUT)->c_str(), chd_file::error_string(err));
}
// write audio
@@ -2600,7 +2600,7 @@ static void do_extract_ld(parameters_t &params)
{
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 %" I64FMT "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->c_str(), avi_error_string(avierr));
}
// write video
@@ -2608,7 +2608,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 %" I64FMT "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->c_str(), avi_error_string(avierr));
}
}
@@ -2671,7 +2671,7 @@ static void do_add_metadata(parameters_t &params)
{
file_error filerr = core_fload(*file_str, file);
if (filerr != FILERR_NONE)
- report_error(1, "Error reading metadata file (%s)", file_str->cstr());
+ report_error(1, "Error reading metadata file (%s)", file_str->c_str());
}
// make sure we have one or the other
@@ -2687,13 +2687,13 @@ static void do_add_metadata(parameters_t &params)
// print some info
astring tempstr;
- printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str());
printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff);
printf("Index: %d\n", index);
if (text_str != NULL)
- printf("Text: %s\n", text.cstr());
+ printf("Text: %s\n", text.c_str());
else
- printf("Data: %s (%d bytes)\n", file_str->cstr(), file.count());
+ printf("Data: %s (%d bytes)\n", file_str->c_str(), file.count());
// write the metadata
chd_error err;
@@ -2736,7 +2736,7 @@ static void do_del_metadata(parameters_t &params)
// print some info
astring tempstr;
- printf("Input file: %s\n", params.find(OPTION_INPUT)->cstr());
+ printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str());
printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff);
printf("Index: %d\n", index);
@@ -2795,17 +2795,17 @@ static void do_dump_metadata(parameters_t &params)
{
file_error filerr = core_fopen(*output_file_str, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &output_file);
if (filerr != FILERR_NONE)
- report_error(1, "Unable to open file (%s)", output_file_str->cstr());
+ report_error(1, "Unable to open file (%s)", output_file_str->c_str());
// output the metadata
UINT32 count = core_fwrite(output_file, buffer, buffer.count());
if (count != buffer.count())
- report_error(1, "Error writing file (%s)", output_file_str->cstr());
+ report_error(1, "Error writing file (%s)", output_file_str->c_str());
core_fclose(output_file);
// provide some feedback
astring tempstr;
- printf("File (%s) written, %s bytes\n", output_file_str->cstr(), big_int_string(tempstr, buffer.count()));
+ printf("File (%s) written, %s bytes\n", output_file_str->c_str(), big_int_string(tempstr, buffer.count()));
}
// flush to stdout
diff --git a/src/tools/nltool.c b/src/tools/nltool.c
index 92b4960be4d..109453581eb 100644
--- a/src/tools/nltool.c
+++ b/src/tools/nltool.c
@@ -303,7 +303,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s", "WARNING: This is Work In Progress! - It may fail anytime\n");
if (!opts.parse_command_line(argc, argv, OPTION_PRIORITY_DEFAULT, aerror))
{
- fprintf(stderr, "%s\n", aerror.cstr());
+ fprintf(stderr, "%s\n", aerror.c_str());
usage(opts);
return 1;
}
diff --git a/src/tools/pngcmp.c b/src/tools/pngcmp.c
index 31753a49be1..df35da8f685 100644
--- a/src/tools/pngcmp.c
+++ b/src/tools/pngcmp.c
@@ -83,7 +83,7 @@ static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, c
filerr = core_fopen(imgfile1, OPEN_FLAG_READ, &file);
if (filerr != FILERR_NONE)
{
- printf("Could not open %s (%d)\n", imgfile1.cstr(), filerr);
+ printf("Could not open %s (%d)\n", imgfile1.c_str(), filerr);
goto error;
}
@@ -92,7 +92,7 @@ static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, c
core_fclose(file);
if (pngerr != PNGERR_NONE)
{
- printf("Could not read %s (%d)\n", imgfile1.cstr(), pngerr);
+ printf("Could not read %s (%d)\n", imgfile1.c_str(), pngerr);
goto error;
}
@@ -100,7 +100,7 @@ static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, c
filerr = core_fopen(imgfile2, OPEN_FLAG_READ, &file);
if (filerr != FILERR_NONE)
{
- printf("Could not open %s (%d)\n", imgfile2.cstr(), filerr);
+ printf("Could not open %s (%d)\n", imgfile2.c_str(), filerr);
goto error;
}
@@ -109,7 +109,7 @@ static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, c
core_fclose(file);
if (pngerr != PNGERR_NONE)
{
- printf("Could not read %s (%d)\n", imgfile2.cstr(), pngerr);
+ printf("Could not read %s (%d)\n", imgfile2.c_str(), pngerr);
goto error;
}
@@ -173,14 +173,14 @@ static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, c
filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
if (filerr != FILERR_NONE)
{
- printf("Could not open %s (%d)\n", outfilename.cstr(), filerr);
+ printf("Could not open %s (%d)\n", outfilename.c_str(), filerr);
goto error;
}
pngerr = png_write_bitmap(file, NULL, finalbitmap, 0, NULL);
core_fclose(file);
if (pngerr != PNGERR_NONE)
{
- printf("Could not write %s (%d)\n", outfilename.cstr(), pngerr);
+ printf("Could not write %s (%d)\n", outfilename.c_str(), pngerr);
goto error;
}
}
diff --git a/src/tools/regrep.c b/src/tools/regrep.c
index c720ee1354e..534703cb5e2 100644
--- a/src/tools/regrep.c
+++ b/src/tools/regrep.c
@@ -571,7 +571,7 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp
/* print a header */
astring modified(templatefile);
modified.replace("<!--TITLE-->", title);
- core_fwrite(file, modified.cstr(), modified.len());
+ core_fwrite(file, modified.c_str(), modified.len());
/* return the file */
return file;
@@ -587,7 +587,7 @@ static void output_footer_and_close_file(core_file *file, astring &templatefile,
{
astring modified(templatefile);
modified.replace(0, "<!--TITLE-->", title);
- core_fwrite(file, modified.cstr(), modified.len());
+ core_fwrite(file, modified.c_str(), modified.len());
core_fclose(file);
}
@@ -686,11 +686,11 @@ static void output_report(astring &dirname, astring &tempheader, astring &tempfo
*buckettailptr[bucknum] = NULL;
/* output header */
- tempname.printf("%s" PATH_SEPARATOR "%s", dirname.cstr(), "index.html");
+ tempname.printf("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html");
indexfile = create_file_and_output_header(tempname, tempheader, title);
if (indexfile == NULL)
{
- fprintf(stderr, "Error creating file '%s'\n", tempname.cstr());
+ fprintf(stderr, "Error creating file '%s'\n", tempname.c_str());
return;
}
@@ -843,14 +843,14 @@ static int generate_png_diff(const summary_file *curfile, astring &destdir, cons
int starty;
/* generate the common source filename */
- dstfilename.printf("%s" PATH_SEPARATOR "%s", destdir.cstr(), destname);
+ dstfilename.printf("%s" PATH_SEPARATOR "%s", destdir.c_str(), destname);
srcimgname.printf("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name);
/* open and load all unique bitmaps */
for (listnum = 0; listnum < list_count; listnum++)
if (curfile->matchbitmap[listnum] == listnum)
{
- tempname.printf("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.cstr());
+ tempname.printf("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str());
/* open the source image */
filerr = core_fopen(tempname, OPEN_FLAG_READ, &file);
@@ -961,11 +961,11 @@ static void create_linked_file(astring &dirname, const summary_file *curfile, co
/* output header */
title.printf("%s Regressions (%s)", curfile->name, curfile->source);
- linkname.printf("%s" PATH_SEPARATOR "%s", dirname.cstr(), filename.cstr());
+ linkname.printf("%s" PATH_SEPARATOR "%s", dirname.c_str(), filename.c_str());
linkfile = create_file_and_output_header(linkname, tempheader, title);
if (linkfile == NULL)
{
- fprintf(stderr, "Error creating file '%s'\n", filename.cstr());
+ fprintf(stderr, "Error creating file '%s'\n", filename.c_str());
return;
}
@@ -1002,7 +1002,7 @@ static void create_linked_file(astring &dirname, const summary_file *curfile, co
{
core_fprintf(linkfile, "\t<p>\n");
core_fprintf(linkfile, "\t<b>Errors:</b>\n");
- core_fprintf(linkfile, "\t<pre>%s</pre>\n", curfile->text[listnum].cstr());
+ core_fprintf(linkfile, "\t<pre>%s</pre>\n", curfile->text[listnum].c_str());
core_fprintf(linkfile, "\t</p>\n");
}
}
diff --git a/src/tools/split.c b/src/tools/split.c
index 02e546fce14..ec4a5434fcc 100644
--- a/src/tools/split.c
+++ b/src/tools/split.c
@@ -123,16 +123,16 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi
filerr = core_fopen(splitfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &splitfile);
if (filerr != FILERR_NONE)
{
- fprintf(stderr, "Fatal error: unable to create split file '%s'\n", splitfilename.cstr());
+ fprintf(stderr, "Fatal error: unable to create split file '%s'\n", splitfilename.c_str());
goto cleanup;
}
// write the basics out
- core_fprintf(splitfile, "splitfile=%s\n", basefilename.cstr());
+ core_fprintf(splitfile, "splitfile=%s\n", basefilename.c_str());
core_fprintf(splitfile, "splitsize=%d\n", splitsize);
- printf("Split file is '%s'\n", splitfilename.cstr());
- printf("Splitting file %s into chunks of %dMB...\n", basefilename.cstr(), splitsize / (1024 * 1024));
+ printf("Split file is '%s'\n", splitfilename.c_str());
+ printf("Splitting file %s into chunks of %dMB...\n", basefilename.c_str(), splitsize / (1024 * 1024));
// now iterate until done
for (partnum = 0; partnum < 1000; partnum++)
@@ -150,7 +150,7 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi
compute_hash_as_string(computedhash, splitbuffer, length);
// write that info to the split file
- core_fprintf(splitfile, "hash=%s file=%s.%03d\n", computedhash.cstr(), basefilename.cstr(), partnum);
+ core_fprintf(splitfile, "hash=%s file=%s.%03d\n", computedhash.c_str(), basefilename.c_str(), partnum);
// compute the full filename for this guy
outfilename.printf("%s.%03d", basename, partnum);
@@ -160,11 +160,11 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi
if (filerr != FILERR_NONE)
{
printf("\n");
- fprintf(stderr, "Fatal error: unable to create output file '%s'\n", outfilename.cstr());
+ fprintf(stderr, "Fatal error: unable to create output file '%s'\n", outfilename.c_str());
goto cleanup;
}
- printf(" writing %s.%03d...", basefilename.cstr(), partnum);
+ printf(" writing %s.%03d...", basefilename.c_str(), partnum);
// write the data
actual = core_fwrite(outfile, splitbuffer, length);
@@ -273,7 +273,7 @@ static int join_file(const char *filename, const char *outname, int write_output
{
core_fclose(outfile);
outfile = NULL;
- fprintf(stderr, "Fatal error: output file '%s' already exists\n", outfilename.cstr());
+ fprintf(stderr, "Fatal error: output file '%s' already exists\n", outfilename.c_str());
goto cleanup;
}
@@ -281,12 +281,12 @@ static int join_file(const char *filename, const char *outname, int write_output
filerr = core_fopen(outfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile);
if (filerr != FILERR_NONE)
{
- fprintf(stderr, "Fatal error: unable to create file '%s'\n", outfilename.cstr());
+ fprintf(stderr, "Fatal error: unable to create file '%s'\n", outfilename.c_str());
goto cleanup;
}
}
- printf("%s file '%s'...\n", write_output ? "Joining" : "Verifying", outfilename.cstr());
+ printf("%s file '%s'...\n", write_output ? "Joining" : "Verifying", outfilename.c_str());
// now iterate through each file
while (core_fgets(buffer, sizeof(buffer), splitfile))
@@ -302,7 +302,7 @@ static int join_file(const char *filename, const char *outname, int write_output
expectedhash.cpy(buffer + 5, SHA1_DIGEST_SIZE * 2);
infilename.cpy(buffer + 5 + SHA1_DIGEST_SIZE * 2 + 6).trimspace();
- printf(" Reading file '%s'...", infilename.cstr());
+ printf(" Reading file '%s'...", infilename.c_str());
// read the file's contents
infilename.ins(0, basepath);
@@ -310,7 +310,7 @@ static int join_file(const char *filename, const char *outname, int write_output
if (filerr != FILERR_NONE)
{
printf("\n");
- fprintf(stderr, "Fatal error: unable to load file '%s'\n", infilename.cstr());
+ fprintf(stderr, "Fatal error: unable to load file '%s'\n", infilename.c_str());
goto cleanup;
}
@@ -321,7 +321,7 @@ static int join_file(const char *filename, const char *outname, int write_output
if (computedhash != expectedhash)
{
printf("\n");
- fprintf(stderr, "Fatal error: file '%s' has incorrect hash\n Expected: %s\n Computed: %s\n", infilename.cstr(), expectedhash.cstr(), computedhash.cstr());
+ fprintf(stderr, "Fatal error: file '%s' has incorrect hash\n Expected: %s\n Computed: %s\n", infilename.c_str(), expectedhash.c_str(), computedhash.c_str());
goto cleanup;
}
diff --git a/src/tools/src2html.c b/src/tools/src2html.c
index 5ebe31ee71f..2f6d1a6ca6a 100644
--- a/src/tools/src2html.c
+++ b/src/tools/src2html.c
@@ -332,7 +332,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring
// create an index file
astring indexname;
- indexname.printf("%s%c%s", dstdir.cstr(), PATH_SEPARATOR[0], "index.html");
+ indexname.printf("%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], "index.html");
core_file *indexfile = create_file_and_output_header(indexname, tempheader, srcdir_subpath);
// output the directory navigation
@@ -402,7 +402,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring
// build the source filename
astring srcfile;
- srcfile.printf("%s%c%s", srcdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr());
+ srcfile.printf("%s%c%s", srcdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str());
// if we have a file, output it
astring dstfile;
@@ -420,9 +420,9 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring
// if we got a valid file, process it
if (type != FILE_TYPE_INVALID)
{
- dstfile.printf("%s%c%s.html", dstdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr());
+ dstfile.printf("%s%c%s.html", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str());
if (indexfile != NULL)
- core_fprintf(indexfile, "\t<li><a href=\"%s.html\">%s</a></li>\n", curlist->name.cstr(), curlist->name.cstr());
+ core_fprintf(indexfile, "\t<li><a href=\"%s.html\">%s</a></li>\n", curlist->name.c_str(), curlist->name.c_str());
result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir == dstdir, tempheader, tempfooter);
}
}
@@ -430,9 +430,9 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring
// if we have a directory, recurse
else
{
- dstfile.printf("%s%c%s", dstdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr());
+ dstfile.printf("%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str());
if (indexfile != NULL)
- core_fprintf(indexfile, "\t<li><a href=\"%s/index.html\">%s/</a></li>\n", curlist->name.cstr(), curlist->name.cstr());
+ core_fprintf(indexfile, "\t<li><a href=\"%s/index.html\">%s/</a></li>\n", curlist->name.c_str(), curlist->name.c_str());
result = recurse_dir(srcrootlen, dstrootlen, srcfile, dstfile, tempheader, tempfooter);
}
}
@@ -467,7 +467,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring &
astring srcfile_subpath;
normalized_subpath(srcfile_subpath, srcfile, srcrootlen + 1);
- fprintf(stderr, "Processing %s\n", srcfile_subpath.cstr());
+ fprintf(stderr, "Processing %s\n", srcfile_subpath.c_str());
// set some defaults
bool color_quotes = false;
@@ -519,7 +519,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring &
core_file *src;
if (core_fopen(srcfile, OPEN_FLAG_READ, &src) != FILERR_NONE)
{
- fprintf(stderr, "Unable to read file '%s'\n", srcfile.cstr());
+ fprintf(stderr, "Unable to read file '%s'\n", srcfile.c_str());
return 1;
}
@@ -527,7 +527,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring &
core_file *dst = create_file_and_output_header(dstfile, tempheader, srcfile_subpath);
if (dst == NULL)
{
- fprintf(stderr, "Unable to write file '%s'\n", dstfile.cstr());
+ fprintf(stderr, "Unable to write file '%s'\n", dstfile.c_str());
core_fclose(src);
return 1;
}
@@ -659,7 +659,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring &
astring target;
if (find_include_file(target, srcrootlen, dstrootlen, srcfile, dstfile, filename))
{
- dstline.catprintf("<a href=\"%s\">", target.cstr());
+ dstline.catprintf("<a href=\"%s\">", target.c_str());
quotes_are_linked = true;
}
}
@@ -738,8 +738,8 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp
// print a header
astring modified(templatefile);
- modified.replace(0, "<!--PATH-->", path.cstr());
- core_fwrite(file, modified.cstr(), modified.len());
+ modified.replace(0, "<!--PATH-->", path.c_str());
+ core_fwrite(file, modified.c_str(), modified.len());
// return the file
return file;
@@ -754,8 +754,8 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp
static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &path)
{
astring modified(templatefile);
- modified.replace(0, "<!--PATH-->", path.cstr());
- core_fwrite(file, modified.cstr(), modified.len());
+ modified.replace(0, "<!--PATH-->", path.c_str());
+ core_fwrite(file, modified.c_str(), modified.len());
core_fclose(file);
}
@@ -807,7 +807,7 @@ static void output_path_as_links(core_file *file, astring &path, bool end_is_dir
core_fprintf(file, "<a href=\"");
for (int depth = curdepth; depth < srcdepth; depth++)
core_fprintf(file, "../");
- core_fprintf(file, "index.html\">%s</a>/", substr.cstr());
+ core_fprintf(file, "index.html\">%s</a>/", substr.c_str());
lastslash = slashindex + 1;
}
@@ -815,11 +815,11 @@ static void output_path_as_links(core_file *file, astring &path, bool end_is_dir
// and a final link to the current directory
astring substr(path, lastslash, -1);
if (end_is_directory)
- core_fprintf(file, "<a href=\"index.html\">%s</a>", substr.cstr());
+ core_fprintf(file, "<a href=\"index.html\">%s</a>", substr.c_str());
else if (link_to_file)
- core_fprintf(file, "<a href=\"%s\">%s</a>", substr.cstr(), substr.cstr());
+ core_fprintf(file, "<a href=\"%s\">%s</a>", substr.c_str(), substr.c_str());
else
- core_fprintf(file, "<a href=\"%s.html\">%s</a>", substr.cstr(), substr.cstr());
+ core_fprintf(file, "<a href=\"%s.html\">%s</a>", substr.c_str(), substr.c_str());
}