diff audioDB-internals.h @ 557:d3c96cbb91e3

INDEXING: fixed reverse-lookup roundoff error when data gets very large. Computation of offset was lacking an essential cast to off_t.
author mas01mc
date Fri, 20 Feb 2009 19:08:45 +0000
parents ad561daf75ca
children c6036e0a511a
line wrap: on
line diff
--- a/audioDB-internals.h	Fri Feb 13 11:23:13 2009 +0000
+++ b/audioDB-internals.h	Fri Feb 20 19:08:45 2009 +0000
@@ -271,8 +271,8 @@
   return (*adb->keys)[index].c_str();
 }
 
-static inline uint32_t audiodb_index_to_track_id(adb_t *adb, uint32_t lshid) {
-  off_t offset = lshid * adb->header->dim * sizeof(double);
+static inline uint32_t audiodb_index_to_track_id(adb_t *adb, uint32_t lshid){
+  off_t offset = (off_t)lshid*adb->header->dim*sizeof(double);
   std::vector<off_t>::iterator b = (*adb->track_offsets).begin();
   std::vector<off_t>::iterator e = (*adb->track_offsets).end();  
   std::vector<off_t>::iterator p = std::upper_bound(b, e, offset);