Revision: 41883
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41883
Author:   campbellbarton
Date:     2011-11-15 15:24:57 +0000 (Tue, 15 Nov 2011)
Log Message:
-----------
replace rna description string limits with rna define RNA_DYN_DESCR_MAX

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/RNA_define.h
    trunk/blender/source/blender/makesrna/intern/rna_ui.c
    trunk/blender/source/blender/makesrna/intern/rna_wm.c

Modified: trunk/blender/source/blender/makesrna/RNA_define.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_define.h  2011-11-15 15:13:38 UTC 
(rev 41882)
+++ trunk/blender/source/blender/makesrna/RNA_define.h  2011-11-15 15:24:57 UTC 
(rev 41883)
@@ -208,6 +208,9 @@
 #define IS_DNATYPE_FLOAT_COMPAT(_str) (strcmp(_str, "float") == 0 || 
strcmp(_str, "double") == 0)
 #define IS_DNATYPE_INT_COMPAT(_str) (strcmp(_str, "int") == 0 || strcmp(_str, 
"short") == 0 || strcmp(_str, "char") == 0)
 
+/* max size for dynamic defined type descriptors,
+ * this value is arbitrary */
+#define RNA_DYN_DESCR_MAX 240
 
 #ifdef __cplusplus
 }

Modified: trunk/blender/source/blender/makesrna/intern/rna_ui.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui.c       2011-11-15 
15:13:38 UTC (rev 41882)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui.c       2011-11-15 
15:24:57 UTC (rev 41883)
@@ -413,7 +413,7 @@
        WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
 }
 
-static char _menu_descr[1024];
+static char _menu_descr[RNA_DYN_DESCR_MAX];
 static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void 
*data, const char *identifier,
                                     StructValidateFunc validate, 
StructCallbackFunc call, StructFreeFunc free)
 {
@@ -490,7 +490,7 @@
 {
        Menu *data= (Menu*)(ptr->data);
        char *str= (char *)data->type->description;
-       if(!str[0])     strcpy(str, value);
+       if(!str[0])     BLI_strncpy(str, value, RNA_DYN_DESCR_MAX);  /* utf8 
already ensured */
        else            assert(!"setting the bl_description on a non-builtin 
menu");
 }
 
@@ -830,7 +830,7 @@
 
        prop= RNA_def_property(srna, "bl_description", PROP_STRING, 
PROP_TRANSLATE);
        RNA_def_property_string_sdna(prop, NULL, "type->description");
-       RNA_def_property_string_maxlength(prop, 1024); /* else it uses the 
pointer size! */
+       RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it 
uses the pointer size! */
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_Menu_bl_description_set");
        // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_wm.c       2011-11-15 
15:13:38 UTC (rev 41882)
+++ trunk/blender/source/blender/makesrna/intern/rna_wm.c       2011-11-15 
15:24:57 UTC (rev 41883)
@@ -966,7 +966,7 @@
 
 static char _operator_idname[OP_MAX_TYPENAME];
 static char _operator_name[OP_MAX_TYPENAME];
-static char _operator_descr[1024];
+static char _operator_descr[RNA_DYN_DESCR_MAX];
 static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void 
*data, const char *identifier, StructValidateFunc validate, StructCallbackFunc 
call, StructFreeFunc free)
 {
        wmOperatorType dummyot = {NULL};
@@ -1161,7 +1161,7 @@
 {
        wmOperator *data= (wmOperator*)(ptr->data);
        char *str= (char *)data->type->idname;
-       if(!str[0])     strcpy(str, value);
+       if(!str[0])     BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 
already ensured */
        else            assert(!"setting the bl_idname on a non-builtin 
operator");
 }
 
@@ -1169,7 +1169,7 @@
 {
        wmOperator *data= (wmOperator*)(ptr->data);
        char *str= (char *)data->type->name;
-       if(!str[0])     strcpy(str, value);
+       if(!str[0])     BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 
already ensured */
        else            assert(!"setting the bl_label on a non-builtin 
operator");
 }
 
@@ -1177,7 +1177,7 @@
 {
        wmOperator *data= (wmOperator*)(ptr->data);
        char *str= (char *)data->type->description;
-       if(!str[0])     strcpy(str, value);
+       if(!str[0])     BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 
already ensured */
        else            assert(!"setting the bl_description on a non-builtin 
operator");
 }
 
@@ -1232,14 +1232,14 @@
 
        prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "type->name");
-       RNA_def_property_string_maxlength(prop, 1024); /* else it uses the 
pointer size! */
+       RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it 
uses the pointer size! */
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_Operator_bl_label_set");
        // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_flag(prop, PROP_REGISTER);
 
        prop= RNA_def_property(srna, "bl_description", PROP_STRING, 
PROP_TRANSLATE);
        RNA_def_property_string_sdna(prop, NULL, "type->description");
-       RNA_def_property_string_maxlength(prop, 1024); /* else it uses the 
pointer size! */
+       RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it 
uses the pointer size! */
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_Operator_bl_description_set");
        // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
@@ -1293,14 +1293,14 @@
 
        prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
        RNA_def_property_string_sdna(prop, NULL, "type->name");
-       RNA_def_property_string_maxlength(prop, 1024); /* else it uses the 
pointer size! */
+       RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it 
uses the pointer size! */
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_Operator_bl_label_set");
        // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_flag(prop, PROP_REGISTER);
 
        prop= RNA_def_property(srna, "bl_description", PROP_STRING, 
PROP_TRANSLATE);
        RNA_def_property_string_sdna(prop, NULL, "type->description");
-       RNA_def_property_string_maxlength(prop, 1024); /* else it uses the 
pointer size! */
+       RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it 
uses the pointer size! */
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_Operator_bl_description_set");
        // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to