From 263830f0004481cd4921f03f4242d7c80794b08d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Dec 2010 17:05:21 +0000 Subject: 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. --- source/blender/gpu/GPU_extensions.h | 4 ++-- source/blender/gpu/GPU_material.h | 8 +++---- source/blender/gpu/intern/gpu_codegen.c | 34 +++++++++++++++--------------- source/blender/gpu/intern/gpu_codegen.h | 4 ++-- source/blender/gpu/intern/gpu_extensions.c | 6 +++--- source/blender/gpu/intern/gpu_material.c | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 14d951fe8bd..4256d494302 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -57,7 +57,7 @@ typedef struct GPUShader GPUShader; void GPU_extensions_disable(void); void GPU_extensions_init(void); /* call this before running any of the functions below */ void GPU_extensions_exit(void); -int GPU_print_error(char *str); +int GPU_print_error(const char *str); int GPU_glsl_support(void); int GPU_non_power_of_two_support(void); @@ -159,7 +159,7 @@ void GPU_shader_free(GPUShader *shader); void GPU_shader_bind(GPUShader *shader); void GPU_shader_unbind(GPUShader *shader); -int GPU_shader_get_uniform(GPUShader *shader, char *name); +int GPU_shader_get_uniform(GPUShader *shader, const char *name); void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, float *value); void GPU_shader_uniform_texture(GPUShader *shader, int location, GPUTexture *tex); diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 23f13bccfc5..bfc74683c9d 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -93,7 +93,7 @@ typedef enum GPUBlendMode { typedef struct GPUNodeStack { GPUType type; - char *name; + const char *name; float vec[4]; struct GPUNodeLink *link; short hasinput; @@ -101,7 +101,7 @@ typedef struct GPUNodeStack { short sockettype; } GPUNodeStack; -GPUNodeLink *GPU_attribute(int type, char *name); +GPUNodeLink *GPU_attribute(int type, const char *name); GPUNodeLink *GPU_uniform(float *num); GPUNodeLink *GPU_dynamic_uniform(float *num); GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser); @@ -110,8 +110,8 @@ GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex); GPUNodeLink *GPU_socket(GPUNodeStack *sock); GPUNodeLink *GPU_builtin(GPUBuiltin builtin); -int GPU_link(GPUMaterial *mat, char *name, ...); -int GPU_stack_link(GPUMaterial *mat, char *name, GPUNodeStack *in, GPUNodeStack *out, ...); +int GPU_link(GPUMaterial *mat, const char *name, ...); +int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...); void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link); void GPU_material_enable_alpha(GPUMaterial *material); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 34cf62462a7..62a7d399377 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -76,13 +76,13 @@ typedef enum GPUDataSource { GPU_SOURCE_ATTRIB } GPUDataSource; -static char* GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4", +static const char* GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4", 0, 0, 0, 0, "mat3", 0, 0, 0, 0, 0, 0, "mat4"}; struct GPUNode { struct GPUNode *next, *prev; - char *name; + const char *name; int tag; ListBase inputs; @@ -93,7 +93,7 @@ struct GPUNodeLink { GPUNodeStack *socket; int attribtype; - char *attribname; + const char *attribname; int image; @@ -188,7 +188,7 @@ static GHash *FUNCTION_HASH= NULL; /*static char *FUNCTION_PROTOTYPES= NULL; static GPUShader *FUNCTION_LIB= NULL;*/ -static int gpu_str_prefix(char *str, char *prefix) +static int gpu_str_prefix(const char *str, const char *prefix) { while(*str && *prefix) { if(*str != *prefix) @@ -346,7 +346,7 @@ static char *gpu_generate_function_prototyps(GHash *hash) } #endif -GPUFunction *GPU_lookup_function(char *name) +GPUFunction *GPU_lookup_function(const char *name) { if(!FUNCTION_HASH) { FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "GPU_lookup_function gh"); @@ -355,7 +355,7 @@ GPUFunction *GPU_lookup_function(char *name) FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/ } - return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, name); + return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name); } void GPU_extensions_exit(void) @@ -381,7 +381,7 @@ void GPU_extensions_exit(void) /* GLSL code generation */ -static void codegen_convert_datatype(DynStr *ds, int from, int to, char *tmp, int id) +static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *tmp, int id) { char name[1024]; @@ -449,7 +449,7 @@ static int codegen_input_has_texture(GPUInput *input) return input->tex != 0; } -char *GPU_builtin_name(GPUBuiltin builtin) +const char *GPU_builtin_name(GPUBuiltin builtin) { if(builtin == GPU_VIEW_MATRIX) return "unfviewmat"; @@ -554,7 +554,7 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) { GPUNode *node; GPUInput *input; - char *name; + const char *name; int builtins = 0; /* print uniforms */ @@ -907,11 +907,11 @@ void GPU_node_link_free(GPUNodeLink *link) /* Node Functions */ -GPUNode *GPU_node_begin(char *name) +GPUNode *GPU_node_begin(const char *name) { GPUNode *node = MEM_callocN(sizeof(GPUNode), "GPUNode"); - node->name = name; + node->name= name; return node; } @@ -925,7 +925,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type) { GPUInput *input; GPUNode *outnode; - char *name; + const char *name; if(link->output) { outnode = link->output->node; @@ -1036,7 +1036,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock) } } -void GPU_node_output(GPUNode *node, int type, char *UNUSED(name), GPUNodeLink **link) +static void GPU_node_output(GPUNode *node, int type, const char *UNUSED(name), GPUNodeLink **link) { GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput"); @@ -1149,7 +1149,7 @@ void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin) /* varargs linking */ -GPUNodeLink *GPU_attribute(int type, char *name) +GPUNodeLink *GPU_attribute(int type, const char *name) { GPUNodeLink *link = GPU_node_link_create(0); @@ -1230,7 +1230,7 @@ GPUNodeLink *GPU_builtin(GPUBuiltin builtin) return link; } -int GPU_link(GPUMaterial *mat, char *name, ...) +int GPU_link(GPUMaterial *mat, const char *name, ...) { GPUNode *node; GPUFunction *function; @@ -1266,7 +1266,7 @@ int GPU_link(GPUMaterial *mat, char *name, ...) return 1; } -int GPU_stack_link(GPUMaterial *mat, char *name, GPUNodeStack *in, GPUNodeStack *out, ...) +int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...) { GPUNode *node; GPUFunction *function; @@ -1333,7 +1333,7 @@ int GPU_link_changed(GPUNodeLink *link) { GPUNode *node; GPUInput *input; - char *name; + const char *name; if(link->output) { node = link->output->node; diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index 3272f0fa1a9..968e679af0e 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -55,7 +55,7 @@ typedef struct GPUFunction { int totparam; } GPUFunction; -GPUFunction *GPU_lookup_function(char *name); +GPUFunction *GPU_lookup_function(const char *name); /* Pass Generation - Takes a list of nodes and a desired output, and makes a pass. This @@ -79,7 +79,7 @@ void GPU_pass_free(GPUPass *pass); /* Material calls */ -char *GPU_builtin_name(GPUBuiltin builtin); +const char *GPU_builtin_name(GPUBuiltin builtin); void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node); int GPU_link_changed(struct GPUNodeLink *link); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 70cc6436702..82a8ac8a62a 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -206,7 +206,7 @@ int GPU_color_depth() return GG.colordepth; } -int GPU_print_error(char *str) +int GPU_print_error(const char *str) { GLenum errCode; @@ -921,7 +921,7 @@ struct GPUShader { int totattrib; /* total number of attributes */ }; -static void shader_print_errors(char *task, char *log, const char *code) +static void shader_print_errors(const char *task, char *log, const char *code) { const char *c, *pos, *end = code + strlen(code); int line = 1; @@ -1090,7 +1090,7 @@ void GPU_shader_free(GPUShader *shader) MEM_freeN(shader); } -int GPU_shader_get_uniform(GPUShader *shader, char *name) +int GPU_shader_get_uniform(GPUShader *shader, const char *name) { return glGetUniformLocationARB(shader->object, name); } diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 32754615bf0..592cf809a4f 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -464,7 +464,7 @@ static void area_lamp_vectors(LampRen *lar) static void ramp_blend(GPUMaterial *mat, GPUNodeLink *fac, GPUNodeLink *col1, GPUNodeLink *col2, int type, GPUNodeLink **outcol) { - static char *names[] = {"mix_blend", "mix_add", "mix_mult", "mix_sub", + static const char *names[] = {"mix_blend", "mix_add", "mix_mult", "mix_sub", "mix_screen", "mix_div", "mix_diff", "mix_dark", "mix_light", "mix_overlay", "mix_dodge", "mix_burn", "mix_hue", "mix_sat", "mix_val", "mix_color", "mix_soft", "mix_linear"}; -- cgit v1.2.3