/*
Scan based on shuffle order
*/
- int *keyval = *fp ? &((*fp)->id) : NULL;
+ int keyval = *fp ? ((*fp)->id) : -1;
dbdisk *disk = *fp ? dbdisk_get(tx, db, (*fp)->diskid) : NULL;
int mounted = *fp ? dbdisk_mounted(disk) : 0;
- printf("shuffle next, fid=%d\n", keyval ? *keyval : -1);
- if (keyval) {
- data.mv_data = keyval;
- data.mv_size = sizeof(*keyval);
+ printf("shuffle next, fid=%d\n", keyval);
+
+ dbfile_free(*fp);
+ free(*pathp);
+ *fp = NULL;
+ *pathp = NULL;
+
+ if (keyval != -1) {
+ data.mv_data = &keyval;
+ data.mv_size = sizeof(keyval);
res = mdb_get(tx, db->shuffle_by_file, &data, &key);
printf("get by file = %d, id=%d\n", res, *((int *)key.mv_data));
res = mdb_cursor_get(cursor, &key, &data, first);
}
- dbfile_free(*fp);
- *fp = NULL;
- free(*pathp);
- *pathp = NULL;
-
while (file == NULL && res == 0) {
file = primary_get_decode(tx, db, DBFILE_DESC, &data, db->file);
if (file) {
int keep;
- printf("loaded: %d[%d] %d?\n", *(int *)data.mv_data, data.mv_size, file->id);
+ printf("loaded: %d[%zd] %d?\n", *(int *)data.mv_data, data.mv_size, file->id);
if (disk == NULL || file->diskid != disk->id) {
dbdisk_free(disk);