diff options
author | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-03-06 06:13:10 +0000 |
---|---|---|
committer | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-03-06 06:13:10 +0000 |
commit | fdc03d39abdeeeadc7e0d47b49462464ffa3cd85 (patch) | |
tree | 85aa7269e5861132898494984f415b430a19338d /tests/writer_string.cpp | |
parent | 6e02258ef6fc8c99f949ba0ed7617d006725d3b5 (diff) |
tests: Fixed compilation errors for BadaSDK
git-svn-id: http://pugixml.googlecode.com/svn/trunk@839 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/writer_string.cpp')
-rw-r--r-- | tests/writer_string.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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<const wchar_t*>(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<const wchar_t*>(static_cast<const void*>(contents.data())), contents.size() / sizeof(wchar_t)); } std::basic_string<pugi::char_t> xml_writer_string::as_string() const @@ -36,7 +37,8 @@ std::basic_string<pugi::char_t> xml_writer_string::as_string() const CHECK(contents.size() % sizeof(pugi::char_t) == 0); #endif - return std::basic_string<pugi::char_t>(reinterpret_cast<const pugi::char_t*>(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<pugi::char_t>(static_cast<const pugi::char_t*>(static_cast<const void*>(contents.data())), contents.size() / sizeof(pugi::char_t)); } std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding) |