[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43685] trunk/blender/source/blender/ makesrna/intern: found a bug by accident.

Campbell Barton ideasman42 at gmail.com
Tue Jan 24 23:15:43 CET 2012


Revision: 43685
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43685
Author:   campbellbarton
Date:     2012-01-24 22:15:25 +0000 (Tue, 24 Jan 2012)
Log Message:
-----------
found a bug by accident.
- bugfix for setting string defaults in rna functions (incorrect pointer use and would copy past string length).
- Object.dm_info was setting a default when it didnt need to.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_access.c
    trunk/blender/source/blender/makesrna/intern/rna_object_api.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c	2012-01-24 20:58:43 UTC (rev 43684)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c	2012-01-24 22:15:25 UTC (rev 43685)
@@ -4746,7 +4746,7 @@
 				case PROP_STRING: {
 					const char *defvalue= ((StringPropertyRNA*)parm)->defaultvalue;
 					if(defvalue && defvalue[0])
-						memcpy(data, &defvalue, size);
+						BLI_strncpy(data, defvalue, size);
 					break;
 				}
 				case PROP_POINTER:

Modified: trunk/blender/source/blender/makesrna/intern/rna_object_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object_api.c	2012-01-24 20:58:43 UTC (rev 43684)
+++ trunk/blender/source/blender/makesrna/intern/rna_object_api.c	2012-01-24 22:15:25 UTC (rev 43685)
@@ -643,7 +643,7 @@
 	parm= RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* weak!, no way to return dynamic string type */
-	parm= RNA_def_string(func, "result", "result", 16384, "result", "");
+	parm= RNA_def_string(func, "result", "", 16384, "result", "");
 	RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
 	RNA_def_function_output(func, parm);
 #endif /* NDEBUG */



More information about the Bf-blender-cvs mailing list