diff options
author | Paweł Kołodziejski | 2002-09-02 07:53:43 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2002-09-02 07:53:43 +0000 |
commit | ca03c9b5fc58b6beb5dbc6c1307464ef9e2c9f45 (patch) | |
tree | 539f84d8edc7002ccb01278aa06a174ab53bda3d /common | |
parent | 97ef7c2a34c4077d6d046f0aabce7e1dde04e092 (diff) | |
download | scummvm-rg350-ca03c9b5fc58b6beb5dbc6c1307464ef9e2c9f45.tar.gz scummvm-rg350-ca03c9b5fc58b6beb5dbc6c1307464ef9e2c9f45.tar.bz2 scummvm-rg350-ca03c9b5fc58b6beb5dbc6c1307464ef9e2c9f45.zip |
changed file io in sounds to class File
svn-id: r4896
Diffstat (limited to 'common')
-rw-r--r-- | common/file.cpp | 15 | ||||
-rw-r--r-- | common/file.h | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/common/file.cpp b/common/file.cpp index faa09dde1e..809c843ecf 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -114,7 +114,7 @@ void File::seek(uint32 offs, int whence) { clearerr(_handle); } -void File::read(void *ptr, uint32 size) { +uint32 File::read(void *ptr, uint32 size) { byte *ptr2 = (byte *)ptr; if (_handle == NULL) { @@ -125,14 +125,19 @@ void File::read(void *ptr, uint32 size) { if (size == 0) return; - if ((uint32)fread(ptr2, size, 1, _handle) != 1) { + if ((uint32)fread(ptr2, 1, size, _handle) != size) { clearerr(_handle); _readFailed = true; } - do { - *ptr2++ ^= _encbyte; - } while (--size); + if (_encbyte != 0) { + uint32 t_size = size; + do { + *ptr2++ ^= _encbyte; + } while (--t_size); + } + + return size; } byte File::readByte() { diff --git a/common/file.h b/common/file.h index a3cb1988cc..6820e77255 100644 --- a/common/file.h +++ b/common/file.h @@ -46,7 +46,7 @@ public: bool eof(); uint32 pos(); void seek(uint32 offs, int whence); - void read(void *ptr, uint32 size); + uint32 read(void *ptr, uint32 size); byte readByte(); uint16 readWordLE(); uint32 readDwordLE(); |