From fdc03d39abdeeeadc7e0d47b49462464ffa3cd85 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Tue, 6 Mar 2012 06:13:10 +0000 Subject: tests: Fixed compilation errors for BadaSDK git-svn-id: http://pugixml.googlecode.com/svn/trunk@839 99668b35-9821-0410-8761-19e4c4f06640 --- tests/writer_string.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/writer_string.cpp') diff --git a/tests/writer_string.cpp b/tests/writer_string.cpp index f35b461..1b94d20 100644 --- a/tests/writer_string.cpp +++ b/tests/writer_string.cpp @@ -27,7 +27,8 @@ std::wstring xml_writer_string::as_wide() const { CHECK(contents.size() % sizeof(wchar_t) == 0); - return std::wstring(reinterpret_cast(contents.data()), contents.size() / sizeof(wchar_t)); + // round-trip pointer through void* to avoid pointer alignment warnings; contents data should be heap allocated => safe to cast + return std::wstring(static_cast(static_cast(contents.data())), contents.size() / sizeof(wchar_t)); } std::basic_string xml_writer_string::as_string() const @@ -36,7 +37,8 @@ std::basic_string xml_writer_string::as_string() const CHECK(contents.size() % sizeof(pugi::char_t) == 0); #endif - return std::basic_string(reinterpret_cast(contents.data()), contents.size() / sizeof(pugi::char_t)); + // round-trip pointer through void* to avoid pointer alignment warnings; contents data should be heap allocated => safe to cast + return std::basic_string(static_cast(static_cast(contents.data())), contents.size() / sizeof(pugi::char_t)); } std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding) -- cgit v1.2.3