found a bug by accident.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 24 Jan 2012 22:15:25 +0000 (22:15 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 24 Jan 2012 22:15:25 +0000 (22:15 +0000)
- 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.

source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_object_api.c

index 4eebfc529203dcae641dc7cb2e8e777c9c1e6e39..7d366afd3cac95a330dabde7adf6dd1fcc4520ae 100644 (file)
@@ -4746,7 +4746,7 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSE
                                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:
index 0246e22d92861e8ebc3233b012f11517f19df83b..188ccccbfc41760adec1c96e36c340be68a6e1f5 100644 (file)
@@ -643,7 +643,7 @@ void RNA_api_object(StructRNA *srna)
        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 */