diff options
Diffstat (limited to 'source/blender/makesdna/intern/dna_genfile.c')
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 252 |
1 files changed, 126 insertions, 126 deletions
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 2148bc96c04..5e4c244dbc2 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -178,11 +178,11 @@ int DNA_elem_array_size(const char *astr, int len) memcpy(str, astr, len+1); - for(a=0; a<len; a++) { - if( str[a]== '[' ) { + for (a=0; a<len; a++) { + if ( str[a]== '[' ) { cp= &(str[a+1]); } - else if( str[a]==']' && cp) { + else if ( str[a]==']' && cp) { str[a]= 0; mul*= atoi(cp); } @@ -226,17 +226,17 @@ static int elementsize(SDNA *sdna, short type, short name) namelen= strlen(cp); /* is it a pointer or function pointer? */ - if(ispointer(cp)) { + if (ispointer(cp)) { /* has the naam an extra length? (array) */ mul= 1; - if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); + if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); len= sdna->pointerlen*mul; } - else if( sdna->typelens[type] ) { + else if ( sdna->typelens[type] ) { /* has the naam an extra length? (array) */ mul= 1; - if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); + if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen); len= mul*sdna->typelens[type]; @@ -258,7 +258,7 @@ static void printstruct(SDNA *sdna, short strnr) nr= sp[1]; sp+= 2; - for(b=0; b< nr; b++, sp+= 2) { + for (b=0; b< nr; b++, sp+= 2) { printf(" %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]); } } @@ -270,11 +270,11 @@ static short *findstruct_name(SDNA *sdna, const char *str) short *sp= NULL; - for(a=0; a<sdna->nr_structs; a++) { + for (a=0; a<sdna->nr_structs; a++) { sp= sdna->structs[a]; - if(strcmp( sdna->types[ sp[0] ], str )==0) return sp; + if (strcmp( sdna->types[ sp[0] ], str )==0) return sp; } return NULL; @@ -284,9 +284,9 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str) { short *sp= NULL; - if(sdna->lastfind<sdna->nr_structs) { + if (sdna->lastfind<sdna->nr_structs) { sp= sdna->structs[sdna->lastfind]; - if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind; + if (strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind; } #ifdef WITH_DNA_GHASH @@ -295,11 +295,11 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str) { int a; - for(a=0; a<sdna->nr_structs; a++) { + for (a=0; a<sdna->nr_structs; a++) { sp= sdna->structs[a]; - if(strcmp( sdna->types[ sp[0] ], str )==0) { + if (strcmp( sdna->types[ sp[0] ], str )==0) { sdna->lastfind= a; return a; } @@ -325,16 +325,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) data= (int *)sdna->data; strcpy(str, "SDNA"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; /* load names array */ strcpy(str, "NAME"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; - if(do_endian_swap) sdna->nr_names= le_int(*data); + if (do_endian_swap) sdna->nr_names= le_int(*data); else sdna->nr_names= *data; data++; @@ -347,20 +347,20 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) nr= 0; cp= (char *)data; - while(nr<sdna->nr_names) { + while (nr<sdna->nr_names) { sdna->names[nr]= cp; /* "float gravity [3]" was parsed wrong giving both "gravity" and * "[3]" members. we rename "[3]", and later set the type of * "gravity" to "void" so the offsets work out correct */ - if(*cp == '[' && strcmp(cp, "[3]")==0) { - if(nr && strcmp(sdna->names[nr-1], "Cvi") == 0) { + if (*cp == '[' && strcmp(cp, "[3]")==0) { + if (nr && strcmp(sdna->names[nr-1], "Cvi") == 0) { sdna->names[nr]= "gravity[3]"; gravity_fix= nr; } } - while( *cp) cp++; + while ( *cp) cp++; cp++; nr++; } @@ -371,10 +371,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) /* load type names array */ data= (int *)cp; strcpy(str, "TYPE"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; - if(do_endian_swap) sdna->nr_types= le_int(*data); + if (do_endian_swap) sdna->nr_types= le_int(*data); else sdna->nr_types= *data; data++; @@ -387,18 +387,18 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) nr= 0; cp= (char *)data; - while(nr<sdna->nr_types) { + while (nr<sdna->nr_types) { sdna->types[nr]= cp; /* this is a patch, to change struct names without a conflict with SDNA */ /* be careful to use it, in this case for a system-struct (opengl/X) */ - if( *cp == 'b') { + if ( *cp == 'b') { /* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */ - if( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1; + if ( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1; } - while( *cp) cp++; + while ( *cp) cp++; cp++; nr++; } @@ -409,16 +409,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) /* load typelen array */ data= (int *)cp; strcpy(str, "TLEN"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; sp= (short *)data; sdna->typelens= sp; - if(do_endian_swap) { + if (do_endian_swap) { short a, *spo= sp; a= sdna->nr_types; - while(a--) { + while (a--) { spo[0]= le_short(spo[0]); spo++; } @@ -430,15 +430,15 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) printf("TLEN error in SDNA file\n"); return; } - if(sdna->nr_types & 1) sp++; /* prevent BUS error */ + if (sdna->nr_types & 1) sp++; /* prevent BUS error */ /* load struct array */ data= (int *)sp; strcpy(str, "STRC"); - if( *data == *verg ) { + if ( *data == *verg ) { data++; - if(do_endian_swap) sdna->nr_structs= le_int(*data); + if (do_endian_swap) sdna->nr_structs= le_int(*data); else sdna->nr_structs= *data; data++; @@ -451,10 +451,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) nr= 0; sp= (short *)data; - while(nr<sdna->nr_structs) { + while (nr<sdna->nr_structs) { sdna->structs[nr]= sp; - if(do_endian_swap) { + if (do_endian_swap) { short a; sp[0]= le_short(sp[0]); @@ -462,7 +462,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) a= sp[1]; sp+= 2; - while(a--) { + while (a--) { sp[0]= le_short(sp[0]); sp[1]= le_short(sp[1]); sp+= 2; @@ -481,17 +481,17 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) sdna->pointerlen= sdna->typelens[ sp[0] ]/2; - if(sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) { + if (sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) { printf("ListBase struct error! Needs it to calculate pointerize.\n"); exit(0); /* well, at least sizeof(ListBase) is error proof! (ton) */ } /* second part of gravity problem, setting "gravity" type to void */ - if(gravity_fix > -1) { - for(nr=0; nr<sdna->nr_structs; nr++) { + if (gravity_fix > -1) { + for (nr=0; nr<sdna->nr_structs; nr++) { sp= sdna->structs[nr]; - if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0) + if (strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0) sp[10]= SDNA_TYPE_VOID; } } @@ -500,7 +500,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap) /* create a ghash lookup to speed up */ sdna->structs_map= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh"); - for(nr = 0; nr < sdna->nr_structs; nr++) { + for (nr = 0; nr < sdna->nr_structs; nr++) { sp= sdna->structs[nr]; BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1)); } @@ -537,15 +537,15 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr) sp= sdna->structs[structnr]; typenr= sp[0]; - for(a=0; a<sdna->nr_structs; a++) { - if(a!=structnr && compflags[a]==1) { + for (a=0; a<sdna->nr_structs; a++) { + if (a!=structnr && compflags[a]==1) { sp= sdna->structs[a]; elems= sp[1]; sp+= 2; - for(b=0; b<elems; b++, sp+=2) { - if(sp[0]==typenr) { + for (b=0; b<elems; b++, sp+=2) { + if (sp[0]==typenr) { cp= sdna->names[ sp[1] ]; - if(!ispointer(cp)) { + if (!ispointer(cp)) { compflags[a]= 2; recurs_test_compflags(sdna, compflags, a); } @@ -578,7 +578,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) const char *str1, *str2; char *compflags; - if(sdna->nr_structs==0) { + if (sdna->nr_structs==0) { printf("error: file without SDNA\n"); return NULL; } @@ -589,42 +589,42 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) * the structs in 'newsdna' */ - for(a=0; a<sdna->nr_structs; a++) { + for (a=0; a<sdna->nr_structs; a++) { spold= sdna->structs[a]; /* search for type in cur */ spcur= findstruct_name(newsdna, sdna->types[spold[0]]); - if(spcur) { + if (spcur) { compflags[a]= 2; /* compare length and amount of elems */ - if( spcur[1] == spold[1]) { - if( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) { + if ( spcur[1] == spold[1]) { + if ( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) { /* same length, same amount of elems, now per type and name */ b= spold[1]; spold+= 2; spcur+= 2; - while(b > 0) { + while (b > 0) { str1= newsdna->types[spcur[0]]; str2= sdna->types[spold[0]]; - if(strcmp(str1, str2)!=0) break; + if (strcmp(str1, str2)!=0) break; str1= newsdna->names[spcur[1]]; str2= sdna->names[spold[1]]; - if(strcmp(str1, str2)!=0) break; + if (strcmp(str1, str2)!=0) break; /* same type and same name, now pointersize */ - if(ispointer(str1)) { - if(sdna->pointerlen!=newsdna->pointerlen) break; + if (ispointer(str1)) { + if (sdna->pointerlen!=newsdna->pointerlen) break; } b--; spold+= 2; spcur+= 2; } - if(b==0) compflags[a]= 1; + if (b==0) compflags[a]= 1; } } @@ -640,13 +640,13 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) /* Because structs can be inside structs, we recursively * set flags when a struct is altered */ - for(a=0; a<sdna->nr_structs; a++) { - if(compflags[a]==2) recurs_test_compflags(sdna, compflags, a); + for (a=0; a<sdna->nr_structs; a++) { + if (compflags[a]==2) recurs_test_compflags(sdna, compflags, a); } #if 0 - for(a=0; a<sdna->nr_structs; a++) { - if(compflags[a]==2) { + for (a=0; a<sdna->nr_structs; a++) { + if (compflags[a]==2) { spold= sdna->structs[a]; printf("changed: %s\n", sdna->types[ spold[0] ]); } @@ -659,16 +659,16 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) static eSDNA_Type sdna_type_nr(const char *dna_type) { if ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0)) return SDNA_TYPE_CHAR; - else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR; - else if( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT; - else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT; - else if( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT; - else if( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG; - else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG; - else if( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT; - else if( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE; - else if( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64; - else if( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64; + else if ((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR; + else if ( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT; + else if ((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT; + else if ( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT; + else if ( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG; + else if ((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG; + else if ( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT; + else if ( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE; + else if ( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64; + else if ( strcmp(dna_type, "uint64_t")==0) return SDNA_TYPE_UINT64; else return -1; /* invalid! */ } @@ -691,7 +691,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch oldlen= DNA_elem_type_size(otypenr); curlen= DNA_elem_type_size(ctypenr); - while(arrlen>0) { + while (arrlen>0) { switch(otypenr) { case SDNA_TYPE_CHAR: val= *olddata; break; @@ -733,10 +733,10 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch case SDNA_TYPE_ULONG: *( (unsigned int *)curdata)= val; break; case SDNA_TYPE_FLOAT: - if(otypenr<2) val/= 255; + if (otypenr<2) val/= 255; *( (float *)curdata)= val; break; case SDNA_TYPE_DOUBLE: - if(otypenr<2) val/= 255; + if (otypenr<2) val/= 255; *( (double *)curdata)= val; break; case SDNA_TYPE_INT64: *( (int64_t *)curdata)= val; break; @@ -761,12 +761,12 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata arrlen= DNA_elem_array_size(name, strlen(name)); - while(arrlen>0) { + while (arrlen>0) { - if(curlen==oldlen) { + if (curlen==oldlen) { memcpy(curdata, olddata, curlen); } - else if(curlen==4 && oldlen==8) { + else if (curlen==4 && oldlen==8) { #ifdef WIN32 lval= *( (__int64 *)olddata ); #else @@ -774,7 +774,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata #endif *((int *)curdata) = lval>>3; /* is of course gambling! */ } - else if(curlen==8 && oldlen==4) { + else if (curlen==8 && oldlen==4) { #ifdef WIN32 *( (__int64 *)curdata ) = *((int *)olddata); #else @@ -799,10 +799,10 @@ static int elem_strcmp(const char *name, const char *oname) /* strcmp without array part */ - while(1) { - if(name[a] != oname[a]) return 1; - if(name[a]=='[') break; - if(name[a]==0) break; + while (1) { + if (name[a] != oname[a]) return 1; + if (name[a]=='[') break; + if (name[a]==0) break; a++; } return 0; @@ -818,16 +818,16 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol /* in old is the old struct */ elemcount= old[1]; old+= 2; - for(a=0; a<elemcount; a++, old+=2) { + for (a=0; a<elemcount; a++, old+=2) { otype= sdna->types[old[0]]; oname= sdna->names[old[1]]; len= elementsize(sdna, old[0], old[1]); - if( elem_strcmp(name, oname)==0 ) { /* naam equal */ - if( strcmp(type, otype)==0 ) { /* type equal */ - if(sppo) *sppo= old; + if ( elem_strcmp(name, oname)==0 ) { /* naam equal */ + if ( strcmp(type, otype)==0 ) { /* type equal */ + if (sppo) *sppo= old; return olddata; } @@ -858,53 +858,53 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, /* is 'name' an array? */ cp= name; array= 0; - while( *cp && *cp!='[') { + while ( *cp && *cp!='[') { cp++; array++; } - if( *cp!= '[' ) array= 0; + if ( *cp!= '[' ) array= 0; /* in old is the old struct */ elemcount= old[1]; old+= 2; - for(a=0; a<elemcount; a++, old+=2) { + for (a=0; a<elemcount; a++, old+=2) { otype= oldsdna->types[old[0]]; oname= oldsdna->names[old[1]]; len= elementsize(oldsdna, old[0], old[1]); - if( strcmp(name, oname)==0 ) { /* name equal */ + if ( strcmp(name, oname)==0 ) { /* name equal */ - if(ispointer(name)) { /* pointer of functionpointer afhandelen */ + if (ispointer(name)) { /* pointer of functionpointer afhandelen */ cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); } - else if( strcmp(type, otype)==0 ) { /* type equal */ + else if ( strcmp(type, otype)==0 ) { /* type equal */ memcpy(curdata, olddata, len); } else cast_elem(type, otype, name, curdata, olddata); return; } - else if(array) { /* name is an array */ + else if (array) { /* name is an array */ - if(oname[array]=='[' && strncmp(name, oname, array)==0 ) { /* basis equal */ + if (oname[array]=='[' && strncmp(name, oname, array)==0 ) { /* basis equal */ cursize= DNA_elem_array_size(name, strlen(name)); oldsize= DNA_elem_array_size(oname, strlen(oname)); - if(ispointer(name)) { /* handle pointer or functionpointer */ - if(cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata); + if (ispointer(name)) { /* handle pointer or functionpointer */ + if (cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata); else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); } - else if(name[0]=='*' || strcmp(type, otype)==0 ) { /* type equal */ + else if (name[0]=='*' || strcmp(type, otype)==0 ) { /* type equal */ mul= len/oldsize; mul*= (cursize < oldsize)? cursize: oldsize; memcpy(curdata, olddata, mul); /* terminate strings */ - if(oldsize > cursize && strcmp(type, "char")==0) + if (oldsize > cursize && strcmp(type, "char")==0) curdata[mul-1]= 0; } else { - if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata); + if (cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata); else cast_elem(type, otype, name, curdata, olddata); } return; @@ -926,10 +926,10 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *type, *cpo, *cpc; const char *name, *nameo; - if(oldSDNAnr== -1) return; - if(curSDNAnr== -1) return; + if (oldSDNAnr== -1) return; + if (curSDNAnr== -1) return; - if( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */ + if ( compflags[oldSDNAnr]==1 ) { /* if recursive: test for equal */ spo= oldsdna->structs[oldSDNAnr]; elen= oldsdna->typelens[ spo[0] ]; @@ -947,19 +947,19 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, spc+= 2; cpc= cur; - for(a=0; a<elemcount; a++, spc+=2) { + for (a=0; a<elemcount; a++, spc+=2) { type= newsdna->types[spc[0]]; name= newsdna->names[spc[1]]; elen= elementsize(newsdna, spc[0], spc[1]); /* test: is type a struct? */ - if(spc[0]>=firststructtypenr && !ispointer(name)) { + if (spc[0]>=firststructtypenr && !ispointer(name)) { /* where does the old struct data start (and is there an old one?) */ cpo= find_elem(oldsdna, type, name, spo, data, &sppo); - if(cpo) { + if (cpo) { oldSDNAnr= DNA_struct_find_nr(oldsdna, type); curSDNAnr= DNA_struct_find_nr(newsdna, type); @@ -973,14 +973,14 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, elen/= mul; eleno/= mulo; - while(mul--) { + while (mul--) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpo+= eleno; cpc+= elen; /* new struct array larger than old */ mulo--; - if(mulo<=0) break; + if (mulo<=0) break; } } else cpc+= elen; @@ -1004,7 +1004,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) char *type, *cpo, *cur, cval; const char *name; - if(oldSDNAnr== -1) return; + if (oldSDNAnr== -1) return; firststructtypenr= *(oldsdna->structs[0]); spo= spc= oldsdna->structs[oldSDNAnr]; @@ -1014,7 +1014,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) spc+= 2; cur= data; - for(a=0; a<elemcount; a++, spc+=2) { + for (a=0; a<elemcount; a++, spc+=2) { type= oldsdna->types[spc[0]]; name= oldsdna->names[spc[1]]; @@ -1022,16 +1022,16 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) elen= elementsize(oldsdna, spc[0], spc[1]); /* test: is type a struct? */ - if(spc[0]>=firststructtypenr && !ispointer(name)) { + if (spc[0]>=firststructtypenr && !ispointer(name)) { /* where does the old data start (is there one?) */ cpo= find_elem(oldsdna, type, name, spo, data, NULL); - if(cpo) { + if (cpo) { oldSDNAnr= DNA_struct_find_nr(oldsdna, type); mul= DNA_elem_array_size(name, strlen(name)); elena= elen/mul; - while(mul--) { + while (mul--) { DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo); cpo += elena; } @@ -1039,12 +1039,12 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) } else { - if(ispointer(name)) { - if(oldsdna->pointerlen==8) { + if (ispointer(name)) { + if (oldsdna->pointerlen==8) { mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + while (mul--) { cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval; cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval; cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval; @@ -1063,17 +1063,17 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) /* exception: variable called blocktype/ipowin: derived from ID_ */ skip= 0; - if(name[0]=='b' && name[1]=='l') { - if(strcmp(name, "blocktype")==0) skip= 1; + if (name[0]=='b' && name[1]=='l') { + if (strcmp(name, "blocktype")==0) skip= 1; } - else if(name[0]=='i' && name[1]=='p') { - if(strcmp(name, "ipowin")==0) skip= 1; + else if (name[0]=='i' && name[1]=='p') { + if (strcmp(name, "ipowin")==0) skip= 1; } - if(skip==0) { + if (skip==0) { mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + while (mul--) { cval= cpo[0]; cpo[0]= cpo[1]; cpo[1]= cval; @@ -1089,7 +1089,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + while (mul--) { cval= cpo[0]; cpo[0]= cpo[3]; cpo[3]= cval; @@ -1104,7 +1104,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) { mul= DNA_elem_array_size(name, strlen(name)); cpo= cur; - while(mul--) { + while (mul--) { cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval; cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval; cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval; @@ -1132,18 +1132,18 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int curSDNAnr= DNA_struct_find_nr(newsdna, type); /* init data and alloc */ - if(curSDNAnr >= 0) { + if (curSDNAnr >= 0) { spc= newsdna->structs[curSDNAnr]; curlen= newsdna->typelens[ spc[0] ]; } - if(curlen==0) { + if (curlen==0) { return NULL; } cur= MEM_callocN( blocks*curlen, "reconstruct"); cpc= cur; cpo= data; - for(a=0; a<blocks; a++) { + for (a=0; a<blocks; a++) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpc+= curlen; cpo+= oldlen; |