# HG changeset patch # User mas01cr # Date 1195231199 0 # Node ID 0caa733d48c5f1394a3c442f87696f45a02edb4a # Parent 530154ca4cf5d61fd3ecb728373702ffcf3fe068 Test against running off the end of the timesTable properly. diff -r 530154ca4cf5 -r 0caa733d48c5 audioDB.cpp --- a/audioDB.cpp Fri Nov 16 16:31:36 2007 +0000 +++ b/audioDB.cpp Fri Nov 16 16:39:59 2007 +0000 @@ -599,11 +599,11 @@ // Check times status and insert times from file unsigned timesoffset=insertoffset/(dbH->dim*sizeof(double)); double* timesdata=timesTable+timesoffset; - /* FIXME: work out how to check against wandering off the end of the - times table. - assert(timesdata+numVectors timesTableLength) { + error("out of space for times", key); + } + insertTimeStamps(numVectors, timesFile, timesdata); // Increment file count @@ -765,7 +765,9 @@ unsigned insertoffset=dbH->length; unsigned timesoffset=insertoffset/(dbH->dim*sizeof(double)); double* timesdata=timesTable+timesoffset; - assert(timesdata+numVectors timesTableLength) { + error("out of space for times", key); + } insertTimeStamps(numVectors,thisTimesFile,timesdata); if(thisTimesFile) delete thisTimesFile;