diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-05 20:21:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-05 20:21:13 +0400 |
commit | 529b2a01eb8c25e2ed837fffd6dcb2d5441655d2 (patch) | |
tree | dc0cb672afe469bc27444ddd93828609a534ea1f /source/blender/makesdna | |
parent | 1e41b19ec1ff70e9633143e35d476c75f0a2cf0c (diff) |
added check for DNA C syntax we cant parse:
void*somepointer;
.. this is valid C but breaks makesdna.c
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 1d19ece90cd..130a30da3c4 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -229,7 +229,15 @@ static int add_type(const char *str, int len) int nr; char *cp; - if(str[0]==0) return -1; + /* first do validity check */ + if(str[0]==0) { + return -1; + } + else if (strchr(str, '*')) { + /* note: this is valid C syntax but we can't parse, complain! + * 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */ + return -1; + } /* search through type array */ for(nr=0; nr<nr_types; nr++) { @@ -572,8 +580,12 @@ static int convert_include(char *filename) /* we've got a struct name when... */ if( strncmp(md1-7, "struct", 6)==0 ) { - - strct= add_type(md1, 0); + strct = add_type(md1, 0); + if (strct == -1) { + printf("File '%s' contains struct we cant parse \"%s\"\n", filename, md1); + return 1; + } + structpoin= add_struct(strct); sp= structpoin+2; @@ -601,6 +613,10 @@ static int convert_include(char *filename) /* we've got a type! */ type= add_type(md1, 0); + if (type == -1) { + printf("File '%s' contains struct we can't parse \"%s\"\n", filename, md1); + return 1; + } if (debugSDNA > 1) printf("\t|\t|\tfound type %s (", md1); |