diff --git a/mednafen/FileStream.cpp b/mednafen/FileStream.cpp index e3aca39..e5ac56b 100644 --- a/mednafen/FileStream.cpp +++ b/mednafen/FileStream.cpp @@ -39,7 +39,7 @@ FileStream::~FileStream() } } -uint64_t FileStream::read(void *data, uint64_t count, bool error_on_eos) +uint64_t FileStream::read(void *data, uint64_t count) { if (!fp) return 0; diff --git a/mednafen/FileStream.h b/mednafen/FileStream.h index 8a8ed73..06fd2b7 100644 --- a/mednafen/FileStream.h +++ b/mednafen/FileStream.h @@ -30,7 +30,7 @@ class FileStream : public Stream FileStream(const char *path, const int mode); virtual ~FileStream(); - virtual uint64_t read(void *data, uint64_t count, bool error_on_eos = true); + virtual uint64_t read(void *data, uint64_t count); virtual void write(const void *data, uint64_t count); virtual void seek(int64_t offset, int whence); virtual int64_t tell(void); diff --git a/mednafen/MemoryStream.cpp b/mednafen/MemoryStream.cpp index 55293a8..0449a73 100644 --- a/mednafen/MemoryStream.cpp +++ b/mednafen/MemoryStream.cpp @@ -111,22 +111,18 @@ INLINE void MemoryStream::grow_if_necessary(uint64 new_required_size) } } -uint64 MemoryStream::read(void *data, uint64 count, bool error_on_eos) +uint64 MemoryStream::read(void *data, uint64 count) { - if(count > data_buffer_size) - { - count = data_buffer_size; - } + if(count > data_buffer_size) + count = data_buffer_size; - if((uint64)position > (data_buffer_size - count)) - { - count = data_buffer_size - position; - } + if((uint64)position > (data_buffer_size - count)) + count = data_buffer_size - position; - memmove(data, &data_buffer[position], count); - position += count; + memmove(data, &data_buffer[position], count); + position += count; - return count; + return count; } void MemoryStream::write(const void *data, uint64 count) diff --git a/mednafen/MemoryStream.h b/mednafen/MemoryStream.h index 61291d1..34c739b 100644 --- a/mednafen/MemoryStream.h +++ b/mednafen/MemoryStream.h @@ -42,7 +42,7 @@ class MemoryStream : public Stream virtual uint8 *map(void); virtual void unmap(void); - virtual uint64 read(void *data, uint64 count, bool error_on_eos = true); + virtual uint64 read(void *data, uint64 count); virtual void write(const void *data, uint64 count); virtual void seek(int64 offset, int whence); virtual int64 tell(void); diff --git a/mednafen/Stream.cpp b/mednafen/Stream.cpp index 4a72f31..abf53d6 100644 --- a/mednafen/Stream.cpp +++ b/mednafen/Stream.cpp @@ -36,7 +36,7 @@ int Stream::get_line(std::string &str) str.clear(); // or str.resize(0)?? - while(read(&c, sizeof(c), false) > 0) + while(read(&c, sizeof(c)) > 0) { if(c == '\r' || c == '\n' || c == 0) return(c); diff --git a/mednafen/Stream.h b/mednafen/Stream.h index 1814057..c104d34 100644 --- a/mednafen/Stream.h +++ b/mednafen/Stream.h @@ -21,7 +21,7 @@ class Stream Stream(); virtual ~Stream(); - virtual uint64 read(void *data, uint64 count, bool error_on_eos = true) = 0; + virtual uint64 read(void *data, uint64 count) = 0; virtual void write(const void *data, uint64 count) = 0; virtual void seek(int64 offset, int whence) = 0; diff --git a/mednafen/cdrom/CDAFReader_Vorbis.cpp b/mednafen/cdrom/CDAFReader_Vorbis.cpp index 9807df7..9a11e76 100644 --- a/mednafen/cdrom/CDAFReader_Vorbis.cpp +++ b/mednafen/cdrom/CDAFReader_Vorbis.cpp @@ -48,7 +48,7 @@ static size_t iov_read_func(void *ptr, size_t size, size_t nmemb, void *user_dat if(!size) return(0); - return fw->read(ptr, size * nmemb, false) / size; + return fw->read(ptr, size * nmemb) / size; } static int iov_seek_func(void *user_data, int64_t offset, int whence) diff --git a/mednafen/cdrom/CDAccess_Image.cpp b/mednafen/cdrom/CDAccess_Image.cpp index 10d4298..cdc7f57 100644 --- a/mednafen/cdrom/CDAccess_Image.cpp +++ b/mednafen/cdrom/CDAccess_Image.cpp @@ -328,7 +328,7 @@ bool CDAccess_Image::LoadSBI(const std::string& sbi_path) return false; } - while(sbis.read(ed, sizeof(ed), false) == sizeof(ed)) + while(sbis.read(ed, sizeof(ed)) == sizeof(ed)) { if(!BCD_is_valid(ed[0]) || !BCD_is_valid(ed[1]) || !BCD_is_valid(ed[2])) { @@ -410,7 +410,7 @@ bool CDAccess_Image::ImageOpen(const std::string& path, bool image_memcache) { uint8_t bom_tmp[3]; - if(fp.read(bom_tmp, 3, false) == 3 && bom_tmp[0] == 0xEF && bom_tmp[1] == 0xBB && bom_tmp[2] == 0xBF) + if(fp.read(bom_tmp, 3) == 3 && bom_tmp[0] == 0xEF && bom_tmp[1] == 0xBB && bom_tmp[2] == 0xBF) { // Print an annoying error message, but don't actually error out. log_cb(RETRO_LOG_WARN, "UTF-8 BOM detected at start of CUE sheet.\n");