diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-11-04 16:12:44 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-11-04 16:12:44 -0700 |
| commit | 0d108d37f64b7fe6d7f42632b67cab6e1a200ba5 (patch) | |
| tree | 42c60cd4298641ee546c2c873e269e1291c5c441 /controller/JSONDB.hpp | |
| parent | cae9041c2a656431cbcd69128a7f0dba5a856b04 (diff) | |
| download | infinitytier-0d108d37f64b7fe6d7f42632b67cab6e1a200ba5.tar.gz infinitytier-0d108d37f64b7fe6d7f42632b67cab6e1a200ba5.zip | |
.
Diffstat (limited to 'controller/JSONDB.hpp')
| -rw-r--r-- | controller/JSONDB.hpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/controller/JSONDB.hpp b/controller/JSONDB.hpp index e33cd768..61735655 100644 --- a/controller/JSONDB.hpp +++ b/controller/JSONDB.hpp @@ -19,6 +19,9 @@ #ifndef ZT_JSONDB_HPP #define ZT_JSONDB_HPP +#include <stdlib.h> +#include <string.h> + #include <string> #include <map> #include <stdexcept> @@ -75,7 +78,7 @@ public: inline void filter(const std::string &prefix,unsigned long maxSinceCheck,F func) { for(std::map<std::string,_E>::iterator i(_db.lower_bound(prefix));i!=_db.end();) { - if (i->first.substr(0,prefix.length()) == prefix) { + if ((i->first.length() >= prefix.length())&&(!memcmp(i->first.data(),prefix.data(),prefix.length()))) { if (!func(i->first,get(i->second.obj,maxSinceCheck))) { std::map<std::string,_E>::iterator i2(i); ++i2; this->erase(i->first); |
