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,