From 51dcbdde033f6e8e55c4b1b4a47ca0624a6571ee Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Nov 2010 09:45:45 +0000 Subject: use 'const char *' by default with RNA functions except when the value is flagged as PROP_THICK_WRAP. Also use const char in many other parts of blenders code. Currently this gives warnings for setting operator id, label and description since these are an exception and allocated beforehand. --- source/blender/makesrna/intern/rna_wm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source/blender/makesrna/intern/rna_wm.c') diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 539a46c8f84..1c490e7951e 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -652,7 +652,7 @@ static void rna_wmClipboard_set(PointerRNA *ptr, const char *value) #ifdef WITH_PYTHON static void rna_Operator_unregister(const bContext *C, StructRNA *type) { - char *idname; + const char *idname; wmOperatorType *ot= RNA_struct_blender_type_get(type); if(!ot) @@ -668,7 +668,7 @@ static void rna_Operator_unregister(const bContext *C, StructRNA *type) idname= ot->idname; WM_operatortype_remove(ot->idname); - MEM_freeN(idname); + MEM_freeN((void *)idname); /* not to be confused with the RNA_struct_free that WM_operatortype_remove calls, they are 2 different srna's */ RNA_struct_free(&BLENDER_RNA, type); @@ -966,7 +966,7 @@ static StructRNA* rna_MacroOperator_refine(PointerRNA *opr) return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Macro; } -static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) +static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) { // wmWindowManager *wm = CTX_wm_manager(C); int modifier= 0; @@ -987,7 +987,7 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, char return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier); } -static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) +static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier) { wmWindowManager *wm = CTX_wm_manager(C); int modifier= 0; @@ -1026,7 +1026,7 @@ static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, Report return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue); } -static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal) +static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal) { if (modal == 0) { return WM_keymap_find(keyconf, idname, spaceid, regionid); @@ -1035,12 +1035,12 @@ static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, char *idname, int spaceid, } } -static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid) +static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid) { return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid); } -static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname) +static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, const char *idname) { wmOperatorType *ot = WM_operatortype_find(idname, 0); @@ -1088,17 +1088,20 @@ static void rna_def_operator(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ + // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_struct_name_property(srna, prop); 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_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); 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_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); @@ -1143,17 +1146,20 @@ static void rna_def_macro_operator(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ + // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_struct_name_property(srna, prop); 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_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER); prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); 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_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); -- cgit v1.2.3