mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-03 21:01:14 +00:00
sync with ttvfs repo
This commit is contained in:
parent
b437a7cb2c
commit
0bf247169a
10 changed files with 67 additions and 69 deletions
|
@ -98,23 +98,20 @@ vfspos ZipFile::getpos() const
|
|||
return _pos;
|
||||
}
|
||||
|
||||
unsigned int ZipFile::read(void *dst, unsigned int bytes)
|
||||
size_t ZipFile::read(void *dst, size_t bytes)
|
||||
{
|
||||
if(!_buf && !unpack())
|
||||
return 0;
|
||||
|
||||
char *startptr = _buf + _pos;
|
||||
char *endptr = _buf + size();
|
||||
bytes = std::min((unsigned int)(endptr - startptr), bytes); // limit in case reading over buffer size
|
||||
//if(_mode.find('b') == std::string::npos)
|
||||
// strnNLcpy((char*)dst, (const char*)startptr, bytes); // non-binary == text mode
|
||||
//else
|
||||
memcpy(dst, startptr, bytes); // binary copy
|
||||
bytes = std::min<size_t>(endptr - startptr, bytes); // limit in case reading over buffer size
|
||||
memcpy(dst, startptr, bytes); // binary copy
|
||||
_pos += bytes;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
unsigned int ZipFile::write(const void *src, unsigned int bytes)
|
||||
size_t ZipFile::write(const void *src, size_t bytes)
|
||||
{
|
||||
// TODO: implement actually writing to the underlying Zip file.
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ public:
|
|||
virtual bool seek(vfspos pos, int whence);
|
||||
virtual bool flush();
|
||||
virtual vfspos getpos() const;
|
||||
virtual unsigned int read(void *dst, unsigned int bytes);
|
||||
virtual unsigned int write(const void *src, unsigned int bytes);
|
||||
virtual size_t read(void *dst, size_t bytes);
|
||||
virtual size_t write(const void *src, size_t bytes);
|
||||
virtual vfspos size();
|
||||
virtual const char *getType() const { return "ZipFile"; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue