Skip to content

Commit

Permalink
imgfile_sdl: Fix write seek and return result.
Browse files Browse the repository at this point in the history
  • Loading branch information
joevt authored and dingusdev committed Mar 1, 2025
1 parent f3dec30 commit f21d2bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/imgfile_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ uint64_t ImgFile::write(const void* buf, uint64_t offset, uint64_t length)
LOG_F(WARNING, "ImgFile::write before disk was opened, ignoring.");
return 0;
}
impl->stream->seekg(offset, std::ios::beg);
impl->stream->seekp(offset, std::ios::beg);
impl->stream->write((const char *)buf, length);
#if defined(WIN32) || defined(__APPLE__) || defined(__linux)
impl->stream->flush();
#endif
return impl->stream->gcount();
return uint64_t(impl->stream->tellp()) - offset;
}

0 comments on commit f21d2bd

Please sign in to comment.