]> git.tdb.fi Git - libs/core.git/blobdiff - source/strings/regex.cpp
Mark constructors and destructors as default where appropriate
[libs/core.git] / source / strings / regex.cpp
index 27361b038b168071cabd98aa45a37e37fb27d9cc..915d33556f17cdd8d4f3a23c48e9a3f5b8343054 100644 (file)
@@ -56,7 +56,6 @@ string bad_regex::make_where(const string &e, const string::const_iterator &i)
 
 Regex::Regex(const string &expr)
 {
-       n_groups = 0;
        auto iter = expr.begin();
        code = compile(expr, iter, n_groups, false);
        ++n_groups;
@@ -130,7 +129,8 @@ Regex::Code Regex::compile(const string &expr, string::const_iterator &iter, uns
 
                        Count repeat_min = 1;
                        Count repeat_max = 1;
-                       parse_repeat(expr, i, repeat_min, repeat_max);
+                       if(i!=end)
+                               parse_repeat(expr, i, repeat_min, repeat_max);
 
                        for(unsigned j=0; j<repeat_min; ++j)
                                result += atom;
@@ -143,7 +143,7 @@ Regex::Code Regex::compile(const string &expr, string::const_iterator &iter, uns
                                        result += atom;
                                }
                                result += ND_JUMP;
-                               write_int<Offset>(-(atom.size()+jump_size), result);
+                               write_int<Offset>(-static_cast<Offset>(atom.size()+jump_size), result);
                        }
                        else if(repeat_max>repeat_min)
                        {