From 79fb68ac4177206e063f8f29113abbe82ac49698 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 10 Feb 2014 16:57:04 +0000 Subject: Use a null-terminated buffer for parsing as often as possible. Parsing used to work on a non null-terminated buffer, inserting a fake null terminator to increase performance. This makes it impossible to implement fragment parsing that preserves PCDATA contents (as witnessed by some tests for boundary conditions that actually depended on this behavior). Since almost all uses result in us allocating an internal buffer anyway, the new policy is to make sure all buffers that are allocated by pugixml are null-terminated - the only exception now is external calls to load_buffer_inplace that don't trigger encoding conversion. git-svn-id: https://pugixml.googlecode.com/svn/trunk@977 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_parse.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/test_parse.cpp') diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index 9a8bdf1..c165a65 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -313,12 +313,12 @@ TEST(parse_ws_pcdata_permutations) // current implementation of parse_ws_pcdata_single has an unfortunate bug; reproduce it here {4, STR("\t\t\n\n"), STR("\n\n"), 3}, // error case: terminate PCDATA in the middle - {7, STR("abcdef"), STR("abcde"), -3}, - {7, STR(" "), STR(" "), -3}, + {7, STR("abcdef"), STR("abcdef"), -3}, + {7, STR(" "), STR(" "), -3}, // error case: terminate PCDATA as early as possible {7, STR(""), STR(""), -2}, - {7, STR("a"), STR(""), -2}, - {7, STR(" "), STR(""), -2}, + {7, STR("a"), STR("a"), -3}, + {7, STR(" "), STR(" "), -3}, }; for (size_t i = 0; i < sizeof(test_data) / sizeof(test_data[0]); ++i) @@ -805,7 +805,7 @@ TEST(parse_error_offset) CHECK_OFFSET("<3d/>", parse_default, status_unrecognized_tag, 1); CHECK_OFFSET(" <3d/>", parse_default, status_unrecognized_tag, 2); - CHECK_OFFSET(" <", parse_default, status_unrecognized_tag, 2); + CHECK_OFFSET(" <", parse_default, status_unrecognized_tag, 1); CHECK_OFFSET("