diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-25 16:59:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-25 16:59:54 +0400 |
commit | a7815053eff706f8c08ca774ed3dcddc884bb504 (patch) | |
tree | e30457d40cba58cfbc19c4be3bce7090fa0c3f3c /source/blender/makesdna/intern | |
parent | e005c3136ecb72972b1e500a5710bebe63bdc50e (diff) | |
parent | 22c68cd748257e63391e6b23b1d0b7e5895d3121 (diff) |
svn merge -r37600:37700 https://svn.blender.org/svnroot/bf-blender/trunk/blender
manually merged source/blender/editors/uvedit/uvedit_unwrap_ops.c
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 8b841b67e54..80299d44a78 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -670,6 +670,8 @@ int arraysize(char *astr, int len) } else if( str[a]==']' && cp) { str[a]= 0; + /* if 'cp' is a preprocessor definition, it will evaluate to 0, + * the caller needs to check for this case and throw an error */ mul*= atoi(cp); } } @@ -713,7 +715,12 @@ static int calculate_structlens(int firststruct) /* has the name an extra length? (array) */ mul= 1; if( cp[namelen-1]==']') mul= arraysize(cp, namelen); - + + if (mul == 0) { + printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp); + dna_error = 1; + } + /* 4-8 aligned/ */ if(sizeof(void *) == 4) { if (len % 4) { @@ -743,7 +750,12 @@ static int calculate_structlens(int firststruct) /* has the name an extra length? (array) */ mul= 1; if( cp[namelen-1]==']') mul= arraysize(cp, namelen); - + + if (mul == 0) { + printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp); + dna_error = 1; + } + /* struct alignment */ if(type >= firststruct) { if(sizeof(void *)==8 && (len % 8) ) { |