29 uint32_t *rect = (uint32_t *)thumb->
data.
data();
32 uint32_t *bottom =
top + ((
y - 1) *
x);
33 uint32_t *line = (uint32_t *)malloc(
x *
sizeof(uint32_t));
37 memcpy(line,
top,
x *
sizeof(uint32_t));
38 memcpy(
top, bottom,
x *
sizeof(uint32_t));
39 memcpy(bottom, line,
x *
sizeof(uint32_t));
49 memcpy(&
data, bytes, 4);
58 return (file->
read(file, buf, buf_len) == buf_len);
63 if (file->
seek !=
nullptr) {
64 if (file->
seek(file,
len, SEEK_CUR) == -1) {
71 constexpr size_t dummy_data_size = 4096;
74 const size_t len_chunk = std::min(
len, dummy_data_size);
75 if (
size_t(file->
read(file, dummy_data.
data(), len_chunk)) != len_chunk) {
93 if (!bhead.has_value()) {
101 switch (bhead->code) {
102 case MAKE_ID(
'T',
'E',
'S',
'T'): {
104 if (!
file_read(file, shape,
sizeof(shape))) {
111 size_t data_size = bhead->len -
sizeof(shape);
113 if (thumb->
width < 0 || thumb->
height < 0 || data_size != expected_size) {
123 case MAKE_ID(
'R',
'E',
'N',
'D'): {
143 char magic_bytes[12];
144 if (rawfile->
read(rawfile, magic_bytes,
sizeof(magic_bytes)) !=
sizeof(magic_bytes)) {
145 rawfile->
close(rawfile);
150 rawfile->
seek(rawfile, 0, SEEK_SET);
160 if (file !=
nullptr) {
166 if (file !=
nullptr) {
172 if (rawfile !=
nullptr) {
173 rawfile->
close(rawfile);
176 if (file ==
nullptr) {
181 if (!std::holds_alternative<BlenderHeader>(header_variant)) {
185 const BlenderHeader &header = std::get<BlenderHeader>(header_variant);
BLI_INLINE void BLI_endian_switch_int32(int *val) ATTR_NONNULL(1)
File and directory operations.
bool BLI_file_magic_is_gzip(const char header[4])
bool BLI_file_magic_is_zstd(const char header[4])
Wrapper for reading from various sources (e.g. raw files, compressed files, memory....
FileReader * BLI_filereader_new_zstd(FileReader *base) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FileReader * BLI_filereader_new_gzip(FileReader *base) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_kdtree_nd_ free(KDTree *tree)
int bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
std::optional< BHead > BLO_readfile_read_bhead(FileReader *file, BHeadType type, bool do_endian_swap)
#define MAKE_ID(a, b, c, d)
BMesh const char void * data
unsigned long long int uint64_t
static void endian_switch(uint8_t *ptr, int type_size)
blender::Array< uint8_t > data