DNA: move makesdna to C++
Also see #103343. The main complication here was that the `long` type was poisoned in GCC, but it's used by some included C++ headers. I removed the compile-dependent poison and added a new check for `long` and `ulong` so that they still can't be used in DNA. Pull Request: https://projects.blender.org/blender/blender/pulls/109617
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
*
|
||||
* PLEASE READ INSTRUCTIONS ABOUT ADDING VARIABLES IN 'DNA' STRUCTS IN
|
||||
*
|
||||
* intern/dna_genfile.c
|
||||
* intern/dna_genfile.cc
|
||||
* (ton)
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ extern "C" {
|
||||
/**
|
||||
* DNAstr contains the prebuilt SDNA structure defining the layouts of the types
|
||||
* used by this version of Blender. It is defined in a file dna.c, which is
|
||||
* generated by the `makesdna` program during the build process (see `makesdna.c`).
|
||||
* generated by the `makesdna` program during the build process (see `makesdna.cc`).
|
||||
*/
|
||||
extern const unsigned char DNAstr[];
|
||||
/** Length of DNAstr. */
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef struct LinkData {
|
||||
void *data;
|
||||
} LinkData;
|
||||
|
||||
/** Never change the size of this! dna_genfile.c detects pointer_size with it. */
|
||||
/** Never change the size of this! dna_genfile.cc detects pointer_size with it. */
|
||||
typedef struct ListBase {
|
||||
void *first, *last;
|
||||
} ListBase;
|
||||
|
||||
@@ -43,8 +43,8 @@ file(GENERATE OUTPUT ${dna_header_string_file} CONTENT "${DNA_FILE_LIST}")
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build makesdna executable
|
||||
set(SRC
|
||||
dna_utils.c
|
||||
makesdna.c
|
||||
dna_utils.cc
|
||||
makesdna.cc
|
||||
../../blenlib/intern/BLI_assert.c
|
||||
../../blenlib/intern/BLI_ghash.c
|
||||
../../blenlib/intern/BLI_ghash_utils.c
|
||||
@@ -107,8 +107,8 @@ add_custom_command(
|
||||
# Build bf_dna library
|
||||
set(SRC
|
||||
dna_defaults.c
|
||||
dna_genfile.c
|
||||
dna_utils.c
|
||||
dna_genfile.cc
|
||||
dna_utils.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/dna.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
|
||||
${SRC_DNA_INC}
|
||||
|
||||
@@ -134,7 +134,7 @@ void DNA_sdna_free(SDNA *sdna)
|
||||
|
||||
#ifdef WITH_DNA_GHASH
|
||||
if (sdna->structs_map) {
|
||||
BLI_ghash_free(sdna->structs_map, NULL, NULL);
|
||||
BLI_ghash_free(sdna->structs_map, nullptr, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -146,7 +146,7 @@ void DNA_sdna_free(SDNA *sdna)
|
||||
MEM_SAFE_FREE(sdna->alias.types);
|
||||
#ifdef WITH_DNA_GHASH
|
||||
if (sdna->alias.structs_map) {
|
||||
BLI_ghash_free(sdna->alias.structs_map, NULL, NULL);
|
||||
BLI_ghash_free(sdna->alias.structs_map, nullptr, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -203,7 +203,7 @@ static void printstruct(SDNA *sdna, short strnr)
|
||||
static int dna_struct_find_nr_ex_impl(
|
||||
/* From SDNA struct. */
|
||||
const char **types,
|
||||
const int UNUSED(types_len),
|
||||
const int /*types_len*/,
|
||||
SDNA_Struct **const structs,
|
||||
const int structs_len,
|
||||
#ifdef WITH_DNA_GHASH
|
||||
@@ -262,7 +262,7 @@ int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
int DNA_struct_alias_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
{
|
||||
#ifdef WITH_DNA_GHASH
|
||||
BLI_assert(sdna->alias.structs_map != NULL);
|
||||
BLI_assert(sdna->alias.structs_map != nullptr);
|
||||
#endif
|
||||
return dna_struct_find_nr_ex_impl(
|
||||
/* Expand SDNA. */
|
||||
@@ -309,13 +309,13 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
||||
int *data = (int *)sdna->data;
|
||||
|
||||
/* Clear pointers in case of error. */
|
||||
sdna->names = NULL;
|
||||
sdna->types = NULL;
|
||||
sdna->structs = NULL;
|
||||
sdna->names = nullptr;
|
||||
sdna->types = nullptr;
|
||||
sdna->structs = nullptr;
|
||||
#ifdef WITH_DNA_GHASH
|
||||
sdna->structs_map = NULL;
|
||||
sdna->structs_map = nullptr;
|
||||
#endif
|
||||
sdna->mem_arena = NULL;
|
||||
sdna->mem_arena = nullptr;
|
||||
|
||||
/* Lazy initialize. */
|
||||
memset(&sdna->alias, 0, sizeof(sdna->alias));
|
||||
@@ -340,7 +340,8 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
||||
sdna->names_len_alloc = sdna->names_len;
|
||||
|
||||
data++;
|
||||
sdna->names = MEM_callocN(sizeof(void *) * sdna->names_len, "sdnanames");
|
||||
sdna->names = static_cast<const char **>(
|
||||
MEM_callocN(sizeof(void *) * sdna->names_len, "sdnanames"));
|
||||
}
|
||||
else {
|
||||
*r_error_message = "NAME error in SDNA file";
|
||||
@@ -379,7 +380,8 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
||||
}
|
||||
|
||||
data++;
|
||||
sdna->types = MEM_callocN(sizeof(void *) * sdna->types_len, "sdnatypes");
|
||||
sdna->types = static_cast<const char **>(
|
||||
MEM_callocN(sizeof(void *) * sdna->types_len, "sdnatypes"));
|
||||
}
|
||||
else {
|
||||
*r_error_message = "TYPE error in SDNA file";
|
||||
@@ -432,7 +434,8 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
||||
}
|
||||
|
||||
data++;
|
||||
sdna->structs = MEM_callocN(sizeof(SDNA_Struct *) * sdna->structs_len, "sdnastrcs");
|
||||
sdna->structs = static_cast<SDNA_Struct **>(
|
||||
MEM_callocN(sizeof(SDNA_Struct *) * sdna->structs_len, "sdnastrcs"));
|
||||
}
|
||||
else {
|
||||
*r_error_message = "STRC error in SDNA file";
|
||||
@@ -507,7 +510,8 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
||||
|
||||
/* Cache name size. */
|
||||
{
|
||||
short *names_array_len = MEM_mallocN(sizeof(*names_array_len) * sdna->names_len, __func__);
|
||||
short *names_array_len = static_cast<short int *>(
|
||||
MEM_mallocN(sizeof(*names_array_len) * sdna->names_len, __func__));
|
||||
for (int i = 0; i < sdna->names_len; i++) {
|
||||
names_array_len[i] = DNA_elem_array_size(sdna->names[i]);
|
||||
}
|
||||
@@ -523,17 +527,17 @@ SDNA *DNA_sdna_from_data(const void *data,
|
||||
bool data_alloc,
|
||||
const char **r_error_message)
|
||||
{
|
||||
SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna");
|
||||
const char *error_message = NULL;
|
||||
SDNA *sdna = static_cast<SDNA *>(MEM_mallocN(sizeof(*sdna), "sdna"));
|
||||
const char *error_message = nullptr;
|
||||
|
||||
sdna->data_len = data_len;
|
||||
if (data_alloc) {
|
||||
char *data_copy = MEM_mallocN(data_len, "sdna_data");
|
||||
char *data_copy = static_cast<char *>(MEM_mallocN(data_len, "sdna_data"));
|
||||
memcpy(data_copy, data, data_len);
|
||||
sdna->data = data_copy;
|
||||
}
|
||||
else {
|
||||
sdna->data = data;
|
||||
sdna->data = static_cast<const char *>(data);
|
||||
}
|
||||
sdna->data_alloc = data_alloc;
|
||||
|
||||
@@ -541,14 +545,14 @@ SDNA *DNA_sdna_from_data(const void *data,
|
||||
return sdna;
|
||||
}
|
||||
|
||||
if (r_error_message == NULL) {
|
||||
if (r_error_message == nullptr) {
|
||||
fprintf(stderr, "Error decoding blend file SDNA: %s\n", error_message);
|
||||
}
|
||||
else {
|
||||
*r_error_message = error_message;
|
||||
}
|
||||
DNA_sdna_free(sdna);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,23 +561,23 @@ SDNA *DNA_sdna_from_data(const void *data,
|
||||
*
|
||||
* So it is safe to create once and reuse.
|
||||
*/
|
||||
static SDNA *g_sdna = NULL;
|
||||
static SDNA *g_sdna = nullptr;
|
||||
|
||||
void DNA_sdna_current_init(void)
|
||||
{
|
||||
g_sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, NULL);
|
||||
g_sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, nullptr);
|
||||
}
|
||||
|
||||
const SDNA *DNA_sdna_current_get(void)
|
||||
{
|
||||
BLI_assert(g_sdna != NULL);
|
||||
BLI_assert(g_sdna != nullptr);
|
||||
return g_sdna;
|
||||
}
|
||||
|
||||
void DNA_sdna_current_free(void)
|
||||
{
|
||||
DNA_sdna_free(g_sdna);
|
||||
g_sdna = NULL;
|
||||
g_sdna = nullptr;
|
||||
}
|
||||
|
||||
/* ******************** END READ DNA ********************** */
|
||||
@@ -665,10 +669,10 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
|
||||
{
|
||||
if (oldsdna->structs_len == 0) {
|
||||
printf("error: file without SDNA\n");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char *compare_flags = MEM_mallocN(oldsdna->structs_len, "compare flags");
|
||||
char *compare_flags = static_cast<char *>(MEM_mallocN(oldsdna->structs_len, "compare flags"));
|
||||
memset(compare_flags, SDNA_CMP_UNKNOWN, oldsdna->structs_len);
|
||||
|
||||
/* Set correct flag for every struct. */
|
||||
@@ -1225,15 +1229,19 @@ void *DNA_struct_reconstruct(const DNA_ReconstructInfo *reconstruct_info,
|
||||
const int new_struct_nr = DNA_struct_find_nr(newsdna, type_name);
|
||||
|
||||
if (new_struct_nr == -1) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const SDNA_Struct *new_struct = newsdna->structs[new_struct_nr];
|
||||
const int new_block_size = newsdna->types_size[new_struct->type];
|
||||
|
||||
char *new_blocks = MEM_callocN(blocks * new_block_size, "reconstruct");
|
||||
reconstruct_structs(
|
||||
reconstruct_info, blocks, old_struct_nr, new_struct_nr, old_blocks, new_blocks);
|
||||
char *new_blocks = static_cast<char *>(MEM_callocN(blocks * new_block_size, "reconstruct"));
|
||||
reconstruct_structs(reconstruct_info,
|
||||
blocks,
|
||||
old_struct_nr,
|
||||
new_struct_nr,
|
||||
static_cast<const char *>(old_blocks),
|
||||
new_blocks);
|
||||
return new_blocks;
|
||||
}
|
||||
|
||||
@@ -1253,7 +1261,7 @@ static const SDNA_StructMember *find_member_with_matching_name(const SDNA *sdna,
|
||||
}
|
||||
offset += get_member_size_in_bytes(sdna, member);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/** Initializes a single reconstruct step for a member in the new struct. */
|
||||
@@ -1272,7 +1280,7 @@ static void init_reconstruct_step_for_member(const SDNA *oldsdna,
|
||||
const SDNA_StructMember *old_member = find_member_with_matching_name(
|
||||
oldsdna, old_struct, new_name, &old_member_offset);
|
||||
|
||||
if (old_member == NULL) {
|
||||
if (old_member == nullptr) {
|
||||
/* No matching member has been found in the old struct. */
|
||||
r_step->type = RECONSTRUCT_STEP_INIT_ZERO;
|
||||
return;
|
||||
@@ -1301,7 +1309,7 @@ static void init_reconstruct_step_for_member(const SDNA *oldsdna,
|
||||
if (STREQ(new_type_name, old_type_name)) {
|
||||
const int old_struct_nr = DNA_struct_find_nr(oldsdna, old_type_name);
|
||||
BLI_assert(old_struct_nr != -1);
|
||||
enum eSDNA_StructCompare compare_flag = compare_flags[old_struct_nr];
|
||||
enum eSDNA_StructCompare compare_flag = eSDNA_StructCompare(compare_flags[old_struct_nr]);
|
||||
BLI_assert(compare_flag != SDNA_CMP_REMOVED);
|
||||
if (compare_flag == SDNA_CMP_EQUAL) {
|
||||
/* The old and new members are identical, just do a #memcpy. */
|
||||
@@ -1345,8 +1353,8 @@ static void init_reconstruct_step_for_member(const SDNA *oldsdna,
|
||||
r_step->data.cast_primitive.array_len = shared_array_length;
|
||||
r_step->data.cast_primitive.new_offset = new_member_offset;
|
||||
r_step->data.cast_primitive.old_offset = old_member_offset;
|
||||
r_step->data.cast_primitive.new_type = new_member->type;
|
||||
r_step->data.cast_primitive.old_type = old_member->type;
|
||||
r_step->data.cast_primitive.new_type = eSDNA_Type(new_member->type);
|
||||
r_step->data.cast_primitive.old_type = eSDNA_Type(old_member->type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1448,8 +1456,8 @@ static ReconstructStep *create_reconstruct_steps_for_struct(const SDNA *oldsdna,
|
||||
const SDNA_Struct *old_struct,
|
||||
const SDNA_Struct *new_struct)
|
||||
{
|
||||
ReconstructStep *steps = MEM_calloc_arrayN(
|
||||
new_struct->members_len, sizeof(ReconstructStep), __func__);
|
||||
ReconstructStep *steps = static_cast<ReconstructStep *>(
|
||||
MEM_calloc_arrayN(new_struct->members_len, sizeof(ReconstructStep), __func__));
|
||||
|
||||
int new_member_offset = 0;
|
||||
for (int new_member_index = 0; new_member_index < new_struct->members_len; new_member_index++) {
|
||||
@@ -1514,13 +1522,15 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna,
|
||||
const SDNA *newsdna,
|
||||
const char *compare_flags)
|
||||
{
|
||||
DNA_ReconstructInfo *reconstruct_info = MEM_callocN(sizeof(DNA_ReconstructInfo), __func__);
|
||||
DNA_ReconstructInfo *reconstruct_info = static_cast<DNA_ReconstructInfo *>(
|
||||
MEM_callocN(sizeof(DNA_ReconstructInfo), __func__));
|
||||
reconstruct_info->oldsdna = oldsdna;
|
||||
reconstruct_info->newsdna = newsdna;
|
||||
reconstruct_info->compare_flags = compare_flags;
|
||||
reconstruct_info->step_counts = MEM_malloc_arrayN(newsdna->structs_len, sizeof(int), __func__);
|
||||
reconstruct_info->steps = MEM_malloc_arrayN(
|
||||
newsdna->structs_len, sizeof(ReconstructStep *), __func__);
|
||||
reconstruct_info->step_counts = static_cast<int *>(
|
||||
MEM_malloc_arrayN(newsdna->structs_len, sizeof(int), __func__));
|
||||
reconstruct_info->steps = static_cast<ReconstructStep **>(
|
||||
MEM_malloc_arrayN(newsdna->structs_len, sizeof(ReconstructStep *), __func__));
|
||||
|
||||
/* Generate reconstruct steps for all structs. */
|
||||
for (int new_struct_nr = 0; new_struct_nr < newsdna->structs_len; new_struct_nr++) {
|
||||
@@ -1528,7 +1538,7 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna,
|
||||
const char *new_struct_name = newsdna->types[new_struct->type];
|
||||
const int old_struct_nr = DNA_struct_find_nr(oldsdna, new_struct_name);
|
||||
if (old_struct_nr < 0) {
|
||||
reconstruct_info->steps[new_struct_nr] = NULL;
|
||||
reconstruct_info->steps[new_struct_nr] = nullptr;
|
||||
reconstruct_info->step_counts[new_struct_nr] = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -1560,7 +1570,7 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna,
|
||||
void DNA_reconstruct_info_free(DNA_ReconstructInfo *reconstruct_info)
|
||||
{
|
||||
for (int a = 0; a < reconstruct_info->newsdna->structs_len; a++) {
|
||||
if (reconstruct_info->steps[a] != NULL) {
|
||||
if (reconstruct_info->steps[a] != nullptr) {
|
||||
MEM_freeN(reconstruct_info->steps[a]);
|
||||
}
|
||||
}
|
||||
@@ -1653,7 +1663,7 @@ static bool DNA_sdna_patch_struct_nr(SDNA *sdna,
|
||||
BLI_assert(DNA_struct_find_nr(DNA_sdna_current_get(), struct_name_new) != -1);
|
||||
const SDNA_Struct *struct_info = sdna->structs[struct_name_old_nr];
|
||||
#ifdef WITH_DNA_GHASH
|
||||
BLI_ghash_remove(sdna->structs_map, (void *)sdna->types[struct_info->type], NULL, NULL);
|
||||
BLI_ghash_remove(sdna->structs_map, (void *)sdna->types[struct_info->type], nullptr, nullptr);
|
||||
BLI_ghash_insert(
|
||||
sdna->structs_map, (void *)struct_name_new, POINTER_FROM_INT(struct_name_old_nr));
|
||||
#endif
|
||||
@@ -1677,10 +1687,10 @@ static bool DNA_sdna_patch_struct_member_nr(SDNA *sdna,
|
||||
{
|
||||
/* These names aren't handled here (it's not used).
|
||||
* Ensure they are never used or we get out of sync arrays. */
|
||||
BLI_assert(sdna->alias.names == NULL);
|
||||
BLI_assert(sdna->alias.names == nullptr);
|
||||
const int elem_old_len = strlen(elem_old);
|
||||
const int elem_new_len = strlen(elem_new);
|
||||
BLI_assert(elem_new != NULL);
|
||||
BLI_assert(elem_new != nullptr);
|
||||
SDNA_Struct *sp = sdna->structs[struct_name_nr];
|
||||
for (int elem_index = sp->members_len; elem_index > 0; elem_index--) {
|
||||
SDNA_StructMember *member = &sp->members[elem_index];
|
||||
@@ -1688,7 +1698,7 @@ static bool DNA_sdna_patch_struct_member_nr(SDNA *sdna,
|
||||
/* Start & end offsets in 'elem_old_full'. */
|
||||
uint elem_old_full_offset_start;
|
||||
if (DNA_elem_id_match(elem_old, elem_old_len, elem_old_full, &elem_old_full_offset_start)) {
|
||||
if (sdna->mem_arena == NULL) {
|
||||
if (sdna->mem_arena == nullptr) {
|
||||
sdna->mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
|
||||
}
|
||||
const char *elem_new_full = DNA_elem_id_rename(sdna->mem_arena,
|
||||
@@ -1702,10 +1712,11 @@ static bool DNA_sdna_patch_struct_member_nr(SDNA *sdna,
|
||||
|
||||
if (sdna->names_len == sdna->names_len_alloc) {
|
||||
sdna->names_len_alloc += 64;
|
||||
sdna->names = MEM_recallocN((void *)sdna->names,
|
||||
sizeof(*sdna->names) * sdna->names_len_alloc);
|
||||
sdna->names_array_len = MEM_recallocN(
|
||||
(void *)sdna->names_array_len, sizeof(*sdna->names_array_len) * sdna->names_len_alloc);
|
||||
sdna->names = static_cast<const char **>(
|
||||
MEM_recallocN((void *)sdna->names, sizeof(*sdna->names) * sdna->names_len_alloc));
|
||||
sdna->names_array_len = static_cast<short int *>(
|
||||
MEM_recallocN((void *)sdna->names_array_len,
|
||||
sizeof(*sdna->names_array_len) * sdna->names_len_alloc));
|
||||
}
|
||||
const short name_nr_prev = member->name;
|
||||
member->name = sdna->names_len++;
|
||||
@@ -1750,9 +1761,10 @@ static void sdna_expand_names(SDNA *sdna)
|
||||
const SDNA_Struct *struct_old = sdna->structs[struct_nr];
|
||||
names_expand_len += struct_old->members_len;
|
||||
}
|
||||
const char **names_expand = MEM_mallocN(sizeof(*names_expand) * names_expand_len, __func__);
|
||||
short *names_array_len_expand = MEM_mallocN(sizeof(*names_array_len_expand) * names_expand_len,
|
||||
__func__);
|
||||
const char **names_expand = static_cast<const char **>(
|
||||
MEM_mallocN(sizeof(*names_expand) * names_expand_len, __func__));
|
||||
short *names_array_len_expand = static_cast<short int *>(
|
||||
MEM_mallocN(sizeof(*names_array_len_expand) * names_expand_len, __func__));
|
||||
|
||||
int names_expand_index = 0;
|
||||
for (int struct_nr = 0; struct_nr < sdna->structs_len; struct_nr++) {
|
||||
@@ -1760,7 +1772,8 @@ static void sdna_expand_names(SDNA *sdna)
|
||||
const SDNA_Struct *struct_old = sdna->structs[struct_nr];
|
||||
|
||||
const int array_size = sizeof(short) * 2 + sizeof(SDNA_StructMember) * struct_old->members_len;
|
||||
SDNA_Struct *struct_new = BLI_memarena_alloc(sdna->mem_arena, array_size);
|
||||
SDNA_Struct *struct_new = static_cast<SDNA_Struct *>(
|
||||
BLI_memarena_alloc(sdna->mem_arena, array_size));
|
||||
memcpy(struct_new, struct_old, array_size);
|
||||
sdna->structs[struct_nr] = struct_new;
|
||||
|
||||
@@ -1791,10 +1804,11 @@ static const char *dna_sdna_alias_from_static_elem_full(SDNA *sdna,
|
||||
const char *elem_static_full)
|
||||
{
|
||||
const int elem_static_full_len = strlen(elem_static_full);
|
||||
char *elem_static = alloca(elem_static_full_len + 1);
|
||||
char *elem_static = static_cast<char *>(alloca(elem_static_full_len + 1));
|
||||
const int elem_static_len = DNA_elem_id_strip_copy(elem_static, elem_static_full);
|
||||
const char *str_pair[2] = {struct_name_static, elem_static};
|
||||
const char *elem_alias = BLI_ghash_lookup(elem_map_alias_from_static, str_pair);
|
||||
const char *elem_alias = static_cast<const char *>(
|
||||
BLI_ghash_lookup(elem_map_alias_from_static, str_pair));
|
||||
if (elem_alias) {
|
||||
return DNA_elem_id_rename(sdna->mem_arena,
|
||||
elem_static,
|
||||
@@ -1805,7 +1819,7 @@ static const char *dna_sdna_alias_from_static_elem_full(SDNA *sdna,
|
||||
elem_static_full_len,
|
||||
DNA_elem_id_offset_start(elem_static_full));
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DNA_sdna_alias_data_ensure(SDNA *sdna)
|
||||
@@ -1813,7 +1827,7 @@ void DNA_sdna_alias_data_ensure(SDNA *sdna)
|
||||
/* We may want this to be optional later. */
|
||||
const bool use_legacy_hack = true;
|
||||
|
||||
if (sdna->mem_arena == NULL) {
|
||||
if (sdna->mem_arena == nullptr) {
|
||||
sdna->mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
|
||||
}
|
||||
|
||||
@@ -1823,8 +1837,9 @@ void DNA_sdna_alias_data_ensure(SDNA *sdna)
|
||||
DNA_alias_maps(
|
||||
DNA_RENAME_ALIAS_FROM_STATIC, &struct_map_alias_from_static, &elem_map_alias_from_static);
|
||||
|
||||
if (sdna->alias.types == NULL) {
|
||||
sdna->alias.types = MEM_mallocN(sizeof(*sdna->alias.types) * sdna->types_len, __func__);
|
||||
if (sdna->alias.types == nullptr) {
|
||||
sdna->alias.types = static_cast<const char **>(
|
||||
MEM_mallocN(sizeof(*sdna->alias.types) * sdna->types_len, __func__));
|
||||
for (int type_nr = 0; type_nr < sdna->types_len; type_nr++) {
|
||||
const char *struct_name_static = sdna->types[type_nr];
|
||||
|
||||
@@ -1832,14 +1847,15 @@ void DNA_sdna_alias_data_ensure(SDNA *sdna)
|
||||
struct_name_static = DNA_struct_rename_legacy_hack_alias_from_static(struct_name_static);
|
||||
}
|
||||
|
||||
sdna->alias.types[type_nr] = BLI_ghash_lookup_default(
|
||||
struct_map_alias_from_static, struct_name_static, (void *)struct_name_static);
|
||||
sdna->alias.types[type_nr] = static_cast<const char *>(BLI_ghash_lookup_default(
|
||||
struct_map_alias_from_static, struct_name_static, (void *)struct_name_static));
|
||||
}
|
||||
}
|
||||
|
||||
if (sdna->alias.names == NULL) {
|
||||
if (sdna->alias.names == nullptr) {
|
||||
sdna_expand_names(sdna);
|
||||
sdna->alias.names = MEM_mallocN(sizeof(*sdna->alias.names) * sdna->names_len, __func__);
|
||||
sdna->alias.names = static_cast<const char **>(
|
||||
MEM_mallocN(sizeof(*sdna->alias.names) * sdna->names_len, __func__));
|
||||
for (int struct_nr = 0; struct_nr < sdna->structs_len; struct_nr++) {
|
||||
const SDNA_Struct *struct_info = sdna->structs[struct_nr];
|
||||
const char *struct_name_static = sdna->types[struct_info->type];
|
||||
@@ -1852,7 +1868,7 @@ void DNA_sdna_alias_data_ensure(SDNA *sdna)
|
||||
const SDNA_StructMember *member = &struct_info->members[a];
|
||||
const char *elem_alias_full = dna_sdna_alias_from_static_elem_full(
|
||||
sdna, elem_map_alias_from_static, struct_name_static, sdna->names[member->name]);
|
||||
if (elem_alias_full != NULL) {
|
||||
if (elem_alias_full != nullptr) {
|
||||
sdna->alias.names[member->name] = elem_alias_full;
|
||||
}
|
||||
else {
|
||||
@@ -1861,8 +1877,8 @@ void DNA_sdna_alias_data_ensure(SDNA *sdna)
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_ghash_free(struct_map_alias_from_static, NULL, NULL);
|
||||
BLI_ghash_free(elem_map_alias_from_static, MEM_freeN, NULL);
|
||||
BLI_ghash_free(struct_map_alias_from_static, nullptr, nullptr);
|
||||
BLI_ghash_free(elem_map_alias_from_static, MEM_freeN, nullptr);
|
||||
}
|
||||
|
||||
void DNA_sdna_alias_data_ensure_structs_map(SDNA *sdna)
|
||||
@@ -11,7 +11,7 @@
|
||||
* - When renaming the member of a struct which has itself been renamed
|
||||
* refer to the newer name, not the original.
|
||||
*
|
||||
* - Changes here only change generated code for `makesdna.c` and `makesrna.c`
|
||||
* - Changes here only change generated code for `makesdna.cc` and `makesrna.c`
|
||||
* without impacting Blender's run-time, besides allowing us to use the new names.
|
||||
*
|
||||
* - Renaming something that has already been renamed can be done
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/** \file
|
||||
* \ingroup DNA
|
||||
*
|
||||
* Utilities for stand-alone `makesdna.c` and Blender to share.
|
||||
* Utilities for stand-alone `makesdna.cc` and Blender to share.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@@ -142,7 +142,7 @@ char *DNA_elem_id_rename(MemArena *mem_arena,
|
||||
UNUSED_VARS_NDEBUG(elem_src);
|
||||
|
||||
const int elem_final_len = (elem_src_full_len - elem_src_len) + elem_dst_len;
|
||||
char *elem_dst_full = BLI_memarena_alloc(mem_arena, elem_final_len + 1);
|
||||
char *elem_dst_full = static_cast<char *>(BLI_memarena_alloc(mem_arena, elem_final_len + 1));
|
||||
uint i = 0;
|
||||
if (elem_src_full_offset_len != 0) {
|
||||
memcpy(elem_dst_full, elem_src_full, elem_src_full_offset_len);
|
||||
@@ -168,20 +168,20 @@ char *DNA_elem_id_rename(MemArena *mem_arena,
|
||||
|
||||
static uint strhash_pair_p(const void *ptr)
|
||||
{
|
||||
const char *const *pair = ptr;
|
||||
const char *const *pair = static_cast<const char *const *>(ptr);
|
||||
return (BLI_ghashutil_strhash_p(pair[0]) ^ BLI_ghashutil_strhash_p(pair[1]));
|
||||
}
|
||||
|
||||
static bool strhash_pair_cmp(const void *a, const void *b)
|
||||
{
|
||||
const char *const *pair_a = a;
|
||||
const char *const *pair_b = b;
|
||||
const char *const *pair_a = static_cast<const char *const *>(a);
|
||||
const char *const *pair_b = static_cast<const char *const *>(b);
|
||||
return (STREQ(pair_a[0], pair_b[0]) && STREQ(pair_a[1], pair_b[1])) ? false : true;
|
||||
}
|
||||
|
||||
void DNA_alias_maps(enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash **r_elem_map)
|
||||
{
|
||||
GHash *struct_map_local = NULL;
|
||||
GHash *struct_map_local = nullptr;
|
||||
if (r_struct_map) {
|
||||
const char *data[][2] = {
|
||||
#define DNA_STRUCT_RENAME(old, new) {#old, #new},
|
||||
@@ -227,7 +227,7 @@ void DNA_alias_maps(enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash
|
||||
}
|
||||
}
|
||||
|
||||
if (r_elem_map != NULL) {
|
||||
if (r_elem_map != nullptr) {
|
||||
const char *data[][3] = {
|
||||
#define DNA_STRUCT_RENAME(old, new)
|
||||
#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new) {#struct_name, #old, #new},
|
||||
@@ -248,8 +248,10 @@ void DNA_alias_maps(enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash
|
||||
GHash *elem_map = BLI_ghash_new_ex(
|
||||
strhash_pair_p, strhash_pair_cmp, __func__, ARRAY_SIZE(data));
|
||||
for (int i = 0; i < ARRAY_SIZE(data); i++) {
|
||||
const char **str_pair = MEM_mallocN(sizeof(char *) * 2, __func__);
|
||||
str_pair[0] = BLI_ghash_lookup_default(struct_map_local, data[i][0], (void *)data[i][0]);
|
||||
const char **str_pair = static_cast<const char **>(
|
||||
MEM_mallocN(sizeof(char *) * 2, __func__));
|
||||
str_pair[0] = static_cast<const char *>(
|
||||
BLI_ghash_lookup_default(struct_map_local, data[i][0], (void *)data[i][0]));
|
||||
str_pair[1] = data[i][elem_key];
|
||||
BLI_ghash_insert(elem_map, (void *)str_pair, (void *)data[i][elem_val]);
|
||||
}
|
||||
@@ -257,7 +259,7 @@ void DNA_alias_maps(enum eDNA_RenameDir version_dir, GHash **r_struct_map, GHash
|
||||
}
|
||||
|
||||
if (struct_map_local) {
|
||||
BLI_ghash_free(struct_map_local, NULL, NULL);
|
||||
BLI_ghash_free(struct_map_local, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,14 +316,14 @@ const char *DNA_struct_rename_legacy_hack_alias_from_static(const char *name)
|
||||
/** \name Internal helpers for C++
|
||||
* \{ */
|
||||
|
||||
void _DNA_internal_memcpy(void *dst, const void *src, size_t size);
|
||||
void _DNA_internal_memcpy(void *dst, const void *src, const size_t size)
|
||||
extern "C" void _DNA_internal_memcpy(void *dst, const void *src, size_t size);
|
||||
extern "C" void _DNA_internal_memcpy(void *dst, const void *src, const size_t size)
|
||||
{
|
||||
memcpy(dst, src, size);
|
||||
}
|
||||
|
||||
void _DNA_internal_memzero(void *dst, size_t size);
|
||||
void _DNA_internal_memzero(void *dst, const size_t size)
|
||||
extern "C" void _DNA_internal_memzero(void *dst, size_t size);
|
||||
extern "C" void _DNA_internal_memzero(void *dst, const size_t size)
|
||||
{
|
||||
memset(dst, 0, size);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ static const char *includefiles[] = {
|
||||
/** \name Variables
|
||||
* \{ */
|
||||
|
||||
static MemArena *mem_arena = NULL;
|
||||
static MemArena *mem_arena = nullptr;
|
||||
|
||||
static int max_data_size = 500000, max_array_len = 50000;
|
||||
static int names_len = 0;
|
||||
@@ -90,7 +90,7 @@ static struct {
|
||||
GHash *struct_map_static_from_alias;
|
||||
GHash *elem_map_alias_from_static;
|
||||
GHash *elem_map_static_from_alias;
|
||||
} g_version_data = {NULL};
|
||||
} g_version_data = {nullptr};
|
||||
|
||||
/**
|
||||
* Variable to control debug output of makesdna.
|
||||
@@ -213,8 +213,9 @@ static bool match_identifier_and_advance(char **str_ptr, const char *identifier)
|
||||
|
||||
static const char *version_struct_static_from_alias(const char *str)
|
||||
{
|
||||
const char *str_test = BLI_ghash_lookup(g_version_data.struct_map_static_from_alias, str);
|
||||
if (str_test != NULL) {
|
||||
const char *str_test = static_cast<const char *>(
|
||||
BLI_ghash_lookup(g_version_data.struct_map_static_from_alias, str));
|
||||
if (str_test != nullptr) {
|
||||
return str_test;
|
||||
}
|
||||
return str;
|
||||
@@ -222,8 +223,9 @@ static const char *version_struct_static_from_alias(const char *str)
|
||||
|
||||
static const char *version_struct_alias_from_static(const char *str)
|
||||
{
|
||||
const char *str_test = BLI_ghash_lookup(g_version_data.struct_map_alias_from_static, str);
|
||||
if (str_test != NULL) {
|
||||
const char *str_test = static_cast<const char *>(
|
||||
BLI_ghash_lookup(g_version_data.struct_map_alias_from_static, str));
|
||||
if (str_test != nullptr) {
|
||||
return str_test;
|
||||
}
|
||||
return str;
|
||||
@@ -232,11 +234,12 @@ static const char *version_struct_alias_from_static(const char *str)
|
||||
static const char *version_elem_static_from_alias(const int strct, const char *elem_alias_full)
|
||||
{
|
||||
const uint elem_alias_full_len = strlen(elem_alias_full);
|
||||
char *elem_alias = alloca(elem_alias_full_len + 1);
|
||||
char *elem_alias = static_cast<char *>(alloca(elem_alias_full_len + 1));
|
||||
const int elem_alias_len = DNA_elem_id_strip_copy(elem_alias, elem_alias_full);
|
||||
const char *str_pair[2] = {types[strct], elem_alias};
|
||||
const char *elem_static = BLI_ghash_lookup(g_version_data.elem_map_static_from_alias, str_pair);
|
||||
if (elem_static != NULL) {
|
||||
const char *elem_static = static_cast<const char *>(
|
||||
BLI_ghash_lookup(g_version_data.elem_map_static_from_alias, str_pair));
|
||||
if (elem_static != nullptr) {
|
||||
return DNA_elem_id_rename(mem_arena,
|
||||
elem_alias,
|
||||
elem_alias_len,
|
||||
@@ -256,7 +259,7 @@ static const char *version_elem_static_from_alias(const int strct, const char *e
|
||||
static bool is_name_legal(const char *name)
|
||||
{
|
||||
const int name_size = strlen(name) + 1;
|
||||
char *name_strip = alloca(name_size);
|
||||
char *name_strip = static_cast<char *>(alloca(name_size));
|
||||
DNA_elem_id_strip_copy(name_strip, name);
|
||||
|
||||
const char prefix[] = {'p', 'a', 'd'};
|
||||
@@ -322,7 +325,7 @@ static int add_type(const char *str, int size)
|
||||
|
||||
/* append new type */
|
||||
const int str_size = strlen(str) + 1;
|
||||
char *cp = BLI_memarena_alloc(mem_arena, str_size);
|
||||
char *cp = static_cast<char *>(BLI_memarena_alloc(mem_arena, str_size));
|
||||
memcpy(cp, str, str_size);
|
||||
types[types_len] = cp;
|
||||
types_size_native[types_len] = size;
|
||||
@@ -361,7 +364,7 @@ static int add_name(const char *str)
|
||||
* `void (*function)(...)` and `float (*array)[..]`. the array case
|
||||
* name is still converted to (array *)() though because it is that
|
||||
* way in old DNA too, and works correct with #DNA_elem_size_nr. */
|
||||
int isfuncptr = (strchr(str + 1, '(')) != NULL;
|
||||
int isfuncptr = (strchr(str + 1, '(')) != nullptr;
|
||||
|
||||
DEBUG_PRINTF(3, "\t\t\t\t*** Function pointer or multidim array pointer found\n");
|
||||
/* function-pointer: transform the type (sometimes). */
|
||||
@@ -471,7 +474,7 @@ static int add_name(const char *str)
|
||||
|
||||
/* Append new name. */
|
||||
const int name_size = strlen(name) + 1;
|
||||
char *cp = BLI_memarena_alloc(mem_arena, name_size);
|
||||
char *cp = static_cast<char *>(BLI_memarena_alloc(mem_arena, name_size));
|
||||
memcpy(cp, name, name_size);
|
||||
names[names_len] = cp;
|
||||
|
||||
@@ -538,7 +541,7 @@ static bool match_preproc_prefix(const char *__restrict str, const char *__restr
|
||||
}
|
||||
|
||||
/**
|
||||
* \return The point in `str` that starts with `start` or NULL when not found.
|
||||
* \return The point in `str` that starts with `start` or nullptr when not found.
|
||||
*
|
||||
*/
|
||||
static char *match_preproc_strstr(char *__restrict str, const char *__restrict start)
|
||||
@@ -552,14 +555,14 @@ static char *match_preproc_strstr(char *__restrict str, const char *__restrict s
|
||||
return str;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int preprocess_include(char *maindata, const int maindata_len)
|
||||
{
|
||||
/* NOTE: len + 1, last character is a dummy to prevent
|
||||
* comparisons using uninitialized memory */
|
||||
char *temp = MEM_mallocN(maindata_len + 1, "preprocess_include");
|
||||
char *temp = static_cast<char *>(MEM_mallocN(maindata_len + 1, "preprocess_include"));
|
||||
temp[maindata_len] = ' ';
|
||||
|
||||
memcpy(temp, maindata, maindata_len);
|
||||
@@ -633,7 +636,7 @@ static int preprocess_include(char *maindata, const int maindata_len)
|
||||
else if (match_preproc_prefix(cp, cpp_block_start)) {
|
||||
char *end_ptr = match_preproc_strstr(cp, cpp_block_end);
|
||||
|
||||
if (end_ptr == NULL) {
|
||||
if (end_ptr == nullptr) {
|
||||
fprintf(stderr, "Error: '%s' block must end with '%s'\n", cpp_block_start, cpp_block_end);
|
||||
}
|
||||
else {
|
||||
@@ -665,7 +668,7 @@ static void *read_file_data(const char *filepath, int *r_len)
|
||||
|
||||
if (!fp) {
|
||||
*r_len = -1;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
@@ -674,21 +677,21 @@ static void *read_file_data(const char *filepath, int *r_len)
|
||||
|
||||
if (*r_len == -1) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
data = MEM_mallocN(*r_len, "read_file_data");
|
||||
if (!data) {
|
||||
*r_len = -1;
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (fread(data, *r_len, 1, fp) != 1) {
|
||||
*r_len = -1;
|
||||
MEM_freeN(data);
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
@@ -702,7 +705,7 @@ static int convert_include(const char *filepath)
|
||||
*/
|
||||
|
||||
int maindata_len;
|
||||
char *maindata = read_file_data(filepath, &maindata_len);
|
||||
char *maindata = static_cast<char *>(read_file_data(filepath, &maindata_len));
|
||||
char *md = maindata;
|
||||
if (maindata_len == -1) {
|
||||
fprintf(stderr, "Can't read file %s\n", filepath);
|
||||
@@ -794,6 +797,14 @@ static int convert_include(const char *filepath)
|
||||
}
|
||||
|
||||
/* we've got a type! */
|
||||
if (STREQ(md1, "long") || STREQ(md1, "ulong")) {
|
||||
/* Forbid using long/ulong because those can be either 32 or 64 bit. */
|
||||
fprintf(stderr,
|
||||
"File '%s' contains use of \"%s\" in DNA struct which is not allowed\n",
|
||||
filepath,
|
||||
md1);
|
||||
return -1;
|
||||
}
|
||||
const int type = add_type(md1, 0);
|
||||
if (type == -1) {
|
||||
fprintf(
|
||||
@@ -831,7 +842,7 @@ static int convert_include(const char *filepath)
|
||||
sp[0] = type;
|
||||
sp[1] = name;
|
||||
|
||||
if (names[name] != NULL) {
|
||||
if (names[name] != nullptr) {
|
||||
DEBUG_PRINTF(1, "%s |", names[name]);
|
||||
}
|
||||
|
||||
@@ -854,7 +865,7 @@ static int convert_include(const char *filepath)
|
||||
|
||||
sp[0] = type;
|
||||
sp[1] = name;
|
||||
if (names[name] != NULL) {
|
||||
if (names[name] != nullptr) {
|
||||
DEBUG_PRINTF(1, "%s ||", names[name]);
|
||||
}
|
||||
|
||||
@@ -972,8 +983,8 @@ static int calculate_struct_sizes(int firststruct, FILE *file_verify, const char
|
||||
|
||||
DNA_elem_id_strip_copy(name_static, cp);
|
||||
const char *str_pair[2] = {types[structtype], name_static};
|
||||
const char *name_alias = BLI_ghash_lookup(g_version_data.elem_map_alias_from_static,
|
||||
str_pair);
|
||||
const char *name_alias = static_cast<const char *>(
|
||||
BLI_ghash_lookup(g_version_data.elem_map_alias_from_static, str_pair));
|
||||
fprintf(file_verify,
|
||||
"BLI_STATIC_ASSERT(offsetof(struct %s, %s) == %d, \"DNA member offset "
|
||||
"verify\");\n",
|
||||
@@ -1239,18 +1250,23 @@ static int make_structDNA(const char *base_directory,
|
||||
mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
|
||||
|
||||
/* the longest known struct is 50k, so we assume 100k is sufficient! */
|
||||
structdata = MEM_callocN(max_data_size, "structdata");
|
||||
structdata = static_cast<short *>(MEM_callocN(max_data_size, "structdata"));
|
||||
|
||||
/* a maximum of 5000 variables, must be sufficient? */
|
||||
names = MEM_callocN(sizeof(char *) * max_array_len, "names");
|
||||
types = MEM_callocN(sizeof(char *) * max_array_len, "types");
|
||||
types_size_native = MEM_callocN(sizeof(short) * max_array_len, "types_size_native");
|
||||
types_size_32 = MEM_callocN(sizeof(short) * max_array_len, "types_size_32");
|
||||
types_size_64 = MEM_callocN(sizeof(short) * max_array_len, "types_size_64");
|
||||
types_align_32 = MEM_callocN(sizeof(short) * max_array_len, "types_size_32");
|
||||
types_align_64 = MEM_callocN(sizeof(short) * max_array_len, "types_size_64");
|
||||
names = static_cast<char **>(MEM_callocN(sizeof(char *) * max_array_len, "names"));
|
||||
types = static_cast<char **>(MEM_callocN(sizeof(char *) * max_array_len, "types"));
|
||||
types_size_native = static_cast<short *>(
|
||||
MEM_callocN(sizeof(short) * max_array_len, "types_size_native"));
|
||||
types_size_32 = static_cast<short *>(
|
||||
MEM_callocN(sizeof(short) * max_array_len, "types_size_32"));
|
||||
types_size_64 = static_cast<short *>(
|
||||
MEM_callocN(sizeof(short) * max_array_len, "types_size_64"));
|
||||
types_align_32 = static_cast<short *>(
|
||||
MEM_callocN(sizeof(short) * max_array_len, "types_size_32"));
|
||||
types_align_64 = static_cast<short *>(
|
||||
MEM_callocN(sizeof(short) * max_array_len, "types_size_64"));
|
||||
|
||||
structs = MEM_callocN(sizeof(short *) * max_array_len, "structs");
|
||||
structs = static_cast<short **>(MEM_callocN(sizeof(short *) * max_array_len, "structs"));
|
||||
|
||||
/* Build versioning data */
|
||||
DNA_alias_maps(DNA_RENAME_ALIAS_FROM_STATIC,
|
||||
@@ -1453,9 +1469,9 @@ static int make_structDNA(const char *base_directory,
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
BLI_gset_clear(names_unique, NULL);
|
||||
BLI_gset_clear(names_unique, nullptr);
|
||||
}
|
||||
BLI_gset_free(names_unique, NULL);
|
||||
BLI_gset_free(names_unique, nullptr);
|
||||
}
|
||||
|
||||
MEM_freeN(structdata);
|
||||
@@ -1470,10 +1486,10 @@ static int make_structDNA(const char *base_directory,
|
||||
|
||||
BLI_memarena_free(mem_arena);
|
||||
|
||||
BLI_ghash_free(g_version_data.struct_map_alias_from_static, NULL, NULL);
|
||||
BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
|
||||
BLI_ghash_free(g_version_data.elem_map_static_from_alias, MEM_freeN, NULL);
|
||||
BLI_ghash_free(g_version_data.elem_map_alias_from_static, MEM_freeN, NULL);
|
||||
BLI_ghash_free(g_version_data.struct_map_alias_from_static, nullptr, nullptr);
|
||||
BLI_ghash_free(g_version_data.struct_map_static_from_alias, nullptr, nullptr);
|
||||
BLI_ghash_free(g_version_data.elem_map_static_from_alias, MEM_freeN, nullptr);
|
||||
BLI_ghash_free(g_version_data.elem_map_alias_from_static, MEM_freeN, nullptr);
|
||||
|
||||
DEBUG_PRINTF(0, "done.\n");
|
||||
|
||||
@@ -1536,7 +1552,7 @@ int main(int argc, char **argv)
|
||||
base_directory = BASE_HEADER;
|
||||
}
|
||||
|
||||
/* NOTE: #init_structDNA() in dna_genfile.c expects `sdna->data` is 4-bytes aligned.
|
||||
/* NOTE: #init_structDNA() in dna_genfile.cc expects `sdna->data` is 4-bytes aligned.
|
||||
* `DNAstr[]` buffer written by `makesdna` is used for this data, so make `DNAstr` forcefully
|
||||
* 4-bytes aligned. */
|
||||
#ifdef __GNUC__
|
||||
@@ -1551,7 +1567,7 @@ int main(int argc, char **argv)
|
||||
if (make_structDNA(base_directory, file_dna, file_dna_offsets, file_dna_verify)) {
|
||||
/* error */
|
||||
fclose(file_dna);
|
||||
file_dna = NULL;
|
||||
file_dna = nullptr;
|
||||
make_bad_file(argv[1], __LINE__);
|
||||
return_status = 1;
|
||||
}
|
||||
@@ -1589,19 +1605,6 @@ int main(int argc, char **argv)
|
||||
|
||||
#endif /* if 0 */
|
||||
|
||||
/**
|
||||
* Disable types:
|
||||
*
|
||||
* - 'long': even though DNA supports, 'long' shouldn't be used since it can be either 32 or 64bit,
|
||||
* use int, int32_t or int64_t instead.
|
||||
*
|
||||
* Only valid use would be as a runtime variable if an API expected a long,
|
||||
* but so far we don't have this happening.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC poison long
|
||||
#endif
|
||||
|
||||
/* The include file below is automatically generated from the `SRC_DNA_INC`
|
||||
* variable in 'source/blender/CMakeLists.txt'. */
|
||||
#include "dna_includes_all.h"
|
||||
Reference in New Issue
Block a user