/[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 11 by schoenebeck, Sun Nov 16 17:47:00 2003 UTC revision 515 by schoenebeck, Sat May 7 20:19:10 2005 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file loader library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 by Christian Schoenebeck                           *   *   Copyright (C) 2003-2005 by Christian Schoenebeck                      *
6   *                         <cuse@users.sourceforge.net>                    *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 192  namespace RIFF { Line 192  namespace RIFF {
192         #if DEBUG         #if DEBUG
193         std::cout << "Chunk::Read(void*,ulong,ulong)" << std::endl;         std::cout << "Chunk::Read(void*,ulong,ulong)" << std::endl;
194         #endif // DEBUG         #endif // DEBUG
195          if (ChunkSize - ulPos <= 0) return 0;          if (ulPos >= ChunkSize) return 0;
196          if (ulPos + WordCount * WordSize >= ChunkSize) WordCount = (ChunkSize - ulPos) / WordSize;          if (ulPos + WordCount * WordSize >= ChunkSize) WordCount = (ChunkSize - ulPos) / WordSize;
197          #if POSIX          #if POSIX
198          if (lseek(hFile, ulStartPos + ulPos, SEEK_SET) < 0) return 0;          if (lseek(hFile, ulStartPos + ulPos, SEEK_SET) < 0) return 0;
# Line 642  namespace RIFF { Line 642  namespace RIFF {
642      }      }
643    
644      /**      /**
645       *  Returns number subchunks within the list.       *  Returns number of subchunks within the list.
646       */       */
647      unsigned int List::CountSubChunks() {      unsigned int List::CountSubChunks() {
648          if (!pSubChunks) LoadSubChunks();          if (!pSubChunks) LoadSubChunks();
# Line 721  namespace RIFF { Line 721  namespace RIFF {
721          if (!pSubChunks) {          if (!pSubChunks) {
722              pSubChunks    = new ChunkList();              pSubChunks    = new ChunkList();
723              pSubChunksMap = new ChunkMap();              pSubChunksMap = new ChunkMap();
724                unsigned long uiOriginalPos = GetPos();
725                SetPos(0); // jump to beginning of list chunk body
726              while (RemainingBytes() >= CHUNK_HEADER_SIZE) {              while (RemainingBytes() >= CHUNK_HEADER_SIZE) {
727                  Chunk* ck;                  Chunk* ck;
728                  uint32_t ckid;                  uint32_t ckid;
# Line 740  namespace RIFF { Line 742  namespace RIFF {
742                  (*pSubChunksMap)[ckid] = ck;                  (*pSubChunksMap)[ckid] = ck;
743                  if (GetPos() % 2 != 0) SetPos(1, RIFF::stream_curpos); // jump over pad byte                  if (GetPos() % 2 != 0) SetPos(1, RIFF::stream_curpos); // jump over pad byte
744              }              }
745                SetPos(uiOriginalPos); // restore position before this call
746          }          }
747      }      }
748    

Legend:
Removed from v.11  
changed lines
  Added in v.515

  ViewVC Help
Powered by ViewVC