From 6a9d59e90717c3ce8eae19e562b01c4125934681 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 29 Aug 2010 15:16:02 +0000 Subject: XPath: Final MinGW unwind workaround git-svn-id: http://pugixml.googlecode.com/svn/trunk@650 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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(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; } } -- cgit v1.2.3