diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-03 20:05:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-03 20:05:21 +0300 |
commit | 263830f0004481cd4921f03f4242d7c80794b08d (patch) | |
tree | 30b512a06df2e619681ecacf97faee69e46913f8 /source/blender/makesdna | |
parent | 7c86a1a95cbc643fdbbf8c28f0422face8a15a19 (diff) |
Enabled GCC -Wwrite-strings warning for CMake and replaced many 'char's for 'const char's,.
Only one functional change where Transform orientations passed "" to BIF_createTransformOrientation() which could then have the value written into.
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_genfile.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sdna_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_genfile.c | 33 | ||||
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 6 |
5 files changed, 25 insertions, 22 deletions
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index 75d21644267..8e00a89af09 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -45,7 +45,7 @@ char *DNA_struct_get_compareflags(struct SDNA *sdna, struct SDNA *newsdna); void *DNA_struct_reconstruct(struct SDNA *newsdna, struct SDNA *oldsdna, char *compflags, int oldSDNAnr, int blocks, void *data); int DNA_elem_array_size(const char *astr, int len); -int DNA_elem_offset(struct SDNA *sdna, char *stype, char *vartype, char *name); +int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name); #endif diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index f2bdfeff9dd..8e291035be7 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -38,7 +38,7 @@ typedef struct SDNA { int datalen; /* length of data */ int nr_names; /* total number of struct members */ - char **names; /* struct member names */ + const char **names; /* struct member names */ int pointerlen; /* size of a pointer in bytes */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 2deb64be604..78acd1327e7 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -90,8 +90,8 @@ typedef struct Report { short type; /* ReportType */ short flag; int len; /* strlen(message), saves some time calculating the word wrap */ - char *typestr; - char *message; + const char *typestr; + const char *message; } Report; /* saved in the wm, dont remove */ diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index fd98fd4ef08..068336a1717 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -196,7 +196,7 @@ void DNA_sdna_free(SDNA *sdna) MEM_freeN(sdna); } -static int ispointer(char *name) +static int ispointer(const char *name) { /* check if pointer or function pointer */ return (name[0]=='*' || (name[0]=='(' && name[1]=='*')); @@ -206,7 +206,7 @@ static int elementsize(SDNA *sdna, short type, short name) /* call with numbers from struct-array */ { int mul, namelen, len; - char *cp; + const char *cp; cp= sdna->names[name]; len= 0; @@ -251,7 +251,7 @@ static void printstruct(SDNA *sdna, short strnr) } #endif -static short *findstruct_name(SDNA *sdna, char *str) +static short *findstruct_name(SDNA *sdna, const char *str) { int a; short *sp=0; @@ -502,7 +502,7 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr) { int a, b, typenr, elems; short *sp; - char *cp; + const char *cp; /* check all structs, test if it's inside another struct */ sp= sdna->structs[structnr]; @@ -546,7 +546,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) */ int a, b; short *spold, *spcur; - char *str1, *str2; + const char *str1, *str2; char *compflags; if(sdna->nr_structs==0) { @@ -627,7 +627,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna) return compflags; } -static void cast_elem(char *ctype, char *otype, char *name, char *curdata, char *olddata) +static void cast_elem(char *ctype, char *otype, const char *name, char *curdata, char *olddata) { double val = 0.0; int arrlen, curlen=1, oldlen=1, ctypenr, otypenr; @@ -721,7 +721,7 @@ static void cast_elem(char *ctype, char *otype, char *name, char *curdata, char } } -static void cast_pointer(int curlen, int oldlen, char *name, char *curdata, char *olddata) +static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata, char *olddata) { #ifdef WIN32 __int64 lval; @@ -764,7 +764,7 @@ static void cast_pointer(int curlen, int oldlen, char *name, char *curdata, char } } -static int elem_strcmp(char *name, char *oname) +static int elem_strcmp(const char *name, const char *oname) { int a=0; @@ -780,10 +780,10 @@ static int elem_strcmp(char *name, char *oname) return 0; } -static char *find_elem(SDNA *sdna, char *type, char *name, short *old, char *olddata, short **sppo) +static char *find_elem(SDNA *sdna, const char *type, const char *name, short *old, char *olddata, short **sppo) { int a, elemcount, len; - char *otype, *oname; + const char *otype, *oname; /* without arraypart, so names can differ: return old namenr and type */ @@ -811,7 +811,7 @@ static char *find_elem(SDNA *sdna, char *type, char *name, short *old, char *old return 0; } -static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, char *name, char *curdata, short *old, char *olddata) +static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const char *name, char *curdata, short *old, char *olddata) { /* rules: test for NAME: - name equal: @@ -823,7 +823,8 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, char *nam can I force this?) */ int a, elemcount, len, array, oldsize, cursize, mul; - char *otype, *oname, *cp; + char *otype; + const char *oname, *cp; /* is 'name' an array? */ cp= name; @@ -888,7 +889,8 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *compflags, in */ int a, elemcount, elen, eleno, mul, mulo, firststructtypenr; short *spo, *spc, *sppo; - char *name, *nameo, *type, *cpo, *cpc; + char *type, *cpo, *cpc; + const char *name, *nameo; if(oldSDNAnr== -1) return; if(curSDNAnr== -1) return; @@ -965,7 +967,8 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data) */ int a, mul, elemcount, elen, elena, firststructtypenr; short *spo, *spc, skip; - char *name, *type, *cpo, *cur, cval; + char *type, *cpo, *cur, cval; + const char *name; if(oldSDNAnr== -1) return; firststructtypenr= *(oldsdna->structs[0]); @@ -1095,7 +1098,7 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int return cur; } -int DNA_elem_offset(SDNA *sdna, char *stype, char *vartype, char *name) +int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const char *name) { int SDNAnr= DNA_struct_find_nr(sdna, stype); diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 359a3920528..e66cfd44a50 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -62,7 +62,7 @@ /* Included the path relative from /source/blender/ here, so we can move */ /* headers around with more freedom. */ -char *includefiles[] = { +const char *includefiles[] = { // if you add files here, please add them at the end // of makesdna.c (this file) as well @@ -162,7 +162,7 @@ int additional_slen_offset; /** * Add type <str> to struct indexed by <len>, if it was not yet found. */ -int add_type(char *str, int len); +int add_type(const char *str, int len); /** * Add variable <str> to @@ -214,7 +214,7 @@ void printStructLenghts(void); /* ************************* MAKEN DNA ********************** */ -int add_type(char *str, int len) +int add_type(const char *str, int len) { int nr; char *cp; |