fix integer overflow (-fsanitize=integer)

This commit is contained in:
Jiri Drbalek 2015-07-01 12:12:21 +00:00
parent c7693d9765
commit 9704e3eec5

View file

@ -125,7 +125,7 @@ struct svg_renderer : renderer_base<std::string>
} }
std::string expected(std::istreambuf_iterator<char>(stream.rdbuf()),(std::istreambuf_iterator<char>())); std::string expected(std::istreambuf_iterator<char>(stream.rdbuf()),(std::istreambuf_iterator<char>()));
stream.close(); stream.close();
return std::fabs(actual.size() - expected.size()); return std::max(actual.size(), expected.size()) - std::min(actual.size(), expected.size());
} }
void save(image_type const & image, boost::filesystem::path const& path) const void save(image_type const & image, boost::filesystem::path const& path) const