Do not assign std::streampos to std::streamoff (#321)

This commit is contained in:
PavelP 2017-12-27 09:16:10 -08:00 committed by Ondrej Stava
parent fb5ed8ebf8
commit 64e9192d43
2 changed files with 4 additions and 4 deletions

View File

@ -54,9 +54,9 @@ Status ObjDecoder::DecodeFromFile(const std::string &file_name,
if (!file)
return Status(Status::IO_ERROR);
// Read the whole file into a buffer.
auto file_size = file.tellg();
auto pos0 = file.tellg();
file.seekg(0, std::ios::end);
file_size = file.tellg() - file_size;
auto file_size = file.tellg() - pos0;
if (file_size == 0)
return Status(Status::IO_ERROR);
file.seekg(0, std::ios::beg);

View File

@ -34,9 +34,9 @@ bool PlyDecoder::DecodeFromFile(const std::string &file_name,
if (!file)
return false;
// Read the whole file into a buffer.
auto file_size = file.tellg();
auto pos0 = file.tellg();
file.seekg(0, std::ios::end);
file_size = file.tellg() - file_size;
auto file_size = file.tellg() - pos0;
if (file_size == 0)
return false;
file.seekg(0, std::ios::beg);