XPath: xpath_parse_result is now default-initialized to object with failed status
git-svn-id: http://pugixml.googlecode.com/svn/trunk@738 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
d35f6751cf
commit
612fa49d1d
@ -9016,9 +9016,6 @@ namespace pugi
|
|||||||
|
|
||||||
xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables): _alloc(0), _root(0)
|
xpath_query::xpath_query(const char_t* query, xpath_variable_set* variables): _alloc(0), _root(0)
|
||||||
{
|
{
|
||||||
_result.error = 0;
|
|
||||||
_result.offset = 0;
|
|
||||||
|
|
||||||
xpath_allocator* alloc = xpath_allocator::create();
|
xpath_allocator* alloc = xpath_allocator::create();
|
||||||
|
|
||||||
if (!alloc)
|
if (!alloc)
|
||||||
@ -9035,10 +9032,11 @@ namespace pugi
|
|||||||
|
|
||||||
_root = xpath_parser::parse(query, variables, alloc, &_result);
|
_root = xpath_parser::parse(query, variables, alloc, &_result);
|
||||||
|
|
||||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
if (_root)
|
||||||
if (_root) // only store allocator if parsing was a success
|
{
|
||||||
#endif
|
_alloc = static_cast<xpath_allocator*>(alloc_holder.release());
|
||||||
_alloc = static_cast<xpath_allocator*>(alloc_holder.release());
|
_result.error = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9127,7 +9125,9 @@ namespace pugi
|
|||||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||||
return xpath_node_set();
|
return xpath_node_set();
|
||||||
#else
|
#else
|
||||||
xpath_parse_result result = {"Expression does not evaluate to node set", 0};
|
xpath_parse_result result;
|
||||||
|
result.error = "Expression does not evaluate to node set";
|
||||||
|
|
||||||
throw xpath_exception(result);
|
throw xpath_exception(result);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1775,6 +1775,10 @@ namespace pugi
|
|||||||
/// Last parsed offset (in characters from string start)
|
/// Last parsed offset (in characters from string start)
|
||||||
ptrdiff_t offset;
|
ptrdiff_t offset;
|
||||||
|
|
||||||
|
xpath_parse_result(): error("Internal error"), offset(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Cast to bool operator
|
/// Cast to bool operator
|
||||||
operator bool() const
|
operator bool() const
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user