/[svn]/libgig/trunk/src/RIFF.cpp
ViewVC logotype

Diff of /libgig/trunk/src/RIFF.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2682 by schoenebeck, Mon Dec 29 16:25:51 2014 UTC revision 2685 by schoenebeck, Sat Jan 3 21:44:42 2015 UTC
# Line 302  namespace RIFF { Line 302  namespace RIFF {
302          if (ulPos + WordCount * WordSize >= CurrentChunkSize) WordCount = (CurrentChunkSize - ulPos) / WordSize;          if (ulPos + WordCount * WordSize >= CurrentChunkSize) WordCount = (CurrentChunkSize - ulPos) / WordSize;
303          #if POSIX          #if POSIX
304          if (lseek(pFile->hFileRead, ulStartPos + ulPos, SEEK_SET) < 0) return 0;          if (lseek(pFile->hFileRead, ulStartPos + ulPos, SEEK_SET) < 0) return 0;
305          unsigned long readWords = read(pFile->hFileRead, pData, WordCount * WordSize);          ssize_t readWords = read(pFile->hFileRead, pData, WordCount * WordSize);
306          if (readWords < 1) return 0;          if (readWords < 1) {
307                #if DEBUG
308                std::cerr << "POSIX read() failed: " << strerror(errno) << std::endl << std::flush;
309                #endif // DEBUG
310                return 0;
311            }
312          readWords /= WordSize;          readWords /= WordSize;
313          #elif defined(WIN32)          #elif defined(WIN32)
314          if (SetFilePointer(pFile->hFileRead, ulStartPos + ulPos, NULL/*32 bit*/, FILE_BEGIN) == INVALID_SET_FILE_POINTER) return 0;          if (SetFilePointer(pFile->hFileRead, ulStartPos + ulPos, NULL/*32 bit*/, FILE_BEGIN) == INVALID_SET_FILE_POINTER) return 0;
# Line 313  namespace RIFF { Line 318  namespace RIFF {
318          readWords /= WordSize;          readWords /= WordSize;
319          #else // standard C functions          #else // standard C functions
320          if (fseek(pFile->hFileRead, ulStartPos + ulPos, SEEK_SET)) return 0;          if (fseek(pFile->hFileRead, ulStartPos + ulPos, SEEK_SET)) return 0;
321          unsigned long readWords = fread(pData, WordSize, WordCount, pFile->hFileRead);          size_t readWords = fread(pData, WordSize, WordCount, pFile->hFileRead);
322          #endif // POSIX          #endif // POSIX
323          if (!pFile->bEndianNative && WordSize != 1) {          if (!pFile->bEndianNative && WordSize != 1) {
324              switch (WordSize) {              switch (WordSize) {

Legend:
Removed from v.2682  
changed lines
  Added in v.2685

  ViewVC Help
Powered by ViewVC