Skip to content

Commit

Permalink
add Davis's suggestion
Browse files Browse the repository at this point in the history
Co-authored-by: Davis E. King <[email protected]>
  • Loading branch information
arrufat and davisking authored Feb 29, 2024
1 parent fbd6e19 commit f51b1f2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dlib/image_loader/jxl_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ namespace dlib
{
std::ifstream stream(filename, std::ios::binary);
stream.exceptions(std::ifstream::failbit | std::ifstream::badbit | std::ifstream::eofbit);
stream.seekg(0, std::ios_base::end);
std::vector<unsigned char> buffer(stream.tellg());
stream.seekg(0);
stream.read(reinterpret_cast<char*>(buffer.data()), buffer.size());
std::vector<unsigned char> buffer;
vectorstream temp(buffer);
temp << stream.rdbuf();
return buffer;
}

Expand Down

0 comments on commit f51b1f2

Please sign in to comment.