[Bf-blender-cvs] [08f728a3e91] master: Cleanup: redundant casts

Campbell Barton noreply at git.blender.org
Wed Oct 4 07:38:43 CEST 2017


Commit: 08f728a3e91a7c62946847e89632390c400d55ea
Author: Campbell Barton
Date:   Wed Oct 4 16:44:45 2017 +1100
Branches: master
https://developer.blender.org/rB08f728a3e91a7c62946847e89632390c400d55ea

Cleanup: redundant casts

===================================================================

M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/python/generic/bpy_internal_import.c

===================================================================

diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 55fcf9213d6..b30c1d129d4 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2385,8 +2385,8 @@ static int image_new_exec(bContext *C, wmOperator *op)
 	Main *bmain;
 	PointerRNA ptr, idptr;
 	PropertyRNA *prop;
-	char _name[MAX_ID_NAME - 2];
-	char *name = _name;
+	char name_buffer[MAX_ID_NAME - 2];
+	const char *name;
 	float color[4];
 	int width, height, floatbuf, gen_type, alpha;
 	int gen_context;
@@ -2399,10 +2399,13 @@ static int image_new_exec(bContext *C, wmOperator *op)
 	bmain = CTX_data_main(C);
 
 	prop = RNA_struct_find_property(op->ptr, "name");
-	RNA_property_string_get(op->ptr, prop, name);
+	RNA_property_string_get(op->ptr, prop, name_buffer);
 	if (!RNA_property_is_set(op->ptr, prop)) {
 		/* Default value, we can translate! */
-		name = (char *)DATA_(name);
+		name = DATA_(name_buffer);
+	}
+	else {
+		name = name_buffer;
 	}
 	width = RNA_int_get(op->ptr, "width");
 	height = RNA_int_get(op->ptr, "height");
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 4b0b0e2e0f0..41125478ec0 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1327,7 +1327,7 @@ static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeE
 				ten = outliner_add_element(soops, &te->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
 				ten->directdata = lbarray[a];
 				
-				ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name));
+				ten->name = BKE_idcode_to_name_plural(GS(id->name));
 				if (ten->name == NULL)
 					ten->name = "UNKNOWN";
 				
@@ -1367,7 +1367,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
 				ten = outliner_add_element(soops, &soops->tree, lbarray[a], NULL, TSE_ID_BASE, 0);
 				ten->directdata = lbarray[a];
 				
-				ten->name = (char *)BKE_idcode_to_name_plural(GS(id->name));
+				ten->name = BKE_idcode_to_name_plural(GS(id->name));
 				if (ten->name == NULL)
 					ten->name = "UNKNOWN";
 				
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 582a0d22d2f..ffac09efdde 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -253,7 +253,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
 		if (module_file == NULL) {
 			return NULL;
 		}
-		filepath = (char *)_PyUnicode_AsString(module_file);
+		filepath = _PyUnicode_AsString(module_file);
 		Py_DECREF(module_file);
 		if (filepath == NULL) {
 			return NULL;



More information about the Bf-blender-cvs mailing list