changeset 454:f3b0ddc1ead0 api-inversion

No more indata The mmap()ed version of the input data was never used, so zap it everywhere.
author mas01cr
date Wed, 24 Dec 2008 10:57:18 +0000
parents 16a903968d18
children 93ce12fe2f76
files audioDB.cpp audioDB.h common.cpp index.cpp query.cpp
diffstat 5 files changed, 4 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Wed Dec 24 10:57:14 2008 +0000
+++ b/audioDB.cpp	Wed Dec 24 10:57:18 2008 +0000
@@ -199,8 +199,6 @@
 
 void audioDB::cleanup() {
   cmdline_parser_free(&args_info);
-  if(indata)
-    munmap(indata,statbuf.st_size);
   if(fileTable)
     munmap(fileTable, fileTableLength);
   if(trackTable)
--- a/audioDB.h	Wed Dec 24 10:57:14 2008 +0000
+++ b/audioDB.h	Wed Dec 24 10:57:18 2008 +0000
@@ -253,7 +253,6 @@
   int lshfid;
   bool forWrite;
   int infid;
-  char* indata;
   struct stat statbuf;  
   dbTableHeaderPtr dbH;
   struct adb *adb;
@@ -329,7 +328,7 @@
   void query_loop_points(adb_query_spec_t *spec, double* query, adb_qpointers_internal_t *qpointers);
   void initRNG();
   void initDBHeader(const char *dbName);
-  void initInputFile(const char *inFile, bool loadData = true);
+  void initInputFile(const char *inFile);
   void initTables(const char* dbName, const char* inFile = 0);
   void initTablesFromKey(const char* dbName, const Uns32T queryIndex);
   void prefix_name(char** const name, const char* prefix);
@@ -433,7 +432,6 @@
     lshfid(0),					\
     forWrite(false),				\
     infid(0),					\
-    indata(0),					\
     dbH(0),					\
     adb(0),                                     \
     rng(0),                                     \
--- a/common.cpp	Wed Dec 24 10:57:14 2008 +0000
+++ b/common.cpp	Wed Dec 24 10:57:18 2008 +0000
@@ -152,7 +152,7 @@
     lsh_n_point_bits = O2_DEFAULT_LSH_N_POINT_BITS;
 }
 
-void audioDB::initInputFile (const char *inFile, bool loadData) {
+void audioDB::initInputFile (const char *inFile) {
   if (inFile) {
     if ((infid = open(inFile, O_RDONLY)) < 0) {
       error("can't open input file for reading", inFile, "open");
@@ -183,10 +183,6 @@
 	error("feature dimensions do not match database table dimensions", inFile);
       }
     }
-    
-    if (loadData && ((indata = (char *) mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, infid, 0)) == (caddr_t) -1)) {
-      error("mmap error for input", inFile, "mmap");
-    }
   }
 }
 
--- a/index.cpp	Wed Dec 24 10:57:14 2008 +0000
+++ b/index.cpp	Wed Dec 24 10:57:18 2008 +0000
@@ -335,7 +335,7 @@
       prefix_name((char ** const) &prefixedString, adb_feature_root);
       if(prefixedString!=tmpStr)
 	delete[] tmpStr;
-      initInputFile(prefixedString, false); // nommap, file pointer at correct position
+      initInputFile(prefixedString);
       trackfd = infid;
     }
     if(audiodb_read_data(adb, trackfd, trackID, &fvp, &nfv))
--- a/query.cpp	Wed Dec 24 10:57:14 2008 +0000
+++ b/query.cpp	Wed Dec 24 10:57:18 2008 +0000
@@ -658,7 +658,7 @@
 	prefix_name((char ** const) &prefixedString, adb_feature_root);
 	if (prefixedString!=tmpStr)
 	  delete[] tmpStr;
-	initInputFile(prefixedString, false); // nommap, file pointer at correct position
+	initInputFile(prefixedString);
 	// Load the feature vector data for current track into data_buffer
 	if(audiodb_read_data(adb, infid, pp.trackID, &data_buffer, &data_buffer_size))
           error("failed to read data");