Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/blenloader/intern/writefile.c4
-rw-r--r--source/blender/makesdna/DNA_genfile.h2
-rw-r--r--source/blender/makesdna/DNA_listBase.h9
-rw-r--r--source/blender/makesdna/DNA_sdna_types.h6
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c42
-rw-r--r--source/blender/makesdna/intern/makesdna.c177
7 files changed, 124 insertions, 124 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index fec4f3486d5..dc988afaabe 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2118,7 +2118,7 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead)
char *data;
data = (char *)(bhead + 1);
- blocksize = filesdna->typelens[filesdna->structs[bhead->SDNAnr][0]];
+ blocksize = filesdna->types_size[filesdna->structs[bhead->SDNAnr][0]];
nblocks = bhead->nr;
while (nblocks--) {
@@ -2264,9 +2264,9 @@ static void test_pointer_array(FileData *fd, void **mat)
* the new dna format.
*/
if (*mat) {
- len = MEM_allocN_len(*mat) / fd->filesdna->pointerlen;
+ len = MEM_allocN_len(*mat) / fd->filesdna->pointer_size;
- if (fd->filesdna->pointerlen == 8 && fd->memsdna->pointerlen == 4) {
+ if (fd->filesdna->pointer_size == 8 && fd->memsdna->pointer_size == 4) {
ipoin = imat = MEM_malloc_arrayN(len, 4, "newmatar");
lpoin = *mat;
@@ -2281,7 +2281,7 @@ static void test_pointer_array(FileData *fd, void **mat)
*mat = imat;
}
- if (fd->filesdna->pointerlen == 4 && fd->memsdna->pointerlen == 8) {
+ if (fd->filesdna->pointer_size == 4 && fd->memsdna->pointer_size == 8) {
lpoin = lmat = MEM_malloc_arrayN(len, 8, "newmatar");
ipoin = *mat;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index ef2c73a675f..6694e050695 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -531,7 +531,7 @@ static void writestruct_at_address_nr(
bh.SDNAnr = struct_nr;
sp = wd->sdna->structs[bh.SDNAnr];
- bh.len = nr * wd->sdna->typelens[sp[0]];
+ bh.len = nr * wd->sdna->types_size[sp[0]];
if (bh.len == 0) {
return;
@@ -4047,7 +4047,7 @@ static bool write_file_handle(
*
* Note that we *borrow* the pointer to 'DNAstr',
* so writing each time uses the same address and doesn't cause unnecessary undo overhead. */
- writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data);
+ writedata(wd, DNA1, wd->sdna->data_len, wd->sdna->data);
#ifdef USE_NODE_COMPAT_CUSTOMNODES
/* compatibility data not created on undo */
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index b6c0da59038..d9fc14d9393 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -78,7 +78,7 @@ enum eSDNA_StructCompare {
};
struct SDNA *DNA_sdna_from_data(
- const void *data, const int datalen,
+ const void *data, const int data_len,
bool do_endian_swap, bool data_alloc,
const char **r_error_message);
void DNA_sdna_free(struct SDNA *sdna);
diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h
index 084f1a17cf0..359aa7a219c 100644
--- a/source/blender/makesdna/DNA_listBase.h
+++ b/source/blender/makesdna/DNA_listBase.h
@@ -19,8 +19,7 @@
/** \file
* \ingroup DNA
- * \brief These structs are the foundation for all linked lists in the
- * library system.
+ * \brief These structs are the foundation for all linked lists in the library system.
*
* Doubly-linked lists start from a ListBase and contain elements beginning
* with Link.
@@ -33,19 +32,19 @@
extern "C" {
#endif
-/* generic - all structs which are put into linked lists begin with this */
+/** Generic - all structs which are put into linked lists begin with this. */
typedef struct Link {
struct Link *next, *prev;
} Link;
-/* simple subclass of Link--use this when it is not worth defining a custom one... */
+/** Simple subclass of Link. Use this when it is not worth defining a custom one. */
typedef struct LinkData {
struct LinkData *next, *prev;
void *data;
} LinkData;
-/* never change the size of this! genfile.c detects pointerlen with it */
+/** Never change the size of this! dna_genfile.c detects pointer_size with it. */
typedef struct ListBase {
void *first, *last;
} ListBase;
diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h
index 4167f9b61ee..5b57065dff3 100644
--- a/source/blender/makesdna/DNA_sdna_types.h
+++ b/source/blender/makesdna/DNA_sdna_types.h
@@ -31,7 +31,7 @@ typedef struct SDNA {
/** Full copy of 'encoded' data (when data_alloc is set, otherwise borrowed). */
const char *data;
/** Length of data. */
- int datalen;
+ int data_len;
bool data_alloc;
/** Total number of struct members. */
@@ -40,14 +40,14 @@ typedef struct SDNA {
const char **names;
/** Size of a pointer in bytes. */
- int pointerlen;
+ int pointer_size;
/** Number of basic types + struct types. */
int nr_types;
/** Type names. */
const char **types;
/** Type lengths. */
- short *typelens;
+ short *types_size;
/** Number of struct types. */
int nr_structs;
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 4d65fb8f1ed..e25bbdf7d46 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -175,7 +175,7 @@ static bool ispointer(const char *name)
/**
* Returns the size of struct fields of the specified type and name.
*
- * \param type: Index into sdna->types/typelens
+ * \param type: Index into sdna->types/types_size
* \param name: Index into sdna->names,
* needed to extract possible pointer/array information.
*/
@@ -196,16 +196,16 @@ static int elementsize(const SDNA *sdna, short type, short name)
mul = DNA_elem_array_size(cp);
}
- len = sdna->pointerlen * mul;
+ len = sdna->pointer_size * mul;
}
- else if (sdna->typelens[type]) {
+ else if (sdna->types_size[type]) {
/* has the name an extra length? (array) */
mul = 1;
if (cp[namelen - 1] == ']') {
mul = DNA_elem_array_size(cp);
}
- len = mul * sdna->typelens[type];
+ len = mul * sdna->types_size[type];
}
@@ -397,7 +397,7 @@ static bool init_structDNA(
if (*data == MAKE_ID('T', 'L', 'E', 'N')) {
data++;
sp = (short *)data;
- sdna->typelens = sp;
+ sdna->types_size = sp;
if (do_endian_swap) {
BLI_endian_switch_int16_array(sp, sdna->nr_types);
@@ -476,7 +476,7 @@ static bool init_structDNA(
}
#endif
- /* Calculate 'sdna->pointerlen' */
+ /* Calculate 'sdna->pointer_size' */
{
const int nr = DNA_struct_find_nr(sdna, "ListBase");
@@ -486,13 +486,13 @@ static bool init_structDNA(
return false;
}
- /* finally pointerlen: use struct ListBase to test it, never change the size of it! */
+ /* finally pointer_size: use struct ListBase to test it, never change the size of it! */
sp = sdna->structs[nr];
/* weird; i have no memory of that... I think I used sizeof(void *) before... (ton) */
- sdna->pointerlen = sdna->typelens[sp[0]] / 2;
+ sdna->pointer_size = sdna->types_size[sp[0]] / 2;
- if (sp[1] != 2 || (sdna->pointerlen != 4 && sdna->pointerlen != 8)) {
+ if (sp[1] != 2 || (sdna->pointer_size != 4 && sdna->pointer_size != 8)) {
*r_error_message = "ListBase struct error! Needs it to calculate pointerize.";
/* well, at least sizeof(ListBase) is error proof! (ton) */
return false;
@@ -506,17 +506,17 @@ static bool init_structDNA(
* Constructs and returns a decoded SDNA structure from the given encoded SDNA data block.
*/
SDNA *DNA_sdna_from_data(
- const void *data, const int datalen,
+ const void *data, const int data_len,
bool do_endian_swap, bool data_alloc,
const char **r_error_message)
{
SDNA *sdna = MEM_mallocN(sizeof(*sdna), "sdna");
const char *error_message = NULL;
- sdna->datalen = datalen;
+ sdna->data_len = data_len;
if (data_alloc) {
- char *data_copy = MEM_mallocN(datalen, "sdna_data");
- memcpy(data_copy, data, datalen);
+ char *data_copy = MEM_mallocN(data_len, "sdna_data");
+ memcpy(data_copy, data, data_len);
sdna->data = data_copy;
}
else {
@@ -641,7 +641,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
/* compare length and amount of elems */
if (sp_new[1] == sp_old[1]) {
- if (newsdna->typelens[sp_new[0]] == oldsdna->typelens[sp_old[0]]) {
+ if (newsdna->types_size[sp_new[0]] == oldsdna->types_size[sp_old[0]]) {
/* same length, same amount of elems, now per type and name */
b = sp_old[1];
@@ -658,7 +658,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
/* same type and same name, now pointersize */
if (ispointer(str1)) {
- if (oldsdna->pointerlen != newsdna->pointerlen) break;
+ if (oldsdna->pointer_size != newsdna->pointer_size) break;
}
b--;
@@ -1004,7 +1004,7 @@ static void reconstruct_elem(
if (strcmp(name, oname) == 0) { /* name equal */
if (ispointer(name)) { /* pointer of functionpointer afhandelen */
- cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
+ cast_pointer(newsdna->pointer_size, oldsdna->pointer_size, name, curdata, olddata);
}
else if (strcmp(type, otype) == 0) { /* type equal */
memcpy(curdata, olddata, len);
@@ -1023,7 +1023,7 @@ static void reconstruct_elem(
oldsize = DNA_elem_array_size(oname);
if (ispointer(name)) { /* handle pointer or functionpointer */
- cast_pointer(newsdna->pointerlen, oldsdna->pointerlen,
+ cast_pointer(newsdna->pointer_size, oldsdna->pointer_size,
cursize > oldsize ? oname : name,
curdata, olddata);
}
@@ -1096,7 +1096,7 @@ static void reconstruct_struct(
if (compflags[oldSDNAnr] == SDNA_CMP_EQUAL) {
/* if recursive: test for equal */
spo = oldsdna->structs[oldSDNAnr];
- elen = oldsdna->typelens[spo[0]];
+ elen = oldsdna->types_size[spo[0]];
memcpy(cur, data, elen);
return;
@@ -1214,7 +1214,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
else {
/* non-struct field type */
if (ispointer(name)) {
- if (oldsdna->pointerlen == 8) {
+ if (oldsdna->pointer_size == 8) {
BLI_endian_switch_int64_array((int64_t *)cur, DNA_elem_array_size(name));
}
}
@@ -1271,13 +1271,13 @@ void *DNA_struct_reconstruct(
/* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */
spo = oldsdna->structs[oldSDNAnr];
type = oldsdna->types[spo[0]];
- oldlen = oldsdna->typelens[spo[0]];
+ oldlen = oldsdna->types_size[spo[0]];
curSDNAnr = DNA_struct_find_nr(newsdna, type);
/* init data and alloc */
if (curSDNAnr != -1) {
spc = newsdna->structs[curSDNAnr];
- curlen = newsdna->typelens[spc[0]];
+ curlen = newsdna->types_size[spc[0]];
}
if (curlen == 0) {
return NULL;
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 5941c9b1b72..edf15c5fe39 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -147,20 +147,21 @@ static int maxdata = 500000, maxnr = 50000;
static int nr_names = 0;
static int nr_types = 0;
static int nr_structs = 0;
-/** at address names[a] is string a */
+/** At address `names[a]` is string `a`. */
static char **names;
-/** at address types[a] is string a */
+/** At address `types[a]` is string `a`. */
static char **types;
-/** at typelens[a] is the length of type 'a' on this systems bitness (32 or 64) */
-static short *typelens_native;
-/** contains sizes as they are calculated on 32 bit systems */
-static short *typelens_32;
-/** contains sizes as they are calculated on 64 bit systems */
-static short *typelens_64;
-/** at sp = structs[a] is the first address of a struct definition
- * sp[0] is type number
- * sp[1] is amount of elements
- * sp[2] sp[3] is typenr, namenr (etc) */
+/** At `types_size[a]` is the size of type `a` on this systems bitness (32 or 64). */
+static short *types_size_native;
+/** Contains sizes as they are calculated on 32 bit systems. */
+static short *types_size_32;
+/** Contains sizes as they are calculated on 64 bit systems. */
+static short *types_size_64;
+/** At `sp = structs[a]` is the first address of a struct definition:
+ * - `sp[0]` is type number.
+ * - `sp[1]` is the length of the element array (next).
+ * - `sp[2]` sp[3] is [(type_nr, name_nr), ..] (number of pairs is defined by `sp[1]`),
+ */
static short **structs, *structdata;
/** Versioning data */
@@ -205,7 +206,7 @@ void BLI_system_backtrace(FILE *fp)
* \param len: The struct size in bytes.
* \return Index in the #types array.
*/
-static int add_type(const char *str, int len);
+static int add_type(const char *str, int size);
/**
* Ensure \c str is int the #names array.
@@ -224,7 +225,7 @@ static short *add_struct(int namecode);
* Remove comments from this buffer. Assumes that the buffer refers to
* ascii-code text.
*/
-static int preprocess_include(char *maindata, int len);
+static int preprocess_include(char *maindata, const int maindata_len);
/**
* Scan this file for serializable types.
@@ -234,7 +235,7 @@ static int convert_include(const char *filename);
/**
* Determine how many bytes are needed for each struct.
*/
-static int calculate_structlens(int);
+static int calculate_struct_sizes(int);
/**
* Construct the DNA.c file
@@ -244,7 +245,7 @@ static void dna_write(FILE *file, const void *pntr, const int size);
/**
* Report all structures found so far, and print their lengths.
*/
-void printStructLengths(void);
+void print_struct_sizes(void);
/** \} */
@@ -334,7 +335,7 @@ static bool is_name_legal(const char *name)
}
-static int add_type(const char *str, int len)
+static int add_type(const char *str, int size)
{
int nr;
char *cp;
@@ -354,10 +355,10 @@ static int add_type(const char *str, int len)
/* search through type array */
for (nr = 0; nr < nr_types; nr++) {
if (strcmp(str, types[nr]) == 0) {
- if (len) {
- typelens_native[nr] = len;
- typelens_32[nr] = len;
- typelens_64[nr] = len;
+ if (size) {
+ types_size_native[nr] = size;
+ types_size_32[nr] = size;
+ types_size_64[nr] = size;
}
return nr;
}
@@ -368,9 +369,9 @@ static int add_type(const char *str, int len)
cp = BLI_memarena_alloc(mem_arena, str_size);
memcpy(cp, str, str_size);
types[nr_types] = cp;
- typelens_native[nr_types] = len;
- typelens_32[nr_types] = len;
- typelens_64[nr_types] = len;
+ types_size_native[nr_types] = size;
+ types_size_32[nr_types] = size;
+ types_size_64[nr_types] = size;
if (nr_types >= maxnr) {
printf("too many types\n");
@@ -552,22 +553,22 @@ static short *add_struct(int namecode)
return sp;
}
-static int preprocess_include(char *maindata, int len)
+static int preprocess_include(char *maindata, const int maindata_len)
{
int a, newlen, comment = 0;
char *cp, *temp, *md;
/* note: len + 1, last character is a dummy to prevent
* comparisons using uninitialized memory */
- temp = MEM_mallocN(len + 1, "preprocess_include");
- temp[len] = ' ';
+ temp = MEM_mallocN(maindata_len + 1, "preprocess_include");
+ temp[maindata_len] = ' ';
- memcpy(temp, maindata, len);
+ memcpy(temp, maindata, maindata_len);
/* remove all c++ comments */
/* replace all enters/tabs/etc with spaces */
cp = temp;
- a = len;
+ a = maindata_len;
comment = 0;
while (a--) {
if (cp[0] == '/' && cp[1] == '/') {
@@ -586,7 +587,7 @@ static int preprocess_include(char *maindata, int len)
md = maindata;
newlen = 0;
comment = 0;
- a = len;
+ a = maindata_len;
while (a--) {
if (cp[0] == '/' && cp[1] == '*') {
@@ -682,24 +683,24 @@ static int convert_include(const char *filename)
/* read include file, skip structs with a '#' before it.
* store all data in temporal arrays.
*/
- int filelen, count, slen, type, name, strct;
+ int maindata_len, count, slen, type, name, strct;
short *structpoin, *sp;
char *maindata, *mainend, *md, *md1;
bool skip_struct;
- md = maindata = read_file_data(filename, &filelen);
- if (filelen == -1) {
+ md = maindata = read_file_data(filename, &maindata_len);
+ if (maindata_len == -1) {
fprintf(stderr, "Can't read file %s\n", filename);
return 1;
}
- filelen = preprocess_include(maindata, filelen);
- mainend = maindata + filelen - 1;
+ maindata_len = preprocess_include(maindata, maindata_len);
+ mainend = maindata + maindata_len - 1;
/* we look for '{' and then back to 'struct' */
count = 0;
skip_struct = false;
- while (count < filelen) {
+ while (count < maindata_len) {
/* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
if (md[0] == '#' && md[1] == ' ' && md[2] == '#') {
@@ -837,17 +838,17 @@ static bool check_field_alignment(int firststruct, int structtype, int type, int
const char *name, const char *detail)
{
bool result = true;
- if (type < firststruct && typelens_native[type] > 4 && (len % 8)) {
+ if (type < firststruct && types_size_native[type] > 4 && (len % 8)) {
fprintf(stderr, "Align 8 error (%s) in struct: %s %s (add %d padding bytes)\n",
detail, types[structtype], name, len % 8);
result = false;
}
- if (typelens_native[type] > 3 && (len % 4) ) {
+ if (types_size_native[type] > 3 && (len % 4) ) {
fprintf(stderr, "Align 4 error (%s) in struct: %s %s (add %d padding bytes)\n",
detail, types[structtype], name, len % 4);
result = false;
}
- if (typelens_native[type] == 2 && (len % 2) ) {
+ if (types_size_native[type] == 2 && (len % 2) ) {
fprintf(stderr, "Align 2 error (%s) in struct: %s %s (add %d padding bytes)\n",
detail, types[structtype], name, len % 2);
result = false;
@@ -855,7 +856,7 @@ static bool check_field_alignment(int firststruct, int structtype, int type, int
return result;
}
-static int calculate_structlens(int firststruct)
+static int calculate_struct_sizes(int firststruct)
{
int unknown = nr_structs, lastunknown;
bool dna_error = false;
@@ -870,12 +871,12 @@ static int calculate_structlens(int firststruct)
const int structtype = structpoin[0];
/* when length is not known... */
- if (typelens_native[structtype] == 0) {
+ if (types_size_native[structtype] == 0) {
const short *sp = structpoin + 2;
- int len_native = 0;
- int len_32 = 0;
- int len_64 = 0;
+ int size_native = 0;
+ int size_32 = 0;
+ int size_64 = 0;
bool has_pointer = false;
/* check all elements in struct */
@@ -901,29 +902,29 @@ static int calculate_structlens(int firststruct)
/* 4-8 aligned/ */
if (sizeof(void *) == 4) {
- if (len_native % 4) {
- fprintf(stderr, "Align pointer error in struct (len_native 4): %s %s\n",
+ if (size_native % 4) {
+ fprintf(stderr, "Align pointer error in struct (size_native 4): %s %s\n",
types[structtype], cp);
dna_error = 1;
}
}
else {
- if (len_native % 8) {
- fprintf(stderr, "Align pointer error in struct (len_native 8): %s %s\n",
+ if (size_native % 8) {
+ fprintf(stderr, "Align pointer error in struct (size_native 8): %s %s\n",
types[structtype], cp);
dna_error = 1;
}
}
- if (len_64 % 8) {
- fprintf(stderr, "Align pointer error in struct (len_64 8): %s %s\n",
+ if (size_64 % 8) {
+ fprintf(stderr, "Align pointer error in struct (size_64 8): %s %s\n",
types[structtype], cp);
dna_error = 1;
}
- len_native += sizeof(void *) * mul;
- len_32 += 4 * mul;
- len_64 += 8 * mul;
+ size_native += sizeof(void *) * mul;
+ size_32 += 4 * mul;
+ size_64 += 8 * mul;
}
else if (cp[0] == '[') {
@@ -933,7 +934,7 @@ static int calculate_structlens(int firststruct)
types[structtype], cp);
dna_error = 1;
}
- else if (typelens_native[type]) {
+ else if (types_size_native[type]) {
/* has the name an extra length? (array) */
int mul = 1;
if (cp[namelen - 1] == ']') {
@@ -948,7 +949,7 @@ static int calculate_structlens(int firststruct)
/* struct alignment */
if (type >= firststruct) {
- if (sizeof(void *) == 8 && (len_native % 8) ) {
+ if (sizeof(void *) == 8 && (size_native % 8) ) {
fprintf(stderr, "Align struct error: %s %s\n",
types[structtype], cp);
dna_error = 1;
@@ -956,46 +957,46 @@ static int calculate_structlens(int firststruct)
}
/* Check 2-4-8 aligned. */
- if (!check_field_alignment(firststruct, structtype, type, len_32, cp, "32 bit")) {
+ if (!check_field_alignment(firststruct, structtype, type, size_32, cp, "32 bit")) {
dna_error = 1;
}
- if (!check_field_alignment(firststruct, structtype, type, len_64, cp, "64 bit")) {
+ if (!check_field_alignment(firststruct, structtype, type, size_64, cp, "64 bit")) {
dna_error = 1;
}
- len_native += mul * typelens_native[type];
- len_32 += mul * typelens_32[type];
- len_64 += mul * typelens_64[type];
+ size_native += mul * types_size_native[type];
+ size_32 += mul * types_size_32[type];
+ size_64 += mul * types_size_64[type];
}
else {
- len_native = 0;
- len_32 = 0;
- len_64 = 0;
+ size_native = 0;
+ size_32 = 0;
+ size_64 = 0;
break;
}
}
- if (len_native == 0) {
+ if (size_native == 0) {
unknown++;
}
else {
- typelens_native[structtype] = len_native;
- typelens_32[structtype] = len_32;
- typelens_64[structtype] = len_64;
+ types_size_native[structtype] = size_native;
+ types_size_32[structtype] = size_32;
+ types_size_64[structtype] = size_64;
/* two ways to detect if a struct contains a pointer:
- * has_pointer is set or len_native doesn't match any of 32/64bit lengths*/
- if (has_pointer || len_64 != len_native || len_32 != len_native) {
- if (len_64 % 8) {
+ * has_pointer is set or size_native doesn't match any of 32/64bit lengths*/
+ if (has_pointer || size_64 != size_native || size_32 != size_native) {
+ if (size_64 % 8) {
fprintf(stderr, "Sizeerror 8 in struct: %s (add %d bytes)\n",
- types[structtype], len_64 % 8);
+ types[structtype], size_64 % 8);
dna_error = 1;
}
}
- if (len_native % 4) {
+ if (size_native % 4) {
fprintf(stderr, "Sizeerror 4 in struct: %s (add %d bytes)\n",
- types[structtype], len_native % 4);
+ types[structtype], size_native % 4);
dna_error = 1;
}
@@ -1017,7 +1018,7 @@ static int calculate_structlens(int firststruct)
const int structtype = structpoin[0];
/* length unknown */
- if (typelens_native[structtype] != 0) {
+ if (types_size_native[structtype] != 0) {
fprintf(stderr, " %s\n", types[structtype]);
}
}
@@ -1031,7 +1032,7 @@ static int calculate_structlens(int firststruct)
const int structtype = structpoin[0];
/* length unknown yet */
- if (typelens_native[structtype] == 0) {
+ if (types_size_native[structtype] == 0) {
fprintf(stderr, " %s\n", types[structtype]);
}
}
@@ -1062,7 +1063,7 @@ static void dna_write(FILE *file, const void *pntr, const int size)
}
}
-void printStructLengths(void)
+void print_struct_sizes(void)
{
int a, unknown = nr_structs, structtype;
/*int lastunknown;*/ /*UNUSED*/
@@ -1077,7 +1078,7 @@ void printStructLengths(void)
for (a = 0; a < nr_structs; a++) {
structpoin = structs[a];
structtype = structpoin[0];
- printf("\t%s\t:%d\n", types[structtype], typelens_native[structtype]);
+ printf("\t%s\t:%d\n", types[structtype], types_size_native[structtype]);
}
}
@@ -1108,9 +1109,9 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
/* a maximum of 5000 variables, must be sufficient? */
names = MEM_callocN(sizeof(char *) * maxnr, "names");
types = MEM_callocN(sizeof(char *) * maxnr, "types");
- typelens_native = MEM_callocN(sizeof(short) * maxnr, "typelens_native");
- typelens_32 = MEM_callocN(sizeof(short) * maxnr, "typelens_32");
- typelens_64 = MEM_callocN(sizeof(short) * maxnr, "typelens_64");
+ types_size_native = MEM_callocN(sizeof(short) * maxnr, "types_size_native");
+ types_size_32 = MEM_callocN(sizeof(short) * maxnr, "types_size_32");
+ types_size_64 = MEM_callocN(sizeof(short) * maxnr, "types_size_64");
structs = MEM_callocN(sizeof(short *) * maxnr, "structs");
/* Build versioning data */
@@ -1164,7 +1165,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
}
DEBUG_PRINTF(0, "\tFinished scanning %d headers.\n", i);
- if (calculate_structlens(firststruct)) {
+ if (calculate_struct_sizes(firststruct)) {
/* error */
return 1;
}
@@ -1181,7 +1182,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
}
printf("\n");
- sp = typelens_native;
+ sp = types_size_native;
for (a = 0; a < nr_types; a++, sp++) {
printf(" %s %d\n", types[a], *sp);
}
@@ -1189,7 +1190,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
for (a = 0; a < nr_structs; a++) {
sp = structs[a];
- printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens_native[sp[0]]);
+ printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], types_size_native[sp[0]]);
num_types = sp[1];
sp += 2;
/* ? num_types was elem? */
@@ -1249,7 +1250,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
len = 2 * nr_types;
if (nr_types & 1) len += 2;
- dna_write(file, typelens_native, len);
+ dna_write(file, types_size_native, len);
/* WRITE STRUCTS */
dna_write(file, "STRC", 4);
@@ -1281,7 +1282,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
}
fprintf(fp, "main() {\n");
- sp = typelens_native;
+ sp = types_size_native;
sp += firststruct;
for (a = firststruct; a < nr_types; a++, sp++) {
if (*sp) {
@@ -1338,9 +1339,9 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
MEM_freeN(structdata);
MEM_freeN(names);
MEM_freeN(types);
- MEM_freeN(typelens_native);
- MEM_freeN(typelens_32);
- MEM_freeN(typelens_64);
+ MEM_freeN(types_size_native);
+ MEM_freeN(types_size_32);
+ MEM_freeN(types_size_64);
MEM_freeN(structs);
BLI_memarena_free(mem_arena);