aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-12 11:53:32 -0400
committerJack Lloyd <[email protected]>2017-10-12 11:53:32 -0400
commit55f12c897a71c8636df8bc019e09108212048722 (patch)
tree96363b551751a1c4f1c0cc902c243b33fe65f8ea /src/lib/utils
parent39d9e995f49c92d6737d5e641ca306be174a271f (diff)
Avoid std::count to skip a signed overflow warning
Couldn't figure out a way to silence this otherwise. Deprecate replace_char, erase_chars, replace_chars
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/parsing.cpp10
-rw-r--r--src/lib/utils/parsing.h6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index e0173443f..9517cc673 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -13,7 +13,6 @@
#include <botan/loadstor.h>
#include <limits>
#include <set>
-#include <algorithm>
namespace Botan {
@@ -346,7 +345,14 @@ bool host_wildcard_match(const std::string& issued, const std::string& host)
return true;
}
- if(std::count(issued.begin(), issued.end(), '*') > 1)
+ size_t stars = 0;
+ for(char c : issued)
+ {
+ if(c == '*')
+ stars += 1;
+ }
+
+ if(stars > 1)
{
return false;
}
diff --git a/src/lib/utils/parsing.h b/src/lib/utils/parsing.h
index dbf5d426a..1cba23bc3 100644
--- a/src/lib/utils/parsing.h
+++ b/src/lib/utils/parsing.h
@@ -48,7 +48,9 @@ split_on_pred(const std::string& str,
/**
* Erase characters from a string
*/
-BOTAN_PUBLIC_API(2,0) std::string erase_chars(const std::string& str, const std::set<char>& chars);
+BOTAN_PUBLIC_API(2,0)
+BOTAN_DEPRECATED("Unused")
+std::string erase_chars(const std::string& str, const std::set<char>& chars);
/**
* Replace a character in a string
@@ -58,6 +60,7 @@ BOTAN_PUBLIC_API(2,0) std::string erase_chars(const std::string& str, const std:
* @return str with all instances of from_char replaced by to_char
*/
BOTAN_PUBLIC_API(2,0)
+BOTAN_DEPRECATED("Unused")
std::string replace_char(const std::string& str,
char from_char,
char to_char);
@@ -70,6 +73,7 @@ std::string replace_char(const std::string& str,
* @return str with all instances of from_chars replaced by to_char
*/
BOTAN_PUBLIC_API(2,0)
+BOTAN_DEPRECATED("Unused")
std::string replace_chars(const std::string& str,
const std::set<char>& from_chars,
char to_char);