|
a/src/utils/strmatcher.cpp |
|
b/src/utils/strmatcher.cpp |
|
... |
|
... |
26 |
using std::string;
|
26 |
using std::string;
|
27 |
|
27 |
|
28 |
#include "cstr.h"
|
28 |
#include "cstr.h"
|
29 |
#include "debuglog.h"
|
29 |
#include "debuglog.h"
|
30 |
#include "strmatcher.h"
|
30 |
#include "strmatcher.h"
|
|
|
31 |
#include "pathut.h"
|
31 |
|
32 |
|
32 |
bool StrWildMatcher::match(const string& val) const
|
33 |
bool StrWildMatcher::match(const string& val) const
|
33 |
{
|
34 |
{
|
34 |
LOGDEB2(("StrWildMatcher::match: [%s] against [%s]\n",
|
35 |
LOGDEB2(("StrWildMatcher::match: [%s] against [%s]\n",
|
35 |
m_sexp.c_str(), val.c_str()));
|
36 |
m_sexp.c_str(), val.c_str()));
|
36 |
int ret = fnmatch(m_sexp.c_str(), val.c_str(), FNM_NOESCAPE);
|
37 |
int ret = fnmatch(m_sexp.c_str(), val.c_str(), FNM_NOESCAPE);
|
37 |
switch (ret) {
|
38 |
switch (ret) {
|
38 |
case 0: return true;
|
39 |
case 0: return true;
|
39 |
case FNM_NOMATCH: return false;
|
40 |
case FNM_NOMATCH: return false;
|
40 |
default:
|
41 |
default:
|
41 |
LOGDEB0(("StrWildMatcher::match error: [%s] against [%s]\n",
|
42 |
LOGINFO(("StrWildMatcher::match:err: e [%s] s [%s] (%s) ret %d\n",
|
42 |
m_sexp.c_str(), val.c_str()));
|
43 |
m_sexp.c_str(), val.c_str(),
|
|
|
44 |
url_encode(val).c_str(), ret));
|
43 |
return false;
|
45 |
return false;
|
44 |
}
|
46 |
}
|
45 |
}
|
47 |
}
|
46 |
|
48 |
|
47 |
string::size_type StrWildMatcher::baseprefixlen() const
|
49 |
string::size_type StrWildMatcher::baseprefixlen() const
|