Get rid of error_on_eos

This commit is contained in:
twinaphex 2021-04-08 20:40:48 +02:00
parent 921288f96e
commit 1efc0309b6
8 changed files with 16 additions and 20 deletions

View File

@ -37,7 +37,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;

View File

@ -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);

View File

@ -125,22 +125,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)

View File

@ -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);

View File

@ -35,7 +35,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);

View File

@ -23,7 +23,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;

View File

@ -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)

View File

@ -330,7 +330,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]))
{
@ -412,7 +412,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");