From dce23675249bef3e2663f2d8eb0643f33ef5e4e9 Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Sun, 30 Oct 2016 21:44:43 -0400 Subject: [PATCH] fix clang build --- source/detail/vector_streambuf.hpp | 2 +- source/workbook/tests/test_consume_xlsx.hpp | 2 +- tests/helpers/xml_helper.hpp | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source/detail/vector_streambuf.hpp b/source/detail/vector_streambuf.hpp index f7840032..8189cebd 100644 --- a/source/detail/vector_streambuf.hpp +++ b/source/detail/vector_streambuf.hpp @@ -153,7 +153,7 @@ private: else { auto position_size = data_.size(); - auto required_size = static_cast(position_ + n); + auto required_size = static_cast(position_ + static_cast(n)); data_.resize(std::max(position_size, required_size)); } diff --git a/source/workbook/tests/test_consume_xlsx.hpp b/source/workbook/tests/test_consume_xlsx.hpp index 4f388e69..4844e3cd 100644 --- a/source/workbook/tests/test_consume_xlsx.hpp +++ b/source/workbook/tests/test_consume_xlsx.hpp @@ -7,7 +7,7 @@ #include #include -#define TEST_CRYPTO false +#define TEST_CRYPTO true #ifndef TEST_CRYPTO #define TEST_CRYPTO false diff --git a/tests/helpers/xml_helper.hpp b/tests/helpers/xml_helper.hpp index 6538569d..d6632de3 100644 --- a/tests/helpers/xml_helper.hpp +++ b/tests/helpers/xml_helper.hpp @@ -302,18 +302,20 @@ public: delete stream; return compare_files(expected, contents, content_type); } - - static bool file_matches_archive_member(const xlnt::path &file, + + static bool file_matches_archive_member(const xlnt::path &file, Partio::ZipFileReader &archive, const xlnt::path &member, const std::string &content_type) { if (!archive.Has_File(member.string())) return false; - std::ostringstream member_stream; - auto stream = archive.Get_File(member.string(), true); - std::string contents((std::istreambuf_iterator(*stream)), (std::istreambuf_iterator())); - delete stream; - auto result = compare_files(file.read_contents(), contents, content_type); + std::vector member_data; + xlnt::detail::vector_ostreambuf member_data_buffer(member_data); + std::ostream member_data_stream(&member_data_buffer); + std::unique_ptr member_stream(archive.Get_File(member.string(), true)); + member_data_stream << member_stream->rdbuf(); + std::string contents(member_data.begin(), member_data.end()); + return compare_files(file.read_contents(), contents, content_type); } static bool file_matches_document(const xlnt::path &expected,