changeset 225:92bad288da28 audiodb-debian

Merged trunk changes -r264:274 into audiodb-debian branch. (+ new debian/changelog)
author mas01cr
date Wed, 05 Dec 2007 14:06:21 +0000
parents c4cec5e76992
children b83f0fd53a2c
files audioDB.cpp audioDB.h debian/changelog tests/0034/run-test.sh tests/0034/short-description
diffstat 5 files changed, 82 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Fri Nov 23 15:53:37 2007 +0000
+++ b/audioDB.cpp	Wed Dec 05 14:06:21 2007 +0000
@@ -454,6 +454,7 @@
   dbH->numFiles = 0;
   dbH->dim = 0;
   dbH->flags = 0;
+  dbH->headerSize = O2_HEADERSIZE;
   dbH->length = 0;
   dbH->fileTableOffset = ALIGN_PAGE_UP(O2_HEADERSIZE);
   dbH->trackTableOffset = ALIGN_PAGE_UP(dbH->fileTableOffset + O2_FILETABLESIZE*maxfiles);
@@ -508,7 +509,11 @@
   }
 
   if(dbH->version != O2_FORMAT_VERSION) {
-    error("database file has incorect version", dbName);
+    error("database file has incorrect version", dbName);
+  }
+
+  if(dbH->headerSize != O2_HEADERSIZE) {
+    error("sizeof(dbTableHeader) unexpected: platform ABI mismatch?", dbName);
   }
 
 #define CHECKED_MMAP(type, var, start, length) \
@@ -627,7 +632,7 @@
   // Linear scan of filenames check for pre-existing feature
   unsigned alreadyInserted=0;
   for(unsigned k=0; k<dbH->numFiles; k++)
-    if(strncmp(fileTable + k*O2_FILETABLESIZE, key, strlen(key))==0){
+    if(strncmp(fileTable + k*O2_FILETABLESIZE, key, strlen(key)+1)==0){
       alreadyInserted=1;
       break;
     }
@@ -823,7 +828,7 @@
     unsigned alreadyInserted=0;
   
     for(unsigned k=0; k<dbH->numFiles; k++)
-      if(strncmp(fileTable + k*O2_FILETABLESIZE, thisKey, strlen(thisKey))==0){
+      if(strncmp(fileTable + k*O2_FILETABLESIZE, thisKey, strlen(thisKey)+1)==0){
 	alreadyInserted=1;
 	break;
       }
--- a/audioDB.h	Fri Nov 23 15:53:37 2007 +0000
+++ b/audioDB.h	Wed Dec 05 14:06:21 2007 +0000
@@ -50,7 +50,7 @@
 
 #define O2_OLD_MAGIC ('O'|'2'<<8|'D'<<16|'B'<<24)
 #define O2_MAGIC ('o'|'2'<<8|'d'<<16|'b'<<24)
-#define O2_FORMAT_VERSION (3U)
+#define O2_FORMAT_VERSION (4U)
 
 #define O2_DEFAULT_POINTNN (10U)
 #define O2_DEFAULT_TRACKNN  (10U)
@@ -95,12 +95,13 @@
 
 using namespace std;
 
-typedef struct dbTableHeader{
+typedef struct dbTableHeader {
   uint32_t magic;
   uint32_t version;
   uint32_t numFiles;
   uint32_t dim;
   uint32_t flags;
+  uint32_t headerSize;
   off_t length;
   off_t fileTableOffset;
   off_t trackTableOffset;
--- a/debian/changelog	Fri Nov 23 15:53:37 2007 +0000
+++ b/debian/changelog	Wed Dec 05 14:06:21 2007 +0000
@@ -1,3 +1,11 @@
+audiodb (1.0-18) unstable; urgency=low
+
+  * Updated to svn version #274
+  * smooths over ABI differences between OS X and Linux; breaks binary
+    compatibility.  *sigh*.
+
+ -- Christophe Rhodes <c.rhodes@gold.ac.uk>  Thu, 29 Nov 2007 16:33:04 +0000
+
 audiodb (1.0-17) unstable; urgency=low
 
   * Updated to svn version #263
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/0034/run-test.sh	Wed Dec 05 14:06:21 2007 +0000
@@ -0,0 +1,62 @@
+#! /bin/sh
+
+. ../test-utils.sh
+
+if [ -f testdb ]; then rm -f testdb; fi
+
+${AUDIODB} -d testdb -N
+
+intstring 2 > testfeature
+floatstring 1 1 >> testfeature
+intstring 2 > testfeature01
+floatstring 0 1 >> testfeature01
+intstring 2 > testfeature10
+floatstring 1 0 >> testfeature10
+
+${AUDIODB} -d testdb -I -f testfeature
+${AUDIODB} -d testdb -S | grep "num files:1"
+${AUDIODB} -d testdb -I -f testfeature
+${AUDIODB} -d testdb -S | grep "num files:1"
+${AUDIODB} -d testdb -I -f testfeature01
+${AUDIODB} -d testdb -S | grep "num files:2"
+${AUDIODB} -d testdb -I -f testfeature10
+${AUDIODB} -d testdb -S | grep "num files:3"
+
+rm -f testdb
+
+${AUDIODB} -d testdb -N
+
+${AUDIODB} -d testdb -I -f testfeature01
+${AUDIODB} -d testdb -S | grep "num files:1"
+${AUDIODB} -d testdb -I -f testfeature01
+${AUDIODB} -d testdb -S | grep "num files:1"
+${AUDIODB} -d testdb -I -f testfeature10
+${AUDIODB} -d testdb -S | grep "num files:2"
+${AUDIODB} -d testdb -I -f testfeature
+${AUDIODB} -d testdb -S | grep "num files:3"
+
+rm -f testdb
+
+${AUDIODB} -d testdb -N
+
+echo testfeature > testfeaturelist.txt
+echo testfeature01 >> testfeaturelist.txt
+echo testfeature10 >> testfeaturelist.txt
+
+${AUDIODB} -B -F testfeaturelist.txt -d testdb
+
+${AUDIODB} -d testdb -S | grep "num files:3"
+
+rm -f testdb
+
+${AUDIODB} -d testdb -N
+
+echo testfeature01 > testfeaturelist.txt
+echo testfeature10 >> testfeaturelist.txt
+echo testfeature >> testfeaturelist.txt
+
+${AUDIODB} -B -F testfeaturelist.txt -d testdb
+
+${AUDIODB} -d testdb -S | grep "num files:3"
+
+exit 104
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/0034/short-description	Wed Dec 05 14:06:21 2007 +0000
@@ -0,0 +1,1 @@
+key duplicate test
\ No newline at end of file