summaryrefslogtreecommitdiffstats
path: root/src/lib/netlist/plib/putil.cpp
diff options
context:
space:
mode:
author Roberto Fresca <robbie@robertofresca.com>2020-06-13 15:58:27 +0200
committer Roberto Fresca <robbie@robertofresca.com>2020-06-13 15:58:27 +0200
commit284f196df1c65a91eb38a5a9f31a2da7fb86a1ac (patch)
treed29473e4024dce305d0ee3bb957a663420417312 /src/lib/netlist/plib/putil.cpp
parent52b8d5fd2b656c317e589da93467c33be74e76ea (diff)
parente949e9c29de82ee7c32692e7b65da05dd22bdc9d (diff)
Merge branch 'master' of https://github.com/mamedev/mame
Diffstat (limited to 'src/lib/netlist/plib/putil.cpp')
-rw-r--r--src/lib/netlist/plib/putil.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp
index 9cc6e5ec9ae..60eab248c9d 100644
--- a/src/lib/netlist/plib/putil.cpp
+++ b/src/lib/netlist/plib/putil.cpp
@@ -3,9 +3,9 @@
#include "putil.h"
#include "penum.h"
+#include "pstream.h"
#include "pstrutil.h"
#include "ptypes.h"
-#include "pstream.h"
#include <algorithm>
#include <cstdlib> // needed for getenv ...
@@ -22,7 +22,7 @@ namespace plib
{
auto p=find_last_of(filename, pstring(PATH_SEPS));
pstring ret = (p == pstring::npos) ? filename : filename.substr(p+1);
- if (suffix != "" && endsWith(ret, suffix))
+ if (!suffix.empty() && endsWith(ret, suffix))
return ret.substr(0, ret.length() - suffix.length());
return ret;
}
@@ -49,7 +49,7 @@ namespace plib
pstring ret = "";
for( const auto &elem : list )
{
- if (ret == "")
+ if (ret.empty())
ret = elem;
else
ret += (PATH_SEP + elem);
@@ -126,7 +126,7 @@ namespace plib
auto i = str.begin();
while (i != str.end())
{
- auto p = static_cast<std::size_t>(-1);
+ auto p = pstring::npos;
for (std::size_t j=0; j < onstrl.size(); j++)
{
if (std::equal(onstrl[j].begin(), onstrl[j].end(), i))
@@ -135,14 +135,14 @@ namespace plib
break;
}
}
- if (p != static_cast<std::size_t>(-1))
+ if (p != pstring::npos)
{
- if (col != "")
+ if (!col.empty())
ret.push_back(col);
col = "";
ret.push_back(onstrl[p]);
- i = std::next(i, static_cast<pstring::difference_type>(onstrl[p].length()));
+ i = std::next(i, narrow_cast<pstring::difference_type>(onstrl[p].length()));
}
else
{
@@ -151,7 +151,7 @@ namespace plib
i++;
}
}
- if (col != "")
+ if (!col.empty())
ret.push_back(col);
return ret;
@@ -170,8 +170,8 @@ namespace plib
return -1;
}
- pstring penum_base::nthstr(int n, const pstring &str)
+ pstring penum_base::nthstr(std::size_t n, const pstring &str)
{
- return psplit(str, ",", false)[static_cast<std::size_t>(n)];
+ return psplit(str, ",", false)[n];
}
} // namespace plib