diff common.cpp @ 292:d9a88cfd4ab6

Completed merge of lshlib back to current version of the trunk.
author mas01mc
date Tue, 29 Jul 2008 22:01:17 +0000
parents cacad987d785
children 25572f1bd37f c93be2f3a674
line wrap: on
line diff
--- a/common.cpp	Tue Jul 22 20:09:31 2008 +0000
+++ b/common.cpp	Tue Jul 29 22:01:17 2008 +0000
@@ -147,6 +147,14 @@
     CHECKED_MMAP(double *, powerTable, dbH->powerTableOffset, powerTableLength);
     CHECKED_MMAP(double *, l2normTable, dbH->l2normTableOffset, l2normTableLength);
   }
+
+  // build track offset table
+  trackOffsetTable = new off_t[dbH->numFiles];
+  Uns32T cumTrack=0;
+  for(Uns32T k = 0; k < dbH->numFiles; k++){
+    trackOffsetTable[k] = cumTrack;
+    cumTrack += trackTable[k] * dbH->dim;
+  }  
 }
 
 void audioDB::initInputFile (const char *inFile) {
@@ -187,7 +195,7 @@
   }
 }
 
-void audioDB::initTables(const char* dbName, const char* inFile = 0) {
+void audioDB::initTables(const char* dbName, const char* inFile) {
   /* FIXME: initRNG() really logically belongs in the audioDB
      contructor.  However, there are of the order of four constructors
      at the moment, and more to come from API implementation.  Given
@@ -196,5 +204,7 @@
      database will need an RNG.  -- CSR, 2008-07-02 */
   initRNG();
   initDBHeader(dbName);
-  initInputFile(inFile);
+  if(inFile)
+    initInputFile(inFile);
 }
+