X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fregex.cpp;h=320705e8e33dc1cecbca03a26adab78e9d498805;hp=ae3576ce5423930c4cfb225a51fbe42f649d3141;hb=df1a66180655104af15f9bb6067b4eaa1421f5ff;hpb=c88a239ff3b218ad0226e8c53356350ccc1f7014 diff --git a/source/regex.cpp b/source/regex.cpp index ae3576c..320705e 100644 --- a/source/regex.cpp +++ b/source/regex.cpp @@ -11,8 +11,6 @@ Distributed under the LGPL using namespace std; -#include - namespace { /** @@ -309,14 +307,14 @@ Regex::Code Regex::parse_brackets(const string &str, string::const_iterator &ite } string::const_iterator end=iter; - for(; (end!=str.end() && *end!=']'); ++end); + for(; (end!=str.end() && (end==iter || *end!=']')); ++end); if(end==str.end()) throw InvalidParameterValue("Unmatched '['"); uint8_t mask[32]={0}; unsigned type=0; bool range=false; - unsigned char first, last; + unsigned char first=0, last=0; for(string::const_iterator i=iter; i!=end; ++i) { unsigned char c=*i; @@ -502,7 +500,7 @@ bool Regex::group_compare(const RegMatch::Group &g1, const RegMatch::Group &g2) { if(!g1.match) return false; - + // Any match is better than no match if(!g2.match) return true;