summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/astring.h5
-rw-r--r--src/lib/util/chdcd.c4
-rw-r--r--src/lib/util/options.c4
-rw-r--r--src/lib/util/options.h4
4 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h
index b17ae17076d..1988f73840d 100644
--- a/src/lib/util/astring.h
+++ b/src/lib/util/astring.h
@@ -65,8 +65,8 @@ public:
char operator[](int index) const { return (index < len()) ? m_text[index] : 0; }
// implicit boolean conversion operators
- operator bool() { return m_text[0] != 0; }
- operator bool() const { return m_text[0] != 0; }
+ //operator bool() { return m_text[0] != 0; }
+ //operator bool() const { return m_text[0] != 0; }
// C string conversion operators and helpers
const char *c_str() const { return m_text; }
@@ -77,6 +77,7 @@ public:
// length query
int len() const { return m_len; }
+ bool empty() const { return m_len==0; }
// copy helpers
astring &cpy(const char *src, int count);
diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c
index 0720a6b9aa0..bd2cf2a3837 100644
--- a/src/lib/util/chdcd.c
+++ b/src/lib/util/chdcd.c
@@ -925,7 +925,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
if (trknum == (outtoc.numtrks-1))
{
/* 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)
+ if (trknum != 0 && (outinfo.track[trknum].fname.cmp(outinfo.track[trknum-1].fname)==0))
{
tlen = get_file_size(outinfo.track[trknum].fname.c_str());
if (tlen == 0)
@@ -952,7 +952,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i
else
{
/* if we have the same filename as the next track, do it that way */
- if (outinfo.track[trknum].fname == outinfo.track[trknum+1].fname)
+ if (outinfo.track[trknum].fname.cmp(outinfo.track[trknum+1].fname)==0)
{
outtoc.tracks[trknum].frames = outinfo.track[trknum+1].idx0offs - outinfo.track[trknum].idx0offs;
diff --git a/src/lib/util/options.c b/src/lib/util/options.c
index f5beddf1d71..3ba8956eb3f 100644
--- a/src/lib/util/options.c
+++ b/src/lib/util/options.c
@@ -362,7 +362,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri
if (curentry->type() == OPTION_COMMAND)
{
// can only have one command
- if (m_command)
+ if (!m_command.empty())
{
error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg);
return false;
@@ -701,7 +701,7 @@ void core_options::remove_entry(core_options::entry &delentry)
{
// remove all names from the map
for (int name = 0; name < ARRAY_LENGTH(delentry.m_name); name++)
- if (delentry.m_name[name])
+ if (!delentry.m_name[name].empty())
m_entrymap.remove(delentry.m_name[name].c_str());
// remove the entry from the list
diff --git a/src/lib/util/options.h b/src/lib/util/options.h
index 1b9528ff433..dafd2214dab 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].c_str() : NULL; }
+ const char *name(int index = 0) const { return (index < ARRAY_LENGTH(m_name) && !m_name[index].empty()) ? m_name[index].c_str() : NULL; }
const char *description() const { return m_description; }
const char *value() const { return m_data.c_str(); }
const char *default_value() const { return m_defdata.c_str(); }
@@ -87,7 +87,7 @@ public:
bool is_header() const { return type() == OPTION_HEADER; }
bool is_command() const { return type() == OPTION_COMMAND; }
bool is_internal() const { return m_flags & OPTION_FLAG_INTERNAL; }
- bool has_range() const { return (m_minimum && m_maximum); }
+ bool has_range() const { return (!m_minimum.empty() && !m_maximum.empty()); }
int priority() const { return m_priority; }
// setters