0
0
mirror of https://github.com/zeux/pugixml.git synced 2025-01-17 04:50:23 +08:00

Move zero-termination out of as_utf8_end

as_utf8_end was used with std::string, where writing an extra zero-terminating
character should *probably* always work (at least if size is positive) but is
not ideal.

The only place that needed to zero-terminate was convert_path_heap.
This commit is contained in:
Arseny Kapoulkine 2015-04-12 01:32:25 -07:00
parent 3da7d68617
commit 99afee1832

View File

@ -1691,9 +1691,6 @@ PUGI__NS_BEGIN
assert(begin + size == end);
(void)!end;
// zero-terminate
buffer[size] = 0;
}
#ifndef PUGIXML_NO_STL
@ -4295,6 +4292,9 @@ PUGI__NS_BEGIN
// second pass: convert to utf8
as_utf8_end(result, size, str, length);
// zero-terminate
result[size] = 0;
return result;
}