From 3e1ae89cf6f750ac088a3b73ed6ef1559e2d436f Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 24 Nov 2014 18:27:54 -0800 Subject: tests: Add a test for load_file with wide Unicode name --- "tests/data/\321\202\320\265\321\201\321\202.xml" | 1 + tests/test_document.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 "tests/data/\321\202\320\265\321\201\321\202.xml" diff --git "a/tests/data/\321\202\320\265\321\201\321\202.xml" "b/tests/data/\321\202\320\265\321\201\321\202.xml" new file mode 100644 index 0000000..6187c16 --- /dev/null +++ "b/tests/data/\321\202\320\265\321\201\321\202.xml" @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 4228602..5991937 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -323,6 +323,16 @@ TEST(document_load_file_wide_ascii) CHECK_NODE(doc, STR("")); } +#if !defined(__DMC__) && !defined(__MWERKS__) +TEST(document_load_file_wide_unicode) +{ + pugi::xml_document doc; + + CHECK(doc.load_file(L"tests/data/\x0442\x0435\x0441\x0442.xml")); + CHECK_NODE(doc, STR("")); +} +#endif + TEST(document_load_file_wide_out_of_memory) { test_runner::_memory_fail_threshold = 1; -- cgit v1.2.3 From b7a1feccf79f953b107696841d66666cba5fa8e4 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 24 Nov 2014 20:49:12 -0800 Subject: Use _wfopen and fseeko64 on MinGW in C++11 mode Since MinGW 4.5 does not define these functions if __STRICT_ANSI__ is defined (in case of _wfopen it defines it inconsistently between stdio.h and wchar.h) use the baseline functions for MinGW 4.5 and earlier. Fixes #23. --- src/pugixml.cpp | 4 ++-- tests/test_document.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index ff84d44..b8847a4 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3995,7 +3995,7 @@ PUGI__NS_BEGIN _fseeki64(file, 0, SEEK_END); length_type length = _ftelli64(file); _fseeki64(file, 0, SEEK_SET); - #elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && !defined(__STRICT_ANSI__) + #elif defined(__MINGW32__) && !defined(__NO_MINGW_LFS) && !(defined(__STRICT_ANSI__) && __GNUC__ * 100 + __GNUC_MINOR__ <= 405) // there are 64-bit versions of fseek/ftell, let's use them typedef off64_t length_type; @@ -4240,7 +4240,7 @@ PUGI__NS_BEGIN } #endif -#if defined(PUGI__MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && !defined(__STRICT_ANSI__)) +#if defined(PUGI__MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && !(defined(__STRICT_ANSI__) && __GNUC__ * 100 + __GNUC_MINOR__ <= 405)) PUGI__FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode) { return _wfopen(path, mode); diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 5991937..f57465f 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -323,7 +323,7 @@ TEST(document_load_file_wide_ascii) CHECK_NODE(doc, STR("")); } -#if !defined(__DMC__) && !defined(__MWERKS__) +#if !defined(__DMC__) && !defined(__MWERKS__) && !(defined(__MINGW32__) && defined(__STRICT_ANSI__) && __GNUC__ * 100 + __GNUC_MINOR__ <= 405) TEST(document_load_file_wide_unicode) { pugi::xml_document doc; -- cgit v1.2.3 From 7eaf0670d9e4623c0c6897eb7e1167c45a8a08f8 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 25 Nov 2014 18:23:36 -0800 Subject: docs: Update changelog to mention MinGW load_file fix --- docs/manual.html | 2 +- docs/manual.qbk | 1 + docs/manual/changes.html | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/manual.html b/docs/manual.html index 64c1c90..0eb13b9 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -184,7 +184,7 @@ pugixml - +

Last revised: November 18, 2014 at 17:25:31 GMT

Last revised: November 26, 2014 at 02:23:21 GMT


diff --git a/docs/manual.qbk b/docs/manual.qbk index b703948..20305cf 100644 --- a/docs/manual.qbk +++ b/docs/manual.qbk @@ -1922,6 +1922,7 @@ Major release, featuring a lot of performance improvements and some new features * Bug fixes # Adjusted comment output to avoid malformed documents if the comment value contains "--" # Fix XPath sorting for documents that were constructed using append_buffer + # Fix load_file for wide-character paths with non-ASCII characters in MinGW with C++11 mode enabled [h5 27.02.2014 - version 1.4] diff --git a/docs/manual/changes.html b/docs/manual/changes.html index 05891a7..a3495b2 100644 --- a/docs/manual/changes.html +++ b/docs/manual/changes.html @@ -126,6 +126,10 @@
  • Fix XPath sorting for documents that were constructed using append_buffer
  • +
  • + Fix load_file for wide-character paths with non-ASCII characters + in MinGW with C++11 mode enabled +
  • -- cgit v1.2.3 From 10c9206de2ae4079ca1239ff44cee3fdb1deadf5 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 27 Nov 2014 00:12:42 -0800 Subject: Update version number in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d8263d..71eaede 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ pugixml is used by a lot of projects, both open-source and proprietary, for perf Documentation for the current release of pugixml is available on-line as two separate documents: -* [Quick-start guide](http://cdn.rawgit.com/zeux/pugixml/v1.4/docs/quickstart.html), that aims to provide enough information to start using the library; -* [Complete reference manual](http://cdn.rawgit.com/zeux/pugixml/v1.4/docs/manual.html), that describes all features of the library in detail. +* [Quick-start guide](http://cdn.rawgit.com/zeux/pugixml/v1.5/docs/quickstart.html), that aims to provide enough information to start using the library; +* [Complete reference manual](http://cdn.rawgit.com/zeux/pugixml/v1.5/docs/manual.html), that describes all features of the library in detail. You’re advised to start with the quick-start guide; however, many important library features are either not described in it at all or only mentioned briefly; if you require more information you should read the complete manual. -- cgit v1.2.3