comparison query.cpp @ 598:b2a941a372fb

Test for audiodb_retrieve_datum() The good news: my fix for audiodb_track_id_datum()'s timesTable handling looks correct. The bad news: we need to NULL out fields we don't fill with data. Do so.
author mas01cr
date Wed, 12 Aug 2009 14:57:11 +0000
parents 6ad0a6e67d4c
children e21a3db643af
comparison
equal deleted inserted replaced
597:fac63f65753e 598:b2a941a372fb
224 d->key = (*adb->keys)[track_id].c_str(); 224 d->key = (*adb->keys)[track_id].c_str();
225 /* read out stuff from the database tables */ 225 /* read out stuff from the database tables */
226 malloc_and_fill_or_goto_error(double *, d->data, adb->header->dataOffset + track_offset, d->nvectors * d->dim * sizeof(double)); 226 malloc_and_fill_or_goto_error(double *, d->data, adb->header->dataOffset + track_offset, d->nvectors * d->dim * sizeof(double));
227 if(adb->header->flags & ADB_HEADER_FLAG_POWER) { 227 if(adb->header->flags & ADB_HEADER_FLAG_POWER) {
228 malloc_and_fill_or_goto_error(double *, d->power, adb->header->powerTableOffset + track_offset / d->dim, d->nvectors * sizeof(double)); 228 malloc_and_fill_or_goto_error(double *, d->power, adb->header->powerTableOffset + track_offset / d->dim, d->nvectors * sizeof(double));
229 } else {
230 d->power = NULL;
229 } 231 }
230 if(adb->header->flags & ADB_HEADER_FLAG_TIMES) { 232 if(adb->header->flags & ADB_HEADER_FLAG_TIMES) {
231 malloc_and_fill_or_goto_error(double *, d->times, adb->header->timesTableOffset + 2 * track_offset / d->dim, 2 * d->nvectors * sizeof(double)); 233 malloc_and_fill_or_goto_error(double *, d->times, adb->header->timesTableOffset + 2 * track_offset / d->dim, 2 * d->nvectors * sizeof(double));
234 } else {
235 d->times = NULL;
232 } 236 }
233 return 0; 237 return 0;
234 } 238 }
235 error: 239 error:
236 audiodb_really_free_datum(d); 240 audiodb_really_free_datum(d);