summaryrefslogtreecommitdiff
path: root/src/utility
diff options
context:
space:
mode:
authorAndrzej Rybczak <electricityispower@gmail.com>2012-09-08 00:28:02 +0200
committerAndrzej Rybczak <electricityispower@gmail.com>2012-09-08 00:29:18 +0200
commita26b1f62f969296e26adcfcf7a0be584f3cd2d39 (patch)
treee741156c082819b905ecec48539e3336579cc887 /src/utility
parent45a097a45beb7fbe4c99309bfcb985e97cf01107 (diff)
actions: implement filtering playlist on priorities
Diffstat (limited to 'src/utility')
-rw-r--r--src/utility/string.cpp4
-rw-r--r--src/utility/string.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/utility/string.cpp b/src/utility/string.cpp
index 527a694d..d75806b5 100644
--- a/src/utility/string.cpp
+++ b/src/utility/string.cpp
@@ -33,13 +33,13 @@ long stringToLongInt(const std::string &s)
return atol(s.c_str());
}
-bool isInteger(const char *s)
+bool isInteger(const char *s, bool accept_signed)
{
assert(s);
if (*s == '\0')
return false;
for (const char *it = s; *it != '\0'; ++it)
- if (!isdigit(*it) && (it != s || *it != '-'))
+ if (!(isdigit(*it) || (accept_signed && it == s && *it == '-')))
return false;
return true;
}
diff --git a/src/utility/string.h b/src/utility/string.h
index 94a7a783..902d120f 100644
--- a/src/utility/string.h
+++ b/src/utility/string.h
@@ -54,7 +54,7 @@ template <size_t N> struct print<N, std::wstring> {
int stringToInt(const std::string &s);
long stringToLongInt(const std::string &s);
-bool isInteger(const char *s);
+bool isInteger(const char *s, bool accept_signed);
std::string ToString(const std::wstring &ws);
std::wstring ToWString(const std::string &s);