+ if (verbose)
+ display_progress(outfile, file_base_name(filename));
+
+ remaining -= size;
+ }
+ if (verbose > 1)
+ fprintf(logfile, "read_file_data: wrote %lld bytes of data from %s\n",
+ data_size, filename);
+ fclose(input_file);
+ return 0;
+}
+
+static int parse_file_block(INT64 offset, INT64 data_size, INT64 file_size, JIGDB *dbp,
+ unsigned char *md5, struct mk_MD5Context *image_context,
+ char *missing)
+{
+ char *base64_md5 = base64_dump(md5, 16);
+ struct mk_MD5Context file_context;
+ struct mk_MD5Context *use_context = NULL;
+ unsigned char file_md5[16];
+ md5_list_t *md5_list_entry = NULL;
+ db_entry_t *db_entry = NULL;
+ int error = 0;
+ char *filename = NULL;
+
+ if (!quick)
+ {
+ use_context = &file_context;
+ mk_MD5Init(use_context);
+ }
+
+ /* Try the DB first if we have one */
+ if (dbp)
+ {
+ error = db_lookup_by_md5(dbp, base64_md5, &db_entry);
+ if (!error)
+ filename = db_entry->filename;
+ }
+
+ /* No joy; fall back to the MD5 list */
+ if (!filename)
+ {
+ md5_list_entry = find_file_in_md5_list(base64_md5);
+ if (md5_list_entry && file_size == md5_list_entry->file_size)
+ filename = md5_list_entry->full_path;
+ }
+
+ if (filename)
+ {
+ error = read_file_data(filename, missing, offset, data_size,
+ use_context, image_context);
+
+ if (error && (ENOENT != error))