diff options
author | simon@lindenlab.com <simon@lindenlab.com> | 2011-06-27 10:15:24 -0700 |
---|---|---|
committer | simon@lindenlab.com <simon@lindenlab.com> | 2011-06-27 10:15:24 -0700 |
commit | d40bd76ec76bf7d2fa59d15f5c71125c9813f31e (patch) | |
tree | 5e47be32903db5e8ff5520bd7ec46aad2f43adad /indra/llvfs/lldiriterator.cpp | |
parent | 398019ffb2a036813c6c89a677e9534faa178330 (diff) | |
parent | 5c9fc7d24f0d060bcb86ed5b03cb9ba9c7282038 (diff) |
Merge viewer 2.7.6 from trunk
Diffstat (limited to 'indra/llvfs/lldiriterator.cpp')
-rw-r--r-- | indra/llvfs/lldiriterator.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 041436ed92..25550321f0 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -121,6 +121,14 @@ bool LLDirIterator::Impl::next(std::string &fname) return found; } +/** +Converts the incoming glob into a regex. This involves +converting incoming glob expressions to regex equivilents and +at the same time, escaping any regex meaningful characters which +do not have glob meaning, i.e. + .()+|^$ +in the input. +*/ std::string glob_to_regex(const std::string& glob) { std::string regex; @@ -135,9 +143,6 @@ std::string glob_to_regex(const std::string& glob) switch (c) { - case '.': - regex+="\\."; - break; case '*': if (glob.begin() == i) { @@ -170,8 +175,16 @@ std::string glob_to_regex(const std::string& glob) case '!': regex+= square_brace_open ? '^' : c; break; + case '.': // This collection have different regex meaning + case '^': // and so need escaping. + case '(': + case ')': + case '+': + case '|': + case '$': + regex += '\\'; default: - regex+=c; + regex += c; break; } |