[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14655] trunk/blender/source/blender/ blenloader/intern/genfile.c:
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri May 2 12:22:46 CEST 2008
Revision: 14655
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14655
Author: blendix
Date: 2008-05-02 12:22:44 +0200 (Fri, 02 May 2008)
Log Message:
-----------
Bugfix: reading in function pointers from a 64 bit .blend on 32 bit
gave "memory block reconstruct: end corrupt" errors. This bug was
harmless, just gave ugly error messages.
Modified Paths:
--------------
trunk/blender/source/blender/blenloader/intern/genfile.c
Modified: trunk/blender/source/blender/blenloader/intern/genfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/genfile.c 2008-05-02 01:01:51 UTC (rev 14654)
+++ trunk/blender/source/blender/blenloader/intern/genfile.c 2008-05-02 10:22:44 UTC (rev 14655)
@@ -213,6 +213,12 @@
MEM_freeN(sdna);
}
+static int ispointer(char *name)
+{
+ /* check if pointer or function pointer */
+ return (name[0]=='*' || (name[0]=='(' && name[1]=='*'));
+}
+
static int elementsize(struct SDNA *sdna, short type, short name)
/* call with numbers from struct-array */
{
@@ -224,7 +230,7 @@
namelen= strlen(cp);
/* is it a pointer or function pointer? */
- if(cp[0]=='*' || cp[1]=='*') {
+ if(ispointer(cp)) {
/* has the naam an extra length? (array) */
mul= 1;
if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
@@ -508,7 +514,7 @@
for(b=0; b<elems; b++, sp+=2) {
if(sp[0]==typenr) {
cp= sdna->names[ sp[1] ];
- if(cp[0]!= '*') {
+ if(!ispointer(cp)) {
compflags[a]= 2;
recurs_test_compflags(sdna, compflags, a);
}
@@ -579,7 +585,7 @@
if(strcmp(str1, str2)!=0) break;
/* same type and same name, now pointersize */
- if(str1[0]=='*') {
+ if(ispointer(str1)) {
if(sdna->pointerlen!=newsdna->pointerlen) break;
}
@@ -834,7 +840,7 @@
if( strcmp(name, oname)==0 ) { /* name equal */
- if( name[0]=='*') { /* pointer 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 */
@@ -851,11 +857,11 @@
cursize= arraysize(name, strlen(name));
oldsize= arraysize(oname, strlen(oname));
- if( name[0]=='*') { /* handle pointer */
+ 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(strcmp(type, otype)==0 ) { /* type equal */
mul= len/oldsize;
mul*= MIN2(cursize, oldsize);
memcpy(curdata, olddata, mul);
@@ -909,7 +915,7 @@
elen= elementsize(newsdna, spc[0], spc[1]);
/* test: is type a struct? */
- if(spc[0]>=firststructtypenr && name[0]!='*') {
+ 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);
@@ -976,7 +982,7 @@
elen= elementsize(oldsdna, spc[0], spc[1]);
/* test: is type a struct? */
- if(spc[0]>=firststructtypenr && name[0]!='*') {
+ if(spc[0]>=firststructtypenr && !ispointer(name)) {
/* where does the old data start (is there one?) */
cpo= find_elem(oldsdna, type, name, spo, data, 0);
if(cpo) {
@@ -993,7 +999,7 @@
}
else {
- if( name[0]=='*' ) {
+ if(ispointer(name)) {
if(oldsdna->pointerlen==8) {
mul= arraysize(name, strlen(name));
More information about the Bf-blender-cvs
mailing list