Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/indexer.c
| Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | if (fread(header, 12, 1, fp) != 1) { | ||||
| fprintf(stderr, "Couldn't read indexer file: %s\n", name); | fprintf(stderr, "Couldn't read indexer file: %s\n", name); | ||||
| fclose(fp); | fclose(fp); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| header[12] = 0; | header[12] = 0; | ||||
| if (memcmp(header, binary_header_str, 8) != 0) { | if (memcmp(header, binary_header_str, 8) != 0) { | ||||
| fprintf(stderr, "Error reading %s: Binary file type string missmatch\n", name); | fprintf(stderr, "Error reading %s: Binary file type string mismatch\n", name); | ||||
| fclose(fp); | fclose(fp); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (atoi(header + 9) != INDEX_FILE_VERSION) { | if (atoi(header + 9) != INDEX_FILE_VERSION) { | ||||
| fprintf(stderr, "Error reading %s: File version missmatch\n", name); | fprintf(stderr, "Error reading %s: File version mismatch\n", name); | ||||
| fclose(fp); | fclose(fp); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| idx = MEM_callocN(sizeof(struct anim_index), "anim_index"); | idx = MEM_callocN(sizeof(struct anim_index), "anim_index"); | ||||
| BLI_strncpy(idx->name, name, sizeof(idx->name)); | BLI_strncpy(idx->name, name, sizeof(idx->name)); | ||||
| Show All 16 Lines | for (i = 0; i < idx->num_entries; i++) { | ||||
| items_read += fread(&idx->entries[i].frameno, sizeof(int), 1, fp); | items_read += fread(&idx->entries[i].frameno, sizeof(int), 1, fp); | ||||
| items_read += fread(&idx->entries[i].seek_pos, sizeof(uint64_t), 1, fp); | items_read += fread(&idx->entries[i].seek_pos, sizeof(uint64_t), 1, fp); | ||||
| items_read += fread(&idx->entries[i].seek_pos_pts, sizeof(uint64_t), 1, fp); | items_read += fread(&idx->entries[i].seek_pos_pts, sizeof(uint64_t), 1, fp); | ||||
| items_read += fread(&idx->entries[i].seek_pos_dts, sizeof(uint64_t), 1, fp); | items_read += fread(&idx->entries[i].seek_pos_dts, sizeof(uint64_t), 1, fp); | ||||
| items_read += fread(&idx->entries[i].pts, sizeof(uint64_t), 1, fp); | items_read += fread(&idx->entries[i].pts, sizeof(uint64_t), 1, fp); | ||||
| } | } | ||||
| if (UNLIKELY(items_read != idx->num_entries * 5)) { | if (UNLIKELY(items_read != idx->num_entries * 5)) { | ||||
| fprintf(stderr, "Error: Element data size missmatch in: %s\n", name); | fprintf(stderr, "Error: Element data size mismatch in: %s\n", name); | ||||
| MEM_freeN(idx->entries); | MEM_freeN(idx->entries); | ||||
| MEM_freeN(idx); | MEM_freeN(idx); | ||||
| fclose(fp); | fclose(fp); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (((ENDIAN_ORDER == B_ENDIAN) != (header[8] == 'V'))) { | if (((ENDIAN_ORDER == B_ENDIAN) != (header[8] == 'V'))) { | ||||
| for (i = 0; i < idx->num_entries; i++) { | for (i = 0; i < idx->num_entries; i++) { | ||||
| ▲ Show 20 Lines • Show All 1,271 Lines • Show Last 20 Lines | |||||