52 current = current * 10 + (
c -
'0');
68 return ((
c >=
'a' &&
c <=
'z') || (
c >=
'A' &&
c <=
'Z') || (
c >=
'0' &&
c <=
'9') ||
74 uint elem_full_offset = 0;
78 return elem_full_offset;
83 uint elem_full_offset = 0;
87 return elem_full_offset;
93 const char *elem_src_trim = elem_src + elem_src_offset;
95 memcpy(elem_dst, elem_src_trim, elem_src_trim_len);
96 elem_dst[elem_src_trim_len] =
'\0';
97 return elem_src_trim_len;
105 memmove(elem, elem_trim, elem_trim_len);
106 elem[elem_trim_len] =
'\0';
107 return elem_trim_len;
111 const int elem_search_len,
112 const char *elem_full,
113 uint *r_elem_full_offset)
115 BLI_assert(strlen(elem_search) == elem_search_len);
117 const char *elem_full_trim = elem_full + elem_full_offset;
118 if (strncmp(elem_search, elem_full_trim, elem_search_len) == 0) {
119 const char c = elem_full_trim[elem_search_len];
121 *r_elem_full_offset = elem_full_offset;
129 const char *elem_src,
130 const int elem_src_len,
131 const char *elem_dst,
132 const int elem_dst_len,
133 const char *elem_src_full,
134 const int elem_src_full_len,
135 const uint elem_src_full_offset_len)
139 BLI_assert(strlen(elem_src_full) == elem_src_full_len);
143 const int elem_final_len = (elem_src_full_len - elem_src_len) + elem_dst_len;
146 if (elem_src_full_offset_len != 0) {
147 memcpy(elem_dst_full, elem_src_full, elem_src_full_offset_len);
148 i = elem_src_full_offset_len;
150 memcpy(&elem_dst_full[i], elem_dst, elem_dst_len + 1);
152 uint elem_src_full_offset_end = elem_src_full_offset_len + elem_src_len;
153 if (elem_src_full[elem_src_full_offset_end] !=
'\0') {
154 const int elem_full_tail_len = (elem_src_full_len - elem_src_full_offset_end);
155 memcpy(&elem_dst_full[i], &elem_src_full[elem_src_full_offset_end], elem_full_tail_len + 1);
156 i += elem_full_tail_len;
158 BLI_assert((strlen(elem_dst_full) == elem_final_len) && (i == elem_final_len));
159 return elem_dst_full;
170 const char *
const *pair =
ptr;
176 const char *
const *pair_a =
a;
177 const char *
const *pair_b =
b;
178 return (
STREQ(pair_a[0], pair_b[0]) &&
STREQ(pair_a[1], pair_b[1])) ? false :
true;
185 const char *
data[][2] = {
186 #define DNA_STRUCT_RENAME(old, new) {#old, #new},
187 #define DNA_STRUCT_RENAME_ELEM(struct_name, old, new)
189 #undef DNA_STRUCT_RENAME
190 #undef DNA_STRUCT_RENAME_ELEM
193 int elem_key, elem_val;
208 const char *renames[][2] = {
209 {
"uint8_t",
"uchar"},
210 {
"int16_t",
"short"},
211 {
"uint16_t",
"ushort"},
215 for (
int i = 0; i <
ARRAY_SIZE(renames); i++) {
220 *r_struct_map = struct_map;
229 if (r_elem_map !=
NULL) {
230 const char *
data[][3] = {
231 #define DNA_STRUCT_RENAME(old, new)
232 #define DNA_STRUCT_RENAME_ELEM(struct_name, old, new) {#struct_name, #old, #new},
234 #undef DNA_STRUCT_RENAME
235 #undef DNA_STRUCT_RENAME_ELEM
238 int elem_key, elem_val;
250 const char **str_pair =
MEM_mallocN(
sizeof(
char *) * 2, __func__);
252 str_pair[1] =
data[i][elem_key];
255 *r_elem_map = elem_map;
258 if (struct_map_local) {
281 if (
STREQ(
"bScreen", name)) {
285 if (
STREQ(
"Collection", name)) {
288 if (
STREQ(
"CollectionObject", name)) {
289 return "GroupObject";
297 if (
STREQ(
"Screen", name)) {
301 if (
STREQ(
"Group", name)) {
304 if (
STREQ(
"GroupObject", name)) {
305 return "CollectionObject";
325 memset(dst, 0,
size);
GHash * BLI_ghash_str_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
void * BLI_ghash_lookup_default(const GHash *gh, const void *key, void *val_default) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_new_ex(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
#define UNUSED_VARS_NDEBUG(...)
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SyclQueue void void * src
static int elem_offset(const SDNA *sdna, const char *type, const char *name, const SDNA_Struct *old)
static bool strhash_pair_cmp(const void *a, const void *b)
void _DNA_internal_memzero(void *dst, size_t size)
uint DNA_elem_id_strip(char *elem)
const char * DNA_struct_rename_legacy_hack_static_from_alias(const char *name)
char * DNA_elem_id_rename(struct MemArena *mem_arena, const char *elem_src, const int elem_src_len, const char *elem_dst, const int elem_dst_len, const char *elem_src_full, const int elem_src_full_len, const uint elem_src_full_offset_len)
void DNA_alias_maps(enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash **r_elem_map)
uint DNA_elem_id_offset_start(const char *elem_full)
void _DNA_internal_memcpy(void *dst, const void *src, size_t size)
uint DNA_elem_id_offset_end(const char *elem_full)
bool DNA_elem_id_match(const char *elem_search, const int elem_search_len, const char *elem_full, uint *r_elem_full_offset)
const char * DNA_struct_rename_legacy_hack_alias_from_static(const char *name)
uint DNA_elem_id_strip_copy(char *elem_dst, const char *elem_src)
int DNA_elem_array_size(const char *str)
static bool is_identifier(const char c)
static uint strhash_pair_p(const void *ptr)
@ DNA_RENAME_ALIAS_FROM_STATIC
@ DNA_RENAME_STATIC_FROM_ALIAS
static MemArena * mem_arena
void *(* MEM_mallocN)(size_t len, const char *str)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)