diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/util/astring.h | 12 | ||||
-rw-r--r-- | src/lib/util/cdrom.c | 2 | ||||
-rw-r--r-- | src/lib/util/chd.h | 2 | ||||
-rw-r--r-- | src/lib/util/chdcd.c | 14 | ||||
-rw-r--r-- | src/lib/util/options.c | 16 | ||||
-rw-r--r-- | src/lib/util/options.h | 2 |
6 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h index 0851aa0c006..14f26cb3990 100644 --- a/src/lib/util/astring.h +++ b/src/lib/util/astring.h @@ -74,7 +74,7 @@ public: // C string conversion operators and helpers operator const char *() const { return m_text; } - const char *cstr() const { return m_text; } + const char *c_str() const { return m_text; } // buffer management astring &reset() { return cpy(""); } @@ -86,19 +86,19 @@ public: // copy helpers astring &cpy(const char *src, int count); astring &cpysubstr(const astring &src, int start, int count = -1); - astring &cpy(const astring &src) { return cpy(src.cstr(), src.len()); } + astring &cpy(const astring &src) { return cpy(src.c_str(), src.len()); } astring &cpy(const char *src) { return cpy(src, strlen(src)); } // insertion helpers astring &ins(int insbefore, const char *src, int count); astring &inssubstr(int insbefore, const astring &src, int start, int count = -1); - astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.cstr(), src.len()); } + astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.c_str(), src.len()); } astring &ins(int insbefore, const char *src) { return ins(insbefore, src, strlen(src)); } // concatenation helpers (== insert at end) astring &cat(const char *src, int count) { return ins(-1, src, count); } astring &catsubstr(const astring &src, int start, int count = -1) { return inssubstr(-1, src, start, count); } - astring &cat(const astring &src) { return ins(-1, src.cstr(), src.len()); } + astring &cat(const astring &src) { return ins(-1, src.c_str(), src.len()); } astring &cat(const char *src) { return ins(-1, src, strlen(src)); } astring &cat(char ch) { return ins(-1, &ch, 1); } @@ -117,13 +117,13 @@ public: // comparison helpers int cmp(const char *str2, int count) const; int cmpsubstr(const astring &str2, int start, int count = -1) const; - int cmp(const astring &str2) const { return cmp(str2.cstr(), str2.len()); } + int cmp(const astring &str2) const { return cmp(str2.c_str(), str2.len()); } int cmp(const char *str2) const { return cmp(str2, strlen(str2)); } // case-insensitive comparison helpers int icmp(const char *str2, int count) const; int icmpsubstr(const astring &str2, int start, int count = -1) const; - int icmp(const astring &str2) const { return icmp(str2.cstr(), str2.len()); } + int icmp(const astring &str2) const { return icmp(str2.c_str(), str2.len()); } int icmp(const char *str2) const { return icmp(str2, strlen(str2)); } // character searching helpers diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c index 90024420555..e747261c74f 100644 --- a/src/lib/util/cdrom.c +++ b/src/lib/util/cdrom.c @@ -164,7 +164,7 @@ cdrom_file *cdrom_open(const char *inputfile) file_error filerr = core_fopen(file->track_info.track[i].fname, OPEN_FLAG_READ, &file->fhandle[i]); if (filerr != FILERR_NONE) { - fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.cstr()); + fprintf(stderr, "Unable to open file: %s\n", file->track_info.track[i].fname.c_str()); cdrom_close(file); return NULL; } diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h index 7f2196267ab..a04b8cff2ff 100644 --- a/src/lib/util/chd.h +++ b/src/lib/util/chd.h @@ -352,7 +352,7 @@ public: chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen); chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags); chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags = CHD_MDFLAGS_CHECKSUM); - chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.cstr(), input.len() + 1, flags); } + chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.len() + 1, flags); } chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input, input.count(), flags); } chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex); chd_error clone_all_metadata(chd_file &source); diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c index 0e6077dd70f..244c900bc28 100644 --- a/src/lib/util/chdcd.c +++ b/src/lib/util/chdcd.c @@ -695,7 +695,7 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_ #if 0 for(i=0; i < numtracks; i++) { - printf("%s %d %d %d (true %d)\n", outinfo.track[i].fname.cstr(), outtoc.tracks[i].frames, outtoc.tracks[i].padframes, outtoc.tracks[i].physframeofs, outtoc.tracks[i].frames - outtoc.tracks[i].padframes); + printf("%s %d %d %d (true %d)\n", outinfo.track[i].fname.c_str(), outtoc.tracks[i].frames, outtoc.tracks[i].padframes, outtoc.tracks[i].physframeofs, outtoc.tracks[i].frames - outtoc.tracks[i].padframes); } #endif @@ -771,7 +771,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i wavlen = parse_wav_sample(lastfname, &wavoffs); if (!wavlen) { - printf("ERROR: couldn't read [%s] or not a valid .WAV\n", lastfname.cstr()); + printf("ERROR: couldn't read [%s] or not a valid .WAV\n", lastfname.c_str()); return CHDERR_INVALID_DATA; } } @@ -812,7 +812,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i outinfo.track[trknum].fname.cpy(lastfname); // default filename to the last one -// printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.cstr(), outinfo.track[trknum].offset); +// printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.c_str(), outinfo.track[trknum].offset); cdrom_convert_type_string_to_track_info(token, &outtoc.tracks[trknum]); if (outtoc.tracks[trknum].datasize == 0) @@ -927,10 +927,10 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i /* if we have the same filename as the last track, do it that way */ if (trknum != 0 && outinfo.track[trknum].fname == outinfo.track[trknum-1].fname) { - tlen = get_file_size(outinfo.track[trknum].fname.cstr()); + tlen = get_file_size(outinfo.track[trknum].fname.c_str()); if (tlen == 0) { - printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.cstr()); + printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); return CHDERR_FILE_NOT_FOUND; } outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); @@ -941,7 +941,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i tlen = get_file_size(outinfo.track[trknum].fname); if (tlen == 0) { - printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.cstr()); + printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); return CHDERR_FILE_NOT_FOUND; } tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); @@ -976,7 +976,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i tlen = get_file_size(outinfo.track[trknum].fname); if (tlen == 0) { - printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.cstr()); + printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.c_str()); return CHDERR_FILE_NOT_FOUND; } tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); diff --git a/src/lib/util/options.c b/src/lib/util/options.c index ba580c9ee3a..dc3f69933fc 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -364,7 +364,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri // can only have one command if (m_command) { - error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.cstr(), curarg); + error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg); return false; } m_command = curentry->name(); @@ -635,14 +635,14 @@ bool core_options::set_value(const char *name, int value, int priority, astring { astring tempstr; tempstr.printf("%d", value); - return set_value(name, tempstr.cstr(), priority, error_string); + return set_value(name, tempstr.c_str(), priority, error_string); } bool core_options::set_value(const char *name, float value, int priority, astring &error_string) { astring tempstr; tempstr.printf("%f", value); - return set_value(name, tempstr.cstr(), priority, error_string); + return set_value(name, tempstr.c_str(), priority, error_string); } @@ -752,7 +752,7 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_BOOLEAN: if (sscanf(data, "%d", &ival) != 1 || ival < 0 || ival > 1) { - error_string.catprintf("Illegal boolean value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.cstr(), curentry.value()); + error_string.catprintf("Illegal boolean value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } break; @@ -761,12 +761,12 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_INTEGER: if (sscanf(data, "%d", &ival) != 1) { - error_string.catprintf("Illegal integer value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.cstr(), curentry.value()); + error_string.catprintf("Illegal integer value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } if (curentry.has_range() && (ival < atoi(curentry.minimum()) || ival > atoi(curentry.maximum()))) { - error_string.catprintf("Out-of-range integer value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.cstr(), curentry.minimum(), curentry.maximum(), curentry.value()); + error_string.catprintf("Out-of-range integer value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); return false; } break; @@ -775,12 +775,12 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_FLOAT: if (sscanf(data, "%f", &fval) != 1) { - error_string.catprintf("Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.cstr(), curentry.value()); + error_string.catprintf("Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } if (curentry.has_range() && (fval < atof(curentry.minimum()) || fval > atof(curentry.maximum()))) { - error_string.catprintf("Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.cstr(), curentry.minimum(), curentry.maximum(), curentry.value()); + error_string.catprintf("Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); return false; } break; diff --git a/src/lib/util/options.h b/src/lib/util/options.h index 8c1f80bea93..941d3c7df70 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -75,7 +75,7 @@ public: public: // getters entry *next() const { return m_next; } - const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && m_name[index]) ? m_name[index].cstr() : NULL; } + const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && m_name[index]) ? m_name[index].c_str() : NULL; } const char *description() const { return m_description; } const char *value() const { return m_data; } const char *default_value() const { return m_defdata; } |