From 3e8f9a6e2c4e9a63050b37fe7f6a5f09b0eee11f Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Fri, 30 Oct 2009 20:08:31 +0000 Subject: XPath: Fixed contains() for broken STL implementations git-svn-id: http://pugixml.googlecode.com/svn/trunk@197 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3