Mercurial > hg > audiodb
comparison 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 |
comparison
equal
deleted
inserted
replaced
554:600b87550b83 | 557:d3c96cbb91e3 |
---|---|
269 | 269 |
270 static inline const char *audiodb_index_key(adb_t *adb, uint32_t index) { | 270 static inline const char *audiodb_index_key(adb_t *adb, uint32_t index) { |
271 return (*adb->keys)[index].c_str(); | 271 return (*adb->keys)[index].c_str(); |
272 } | 272 } |
273 | 273 |
274 static inline uint32_t audiodb_index_to_track_id(adb_t *adb, uint32_t lshid) { | 274 static inline uint32_t audiodb_index_to_track_id(adb_t *adb, uint32_t lshid){ |
275 off_t offset = lshid * adb->header->dim * sizeof(double); | 275 off_t offset = (off_t)lshid*adb->header->dim*sizeof(double); |
276 std::vector<off_t>::iterator b = (*adb->track_offsets).begin(); | 276 std::vector<off_t>::iterator b = (*adb->track_offsets).begin(); |
277 std::vector<off_t>::iterator e = (*adb->track_offsets).end(); | 277 std::vector<off_t>::iterator e = (*adb->track_offsets).end(); |
278 std::vector<off_t>::iterator p = std::upper_bound(b, e, offset); | 278 std::vector<off_t>::iterator p = std::upper_bound(b, e, offset); |
279 return p - b - 1; | 279 return p - b - 1; |
280 } | 280 } |