Skip to content

Commit

Permalink
Write assert in a way it also works on 32 bit machines.
Browse files Browse the repository at this point in the history
  • Loading branch information
joto committed Jul 22, 2018
1 parent 7489178 commit f21bf57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/osmium/util/file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace osmium {
// https://msdn.microsoft.com/en-us/library/whx354w1.aspx
if (::_chsize_s(fd, static_cast<__int64>(new_size)) != 0) {
#else
assert(new_size <= std::numeric_limits<off_t>::max());
assert(std::numeric_limits<off_t>::max() >= std::numeric_limits<size_t>::max() || new_size <= std::numeric_limits<off_t>::max());
if (::ftruncate(fd, static_cast<off_t>(new_size)) != 0) {
#endif
throw std::system_error{errno, std::system_category(), "Could not resize file"};
Expand Down

0 comments on commit f21bf57

Please sign in to comment.