fix clang build

This commit is contained in:
Thomas Fussell 2016-10-30 21:44:43 -04:00
parent 25aea3fe72
commit dce2367524
3 changed files with 11 additions and 9 deletions

View File

@ -153,7 +153,7 @@ private:
else else
{ {
auto position_size = data_.size(); auto position_size = data_.size();
auto required_size = static_cast<std::size_t>(position_ + n); auto required_size = static_cast<std::size_t>(position_ + static_cast<std::streampos>(n));
data_.resize(std::max(position_size, required_size)); data_.resize(std::max(position_size, required_size));
} }

View File

@ -7,7 +7,7 @@
#include <helpers/path_helper.hpp> #include <helpers/path_helper.hpp>
#include <xlnt/workbook/workbook.hpp> #include <xlnt/workbook/workbook.hpp>
#define TEST_CRYPTO false #define TEST_CRYPTO true
#ifndef TEST_CRYPTO #ifndef TEST_CRYPTO
#define TEST_CRYPTO false #define TEST_CRYPTO false

View File

@ -303,17 +303,19 @@ public:
return compare_files(expected, contents, content_type); 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, Partio::ZipFileReader &archive,
const xlnt::path &member, const xlnt::path &member,
const std::string &content_type) const std::string &content_type)
{ {
if (!archive.Has_File(member.string())) return false; if (!archive.Has_File(member.string())) return false;
std::ostringstream member_stream; std::vector<std::uint8_t> member_data;
auto stream = archive.Get_File(member.string(), true); xlnt::detail::vector_ostreambuf member_data_buffer(member_data);
std::string contents((std::istreambuf_iterator<char>(*stream)), (std::istreambuf_iterator<char>())); std::ostream member_data_stream(&member_data_buffer);
delete stream; std::unique_ptr<std::istream> member_stream(archive.Get_File(member.string(), true));
auto result = compare_files(file.read_contents(), contents, content_type); 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, static bool file_matches_document(const xlnt::path &expected,