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

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

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

revision 3114 by schoenebeck, Wed Feb 15 13:21:31 2017 UTC revision 3115 by schoenebeck, Sat Apr 15 20:17:05 2017 UTC
# Line 269  namespace { Line 269  namespace {
269       * steps.       * steps.
270       *       *
271       * Once the whole data was processed by __calculateCRC(), one should       * Once the whole data was processed by __calculateCRC(), one should
272       * call __encodeCRC() to get the final CRC result.       * call __finalizeCRC() to get the final CRC result.
273       *       *
274       * @param buf     - pointer to data the CRC shall be calculated of       * @param buf     - pointer to data the CRC shall be calculated of
275       * @param bufSize - size of the data to be processed       * @param bufSize - size of the data to be processed
# Line 286  namespace { Line 286  namespace {
286       *       *
287       * @param crc - variable previously passed to __calculateCRC()       * @param crc - variable previously passed to __calculateCRC()
288       */       */
289      inline static uint32_t __encodeCRC(const uint32_t& crc) {      inline static void __finalizeCRC(uint32_t& crc) {
290          return crc ^ 0xffffffff;          crc ^= 0xffffffff;
291      }      }
292    
293    
# Line 1294  namespace { Line 1294  namespace {
1294          // if this is the last write, update the checksum chunk in the          // if this is the last write, update the checksum chunk in the
1295          // file          // file
1296          if (pCkData->GetPos() == pCkData->GetSize()) {          if (pCkData->GetPos() == pCkData->GetSize()) {
1297                __finalizeCRC(crc);
1298              File* pFile = static_cast<File*>(GetParent());              File* pFile = static_cast<File*>(GetParent());
1299              pFile->SetSampleChecksum(this, __encodeCRC(crc));              pFile->SetSampleChecksum(this, crc);
1300          }          }
1301          return res;          return res;
1302      }      }
# Line 1416  namespace { Line 1417  namespace {
1417              if (nRead <= 0) break;              if (nRead <= 0) break;
1418              __calculateCRC(&buffer[0], nRead * FrameSize, crc);              __calculateCRC(&buffer[0], nRead * FrameSize, crc);
1419          }          }
1420          __encodeCRC(crc);          __finalizeCRC(crc);
1421          return crc;          return crc;
1422      }      }
1423    
# Line 4246  namespace { Line 4247  namespace {
4247          // recalculate CRC32 check sum          // recalculate CRC32 check sum
4248          __resetCRC(crc);          __resetCRC(crc);
4249          __calculateCRC(&data[0], data.size(), crc);          __calculateCRC(&data[0], data.size(), crc);
4250          __encodeCRC(crc);          __finalizeCRC(crc);
4251          // make sure chunk exists and has the required size          // make sure chunk exists and has the required size
4252          const file_offset_t chunkSize = (file_offset_t) 7*sizeof(int32_t) + Name.size() + data.size();          const file_offset_t chunkSize = (file_offset_t) 7*sizeof(int32_t) + Name.size() + data.size();
4253          if (!pChunk) pChunk = pGroup->pList->AddSubChunk(CHUNK_ID_SCRI, chunkSize);          if (!pChunk) pChunk = pGroup->pList->AddSubChunk(CHUNK_ID_SCRI, chunkSize);

Legend:
Removed from v.3114  
changed lines
  Added in v.3115

  ViewVC Help
Powered by ViewVC