/[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 1859 by persson, Sun Mar 8 12:24:56 2009 UTC revision 1863 by schoenebeck, Fri Mar 13 10:57:24 2009 UTC
# Line 59  namespace RIFF { Line 59  namespace RIFF {
59          ulPos      = 0;          ulPos      = 0;
60          pParent    = NULL;          pParent    = NULL;
61          pChunkData = NULL;          pChunkData = NULL;
62            CurrentChunkSize = 0;
63            NewChunkSize = 0;
64          ulChunkDataSize = 0;          ulChunkDataSize = 0;
65          ChunkID    = CHUNK_ID_RIFF;          ChunkID    = CHUNK_ID_RIFF;
66          this->pFile = pFile;          this->pFile = pFile;
# Line 73  namespace RIFF { Line 75  namespace RIFF {
75          pParent       = Parent;          pParent       = Parent;
76          ulPos         = 0;          ulPos         = 0;
77          pChunkData    = NULL;          pChunkData    = NULL;
78            CurrentChunkSize = 0;
79            NewChunkSize = 0;
80          ulChunkDataSize = 0;          ulChunkDataSize = 0;
81          ReadHeader(StartPos);          ReadHeader(StartPos);
82      }      }
# Line 83  namespace RIFF { Line 87  namespace RIFF {
87          this->pParent    = pParent;          this->pParent    = pParent;
88          ulPos            = 0;          ulPos            = 0;
89          pChunkData       = NULL;          pChunkData       = NULL;
         ulChunkDataSize  = 0;  
90          ChunkID          = uiChunkID;          ChunkID          = uiChunkID;
91            ulChunkDataSize  = 0;
92          CurrentChunkSize = 0;          CurrentChunkSize = 0;
93          NewChunkSize     = uiBodySize;          NewChunkSize     = uiBodySize;
94      }      }
# Line 98  namespace RIFF { Line 102  namespace RIFF {
102          #if DEBUG          #if DEBUG
103          std::cout << "Chunk::Readheader(" << fPos << ") ";          std::cout << "Chunk::Readheader(" << fPos << ") ";
104          #endif // DEBUG          #endif // DEBUG
105            ChunkID = 0;
106            NewChunkSize = CurrentChunkSize = 0;
107          #if POSIX          #if POSIX
108          if (lseek(pFile->hFileRead, fPos, SEEK_SET) != -1) {          if (lseek(pFile->hFileRead, fPos, SEEK_SET) != -1) {
109              read(pFile->hFileRead, &ChunkID, 4);              read(pFile->hFileRead, &ChunkID, 4);
# Line 128  namespace RIFF { Line 134  namespace RIFF {
134              }              }
135              #if DEBUG              #if DEBUG
136              std::cout << "ckID=" << convertToString(ChunkID) << " ";              std::cout << "ckID=" << convertToString(ChunkID) << " ";
137              std::cout << "ckSize=" << ChunkSize << " ";              std::cout << "ckSize=" << CurrentChunkSize << " ";
138              std::cout << "bEndianNative=" << bEndianNative << std::endl;              std::cout << "bEndianNative=" << pFile->bEndianNative << std::endl;
139              #endif // DEBUG              #endif // DEBUG
140              NewChunkSize = CurrentChunkSize;              NewChunkSize = CurrentChunkSize;
141          }          }
# Line 225  namespace RIFF { Line 231  namespace RIFF {
231         #if DEBUG         #if DEBUG
232         std::cout << "Chunk::Remainingbytes()=" << CurrentChunkSize - ulPos << std::endl;         std::cout << "Chunk::Remainingbytes()=" << CurrentChunkSize - ulPos << std::endl;
233         #endif // DEBUG         #endif // DEBUG
234          return CurrentChunkSize - ulPos;          return (CurrentChunkSize > ulPos) ? CurrentChunkSize - ulPos : 0;
235      }      }
236    
237      /**      /**
# Line 1229  namespace RIFF { Line 1235  namespace RIFF {
1235        std::cout << "List::Readheader(ulong) ";        std::cout << "List::Readheader(ulong) ";
1236        #endif // DEBUG        #endif // DEBUG
1237          Chunk::ReadHeader(fPos);          Chunk::ReadHeader(fPos);
1238            if (CurrentChunkSize < 8) return;
1239          NewChunkSize = CurrentChunkSize -= 4;          NewChunkSize = CurrentChunkSize -= 4;
1240          #if POSIX          #if POSIX
1241          lseek(pFile->hFileRead, fPos + CHUNK_HEADER_SIZE, SEEK_SET);          lseek(pFile->hFileRead, fPos + CHUNK_HEADER_SIZE, SEEK_SET);
# Line 1432  namespace RIFF { Line 1439  namespace RIFF {
1439          Mode = stream_mode_read;          Mode = stream_mode_read;
1440          ulStartPos = RIFF_HEADER_SIZE;          ulStartPos = RIFF_HEADER_SIZE;
1441          ReadHeader(0);          ReadHeader(0);
1442          if (ChunkID != CHUNK_ID_RIFF) {          if (ChunkID != CHUNK_ID_RIFF && ChunkID != CHUNK_ID_RIFX) {
1443              throw RIFF::Exception("Not a RIFF file");              throw RIFF::Exception("Not a RIFF file");
1444          }          }
1445      }      }

Legend:
Removed from v.1859  
changed lines
  Added in v.1863

  ViewVC Help
Powered by ViewVC