[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26964] trunk/blender: [#18961] Use const char * where appropriate (2.5)

Campbell Barton ideasman42 at gmail.com
Tue Feb 16 17:47:41 CET 2010


Revision: 26964
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26964
Author:   campbellbarton
Date:     2010-02-16 17:47:41 +0100 (Tue, 16 Feb 2010)

Log Message:
-----------
[#18961] Use const char * where appropriate (2.5)
from Sean Bartell (wtachi) 

added own changes bpy_props.c

Modified Paths:
--------------
    trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
    trunk/blender/intern/guardedalloc/intern/mallocn.c
    trunk/blender/intern/guardedalloc/test/simpletest/memtest.c
    trunk/blender/source/blender/makesrna/intern/makesrna.c
    trunk/blender/source/blender/python/intern/bpy_props.c
    trunk/blender/source/creator/creator.c
    trunk/blender/source/gameengine/VideoTexture/BlendType.h
    trunk/blender/source/gameengine/VideoTexture/Exception.cpp
    trunk/blender/source/gameengine/VideoTexture/Exception.h
    trunk/blender/source/gameengine/VideoTexture/ImageRender.cpp
    trunk/blender/source/gameengine/VideoTexture/Texture.cpp
    trunk/blender/source/gameengine/VideoTexture/VideoFFmpeg.cpp

Modified: trunk/blender/intern/guardedalloc/MEM_guardedalloc.h
===================================================================
--- trunk/blender/intern/guardedalloc/MEM_guardedalloc.h	2010-02-16 16:38:29 UTC (rev 26963)
+++ trunk/blender/intern/guardedalloc/MEM_guardedalloc.h	2010-02-16 16:47:41 UTC (rev 26964)
@@ -122,7 +122,7 @@
 	void MEM_printmemlist_stats(void);
 	
 	/** Set the callback function for error output. */
-	void MEM_set_error_callback(void (*func)(char *));
+	void MEM_set_error_callback(void (*func)(const char *));
 
 	/**
 	 * Are the start/end block markers still correct ?

Modified: trunk/blender/intern/guardedalloc/intern/mallocn.c
===================================================================
--- trunk/blender/intern/guardedalloc/intern/mallocn.c	2010-02-16 16:38:29 UTC (rev 26963)
+++ trunk/blender/intern/guardedalloc/intern/mallocn.c	2010-02-16 16:47:41 UTC (rev 26964)
@@ -135,7 +135,7 @@
 
 static volatile struct localListBase _membase;
 static volatile struct localListBase *membase = &_membase;
-static void (*error_callback)(char *) = NULL;
+static void (*error_callback)(const char *) = NULL;
 static void (*thread_lock_callback)(void) = NULL;
 static void (*thread_unlock_callback)(void) = NULL;
 
@@ -197,7 +197,7 @@
 }
 
 
-void MEM_set_error_callback(void (*func)(char *))
+void MEM_set_error_callback(void (*func)(const char *))
 {
 	error_callback = func;
 }

Modified: trunk/blender/intern/guardedalloc/test/simpletest/memtest.c
===================================================================
--- trunk/blender/intern/guardedalloc/test/simpletest/memtest.c	2010-02-16 16:38:29 UTC (rev 26963)
+++ trunk/blender/intern/guardedalloc/test/simpletest/memtest.c	2010-02-16 16:47:41 UTC (rev 26964)
@@ -47,6 +47,12 @@
 #include <config.h>
 #endif
 
+static void mem_error_cb(const char *errorStr)
+{
+	fprintf(stderr, "%s", errorStr);
+	fflush(stderr);
+}
+
 int main (int argc, char *argv[])
 {
 	int verbose       = 0;
@@ -75,7 +81,7 @@
 	/* Round one, do a normal allocation, and free the blocks again.     */
 	/* ----------------------------------------------------------------- */
 	/* flush mem lib output to stderr */
-	MEM_set_error_callback(stderr);
+	MEM_set_error_callback(mem_error_cb);
 	
 	for (i = 0; i < NUM_BLOCKS; i++) {
 		int blocksize = 10000;

Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c	2010-02-16 16:38:29 UTC (rev 26963)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c	2010-02-16 16:47:41 UTC (rev 26964)
@@ -2590,7 +2590,7 @@
 	return status;
 }
 
-static void mem_error_cb(char *errorStr)
+static void mem_error_cb(const char *errorStr)
 {
 	fprintf(stderr, "%s", errorStr);
 	fflush(stderr);

Modified: trunk/blender/source/blender/python/intern/bpy_props.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_props.c	2010-02-16 16:38:29 UTC (rev 26963)
+++ trunk/blender/source/blender/python/intern/bpy_props.c	2010-02-16 16:47:41 UTC (rev 26964)
@@ -122,7 +122,7 @@
 		char *pysubtype= NULL;
 		int subtype= PROP_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiO!s:BoolProperty", kwlist, &id, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiO!s:BoolProperty", (char **)kwlist, &id, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype))
 			return NULL;
 
 		if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolProperty(options={...}):"))
@@ -173,7 +173,7 @@
 		return NULL; /* self's type was compatible but error getting the srna */
 	}
 	else if(srna) {
-		static char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", "size", NULL};
+		static const char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", "size", NULL};
 		char *id=NULL, *name="", *description="";
 		int def[PYRNA_STACK_ARRAY]={0};
 		int size=3;
@@ -184,7 +184,7 @@
 		char *pysubtype= NULL;
 		int subtype= PROP_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOO!si:BoolVectorProperty", kwlist, &id, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOO!si:BoolVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size))
 			return NULL;
 
 		if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolVectorProperty(options={...}):"))
@@ -244,7 +244,7 @@
 		return NULL; /* self's type was compatible but error getting the srna */
 	}
 	else if(srna) {
-		static char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL};
+		static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL};
 		char *id=NULL, *name="", *description="";
 		int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def=0;
 		PropertyRNA *prop;
@@ -253,7 +253,7 @@
 		char *pysubtype= NULL;
 		int subtype= PROP_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiiiiiiO!s:IntProperty", kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiiiiiiO!s:IntProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype))
 			return NULL;
 
 		if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntProperty(options={...}):"))
@@ -305,7 +305,7 @@
 		return NULL; /* self's type was compatible but error getting the srna */
 	}
 	else if(srna) {
-		static char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL};
+		static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL};
 		char *id=NULL, *name="", *description="";
 		int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0};
 		int size=3;
@@ -316,7 +316,7 @@
 		char *pysubtype= NULL;
 		int subtype= PROP_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOiiiiO!si:IntVectorProperty", kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &PySet_Type, &pyopts, &pysubtype, &size))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOiiiiO!si:IntVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &PySet_Type, &pyopts, &pysubtype, &size))
 			return NULL;
 
 		if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntVectorProperty(options={...}):"))
@@ -380,7 +380,7 @@
 		return NULL; /* self's type was compatible but error getting the srna */
 	}
 	else if(srna) {
-		static char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL};
+		static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL};
 		char *id=NULL, *name="", *description="";
 		float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def=0.0f;
 		int precision= 2;
@@ -392,7 +392,7 @@
 		char *pyunit= NULL;
 		int unit= PROP_UNIT_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssffffffiO!ss:FloatProperty", kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssffffffiO!ss:FloatProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit))
 			return NULL;
 
 		if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatProperty(options={...}):"))
@@ -449,7 +449,7 @@
 		return NULL; /* self's type was compatible but error getting the srna */
 	}
 	else if(srna) {
-		static char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL};
+		static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL};
 		char *id=NULL, *name="", *description="";
 		float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def[PYRNA_STACK_ARRAY]={0.0f};
 		int precision= 2, size=3;
@@ -460,7 +460,7 @@
 		char *pysubtype= NULL;
 		int subtype= PROP_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOfffffiO!si:FloatVectorProperty", kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOfffffiO!si:FloatVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size))
 			return NULL;
 
 		if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatVectorProperty(options={...}):"))
@@ -521,7 +521,7 @@
 		return NULL; /* self's type was compatible but error getting the srna */
 	}
 	else if(srna) {
-		static char *kwlist[] = {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL};
+		static const char *kwlist[] = {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL};
 		char *id=NULL, *name="", *description="", *def="";
 		int maxlen=0;
 		PropertyRNA *prop;
@@ -530,7 +530,7 @@
 		char *pysubtype= NULL;
 		int subtype= PROP_NONE;
 
-		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|sssiO!s:StringProperty", kwlist, &id, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype))
+		if (!PyArg_ParseTupleAndKeywords(args, kw, "s|sssiO!s:StringProperty", (char **)kwlist, &id, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype))

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list