summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:16:02 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:16:02 +0000
commit6a9d59e90717c3ce8eae19e562b01c4125934681 (patch)
tree99e08fc3d26b78d1768dc4c4b09c53ef13811fe1 /src
parent3284cc2f1b9508ae4708c4e95e7b92c836682b79 (diff)
XPath: Final MinGW unwind workaround
git-svn-id: http://pugixml.googlecode.com/svn/trunk@650 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r--src/pugixpath.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index e866c4f..1e20d8c 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -514,9 +514,17 @@ namespace
else
{
// need to make dummy on-heap copy
- string_t copy(begin, end);
+ char_t* copy = static_cast<char_t*>(get_memory_allocation_function()((length + 1) * sizeof(char_t)));
+ if (!copy) return gen_nan(); // $$ out of memory
- return convert_string_to_number(copy.c_str());
+ memcpy(copy, begin, length * sizeof(char_t));
+ copy[length] = 0;
+
+ double result = convert_string_to_number(copy);
+
+ get_memory_deallocation_function()(copy);
+
+ return result;
}
}