diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-30 20:08:31 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-30 20:08:31 +0000 |
commit | 3e8f9a6e2c4e9a63050b37fe7f6a5f09b0eee11f (patch) | |
tree | 0577c4690e3035b68649a8963cc0954b162b8e91 /src | |
parent | 53468284883030fff8667fee67c3ba73b8f2c260 (diff) |
XPath: Fixed contains() for broken STL implementations
git-svn-id: http://pugixml.googlecode.com/svn/trunk@197 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r-- | src/pugixpath.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index 34f1cfe..051d3b6 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -1930,7 +1930,12 @@ namespace pugi return starts_with(m_left->eval_string(c), m_right->eval_string(c).c_str());
case ast_func_contains:
- return m_left->eval_string(c).find(m_right->eval_string(c)) != std::string::npos;
+ {
+ std::string lr = m_left->eval_string(c);
+ std::string rr = m_right->eval_string(c);
+
+ return rr.empty() || lr.find(rr) != std::string::npos;
+ }
case ast_func_boolean:
return m_left->eval_boolean(c);
|