Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/readfile.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | #ifdef USE_BHEAD_READ_ON_DEMAND | ||||
| off64_t file_offset; | off64_t file_offset; | ||||
| /** When set, the remainder of this allocation is the data, otherwise it needs to be read. */ | /** When set, the remainder of this allocation is the data, otherwise it needs to be read. */ | ||||
| bool has_data; | bool has_data; | ||||
| #endif | #endif | ||||
| bool is_memchunk_identical; | bool is_memchunk_identical; | ||||
| struct BHead bhead; | struct BHead bhead; | ||||
| } BHeadN; | } BHeadN; | ||||
| #define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -offsetof(BHeadN, bhead))) | #define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -(int64_t)offsetof(BHeadN, bhead))) | ||||
campbellbarton: Casting to `int` is fine in this case. As it's just a signed offset of a few bytes, otherwise… | |||||
| /* We could change this in the future, for now it's simplest if only data is delayed | /* We could change this in the future, for now it's simplest if only data is delayed | ||||
| * because ID names are used in lookup tables. */ | * because ID names are used in lookup tables. */ | ||||
| #define BHEAD_USE_READ_ON_DEMAND(bhead) ((bhead)->code == DATA) | #define BHEAD_USE_READ_ON_DEMAND(bhead) ((bhead)->code == DATA) | ||||
| /** | /** | ||||
| * This function ensures that reports are printed, | * This function ensures that reports are printed, | ||||
| * in the case of library linking errors this is important! | * in the case of library linking errors this is important! | ||||
| ▲ Show 20 Lines • Show All 8,907 Lines • Show Last 20 Lines | |||||
Casting to int is fine in this case. As it's just a signed offset of a few bytes, otherwise LGTM.