fix(file_util): Type specification

Fixes #290
This commit is contained in:
Michael Carlberg 2017-01-01 01:21:25 +01:00
parent 0d7f040256
commit cc5a5ef25c

View File

@ -150,10 +150,10 @@ int fd_streambuf::overflow(int c) {
int fd_streambuf::underflow() { int fd_streambuf::underflow() {
if (gptr() == egptr()) { if (gptr() == egptr()) {
auto pback = std::min(gptr() - eback(), std::ptrdiff_t(m_in)); std::streamsize pback(std::min(gptr() - eback(), std::ptrdiff_t(m_in)));
std::copy(egptr() - pback, egptr(), eback()); std::copy(egptr() - pback, egptr(), eback());
auto bytes = ::read(m_fd, eback() + pback, BUFSIZ); int bytes(::read(m_fd, eback() + pback, BUFSIZ));
setg(eback(), eback() + pback, eback() + pback + std::max(0L, bytes)); setg(eback(), eback() + pback, eback() + pback + std::max(0, bytes));
} }
return gptr() == egptr() ? traits_type::eof() : traits_type::to_int_type(*gptr()); return gptr() == egptr() ? traits_type::eof() : traits_type::to_int_type(*gptr());
} }