diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-17 12:45:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-17 12:45:45 +0300 |
commit | 51dcbdde033f6e8e55c4b1b4a47ca0624a6571ee (patch) | |
tree | 18315acbbe218deeea38c22ab41027df7d2cb06f /source/blender/editors/interface | |
parent | acc883da83b5fa7839a094e8dbf259077ca64f2e (diff) |
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.
Diffstat (limited to 'source/blender/editors/interface')
7 files changed, 89 insertions, 89 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index dfb375225b4..7120440468c 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1941,7 +1941,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor return block; } -uiBlock *uiGetBlock(char *name, ARegion *ar) +uiBlock *uiGetBlock(const char *name, ARegion *ar) { uiBlock *block= ar->uiblocks.first; @@ -2344,7 +2344,7 @@ for float buttons: all greater values will be clamped to 4. */ -static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) +static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but; short slen; @@ -2439,7 +2439,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short return but; } -uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip) +static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip) { uiBut *but; PropertyRNA *prop; @@ -2606,12 +2606,12 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1, but->a1= ui_get_but_step_unit(but, but->a1); if(freestr) - MEM_freeN(str); + MEM_freeN((void *)str); return but; } -uiBut *ui_def_but_operator(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip) +static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, int opcontext, const char *str, short x1, short y1, short x2, short y2, const char *tip) { uiBut *but; wmOperatorType *ot; @@ -2640,7 +2640,7 @@ uiBut *ui_def_but_operator(uiBlock *block, int type, char *opname, int opcontext return but; } -uiBut *ui_def_but_operator_text(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) +static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip) { uiBut *but; wmOperatorType *ot; @@ -2669,7 +2669,7 @@ uiBut *ui_def_but_operator_text(uiBlock *block, int type, char *opname, int opco return but; } -uiBut *uiDefBut(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) { uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); @@ -2819,7 +2819,7 @@ uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, sh { return uiDefButBit(block, type|CHA, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip) { uiBut *but; @@ -2829,7 +2829,7 @@ uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, shor return but; } -uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip) +uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip) { uiBut *but; @@ -2840,7 +2840,7 @@ uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *st return but; } -uiBut *uiDefButTextO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) { uiBut *but= ui_def_but_operator_text(block, type, opname, opcontext, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); @@ -2919,7 +2919,7 @@ uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, short x1, s return but; } -uiBut *uiDefIconButO(uiBlock *block, int type, char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip) +uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip) { uiBut *but; @@ -2934,7 +2934,7 @@ uiBut *uiDefIconButO(uiBlock *block, int type, char *opname, int opcontext, int } /* Button containing both string label and icon */ -uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) { uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); @@ -2947,7 +2947,7 @@ uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *st return but; } -static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) +static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip) { int bitIdx= findBitIndex(bit); if (bitIdx==-1) { @@ -2957,39 +2957,39 @@ static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, } } -uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextBut(block, type|FLO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextButBit(block, type|FLO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextBut(block, type|INT, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextButBit(block, type|INT, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextBut(block, type|SHO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextButBit(block, type|SHO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextBut(block, type|CHA, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip) { return uiDefIconTextButBit(block, type|CHA, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip); } -uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip) +uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip) { uiBut *but; @@ -3005,7 +3005,7 @@ uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *s return but; } -uiBut *uiDefIconTextButO(uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip) +uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, short x1, short y1, short x2, short y2, char *tip) { uiBut *but; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b6db799a443..643e1fa3fb7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -324,7 +324,7 @@ static void ui_apply_autokey_undo(bContext *C, uiBut *but) { Scene *scene= CTX_data_scene(C); uiAfterFunc *after; - char *str= NULL; + const char *str= NULL; if(but->flag & UI_BUT_UNDO) { /* define which string to use for undo */ @@ -4090,7 +4090,7 @@ static int ui_but_menu(bContext *C, uiBut *but) uiPopupMenu *pup; uiLayout *layout; int length; - char *name; + const char *name; if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL) return 0; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 7a0f69fc838..001bd4b9157 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -204,7 +204,7 @@ struct uiBut { uiLink *link; short linkto[2]; - char *tip, *lockstr; + const char *tip, *lockstr; BIFIconID icon; char lock; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index f729124e405..4e669746c2f 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -152,7 +152,7 @@ typedef struct uiLayoutItemRoot { /************************** Item ***************************/ -static char *ui_item_name_add_colon(char *name, char namestr[UI_MAX_NAME_STR]) +static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_NAME_STR]) { int len= strlen(name); @@ -205,7 +205,7 @@ static int ui_layout_vary_direction(uiLayout *layout) } /* estimated size of text + icon */ -static int ui_text_icon_width(uiLayout *layout, char *name, int icon, int compact) +static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int compact) { int variable = ui_layout_vary_direction(layout) == UI_ITEM_VARY_X; @@ -326,7 +326,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index) } /* create buttons for an item with an RNA array */ -static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int h, int expand, int slider, int toggle, int icon_only) +static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int h, int expand, int slider, int toggle, int icon_only) { uiStyle *style= layout->root->style; uiBut *but; @@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon uiBlockSetCurLayout(block, layout); } -static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only) +static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, const char *uiname, int h, int icon_only) { uiBut *but; EnumPropertyItem *item; @@ -483,7 +483,7 @@ static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_ } /* create label + button for RNA property */ -static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag) +static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag) { uiLayout *sub; uiBut *but=NULL; @@ -569,7 +569,7 @@ void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA /********************* Button Items *************************/ /* disabled item */ -static void ui_item_disabled(uiLayout *layout, char *name) +static void ui_item_disabled(uiLayout *layout, const char *name) { uiBlock *block= layout->root->block; uiBut *but; @@ -589,7 +589,7 @@ static void ui_item_disabled(uiLayout *layout, char *name) } /* operator items */ -PointerRNA uiItemFullO(uiLayout *layout, char *idname, char *name, int icon, IDProperty *properties, int context, int flag) +PointerRNA uiItemFullO(uiLayout *layout, const char *idname, const char *name, int icon, IDProperty *properties, int context, int flag) { uiBlock *block= layout->root->block; wmOperatorType *ot= WM_operatortype_find(idname, 0); @@ -646,7 +646,7 @@ PointerRNA uiItemFullO(uiLayout *layout, char *idname, char *name, int icon, IDP return PointerRNA_NULL; } -static char *ui_menu_enumpropname(uiLayout *layout, char *opname, char *propname, int retval) +static char *ui_menu_enumpropname(uiLayout *layout, const char *opname, const char *propname, int retval) { wmOperatorType *ot= WM_operatortype_find(opname, 0); PointerRNA ptr; @@ -676,7 +676,7 @@ static char *ui_menu_enumpropname(uiLayout *layout, char *opname, char *propname return ""; } -void uiItemEnumO(uiLayout *layout, char *opname, char *name, int icon, char *propname, int value) +void uiItemEnumO(uiLayout *layout, const char *opname, char *name, int icon, const char *propname, int value) { PointerRNA ptr; @@ -689,7 +689,7 @@ void uiItemEnumO(uiLayout *layout, char *opname, char *name, int icon, char *pro uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0); } -void uiItemsFullEnumO(uiLayout *layout, char *opname, char *propname, IDProperty *properties, int context, int flag) +void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname, IDProperty *properties, int context, int flag) { wmOperatorType *ot= WM_operatortype_find(opname, 0); PointerRNA ptr; @@ -753,13 +753,13 @@ void uiItemsFullEnumO(uiLayout *layout, char *opname, char *propname, IDProperty } } -void uiItemsEnumO(uiLayout *layout, char *opname, char *propname) +void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname) { uiItemsFullEnumO(layout, opname, propname, NULL, layout->root->opcontext, 0); } /* for use in cases where we have */ -void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value_str) +void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, char *value_str) { PointerRNA ptr; @@ -796,7 +796,7 @@ void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, ch uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0); } -void uiItemBooleanO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value) +void uiItemBooleanO(uiLayout *layout, char *name, int icon, const char *opname, const char *propname, int value) { PointerRNA ptr; @@ -806,7 +806,7 @@ void uiItemBooleanO(uiLayout *layout, char *name, int icon, char *opname, char * uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0); } -void uiItemIntO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value) +void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value) { PointerRNA ptr; @@ -816,7 +816,7 @@ void uiItemIntO(uiLayout *layout, char *name, int icon, char *opname, char *prop uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0); } -void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *propname, float value) +void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, float value) { PointerRNA ptr; @@ -826,7 +826,7 @@ void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *pr uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0); } -void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value) +void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, char *value) { PointerRNA ptr; @@ -836,14 +836,14 @@ void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *p uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0); } -void uiItemO(uiLayout *layout, char *name, int icon, char *opname) +void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname) { uiItemFullO(layout, opname, name, icon, NULL, layout->root->opcontext, 0); } /* RNA property items */ -static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int icon_only, int *r_w, int *r_h) +static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int icon_only, int *r_w, int *r_h) { PropertyType type; PropertySubType subtype; @@ -887,7 +887,7 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA *r_h= h; } -void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, char *name, int icon) +void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, const char *name, int icon) { uiBlock *block= layout->root->block; uiBut *but; @@ -977,7 +977,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index uiBlockSetEmboss(block, UI_EMBOSS); } -void uiItemR(uiLayout *layout, PointerRNA *ptr, char *propname, int flag, char *name, int icon) +void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag, const char *name, int icon) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); @@ -990,7 +990,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, char *propname, int flag, char * uiItemFullR(layout, ptr, prop, RNA_NO_INDEX, 0, flag, name, icon); } -void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value) +void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); @@ -1003,7 +1003,7 @@ void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon); } -void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *value, char *name, int icon) +void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); EnumPropertyItem *item; @@ -1035,7 +1035,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname MEM_freeN(item); } -void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname) +void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname) { PropertyRNA *prop; uiBlock *block= layout->root->block; @@ -1102,7 +1102,7 @@ int sort_search_items_list(void *a, void *b) return 0; } -static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, uiSearchItems *items) +static void rna_search_cb(const struct bContext *C, void *arg_but, const char *str, uiSearchItems *items) { uiBut *but= arg_but; char *name; @@ -1220,7 +1220,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN } } -void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *searchptr, char *searchpropname, char *name, int icon) +void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon) { PropertyRNA *prop, *searchprop; PropertyType type; @@ -1282,7 +1282,7 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) mt->draw(C, &menu); } -static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN) +static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN) { uiBlock *block= layout->root->block; uiBut *but; @@ -1324,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun } } -void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon) +void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const char *name, int icon) { MenuType *mt; @@ -1344,7 +1344,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, } /* label item */ -static uiBut *uiItemL_(uiLayout *layout, char *name, int icon) +static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) { uiBlock *block= layout->root->block; uiBut *but; @@ -1360,16 +1360,16 @@ static uiBut *uiItemL_(uiLayout *layout, char *name, int icon) w= ui_text_icon_width(layout, name, icon, 0); if(icon && strcmp(name, "") != 0) - but= uiDefIconTextBut(block, LABEL, 0, icon, (char*)name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + but= uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else if(icon) but= uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); else - but= uiDefBut(block, LABEL, 0, (char*)name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + but= uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); return but; } -void uiItemL(uiLayout *layout, char *name, int icon) +void uiItemL(uiLayout *layout, const char *name, int icon) { uiItemL_(layout, name, icon); } @@ -1419,7 +1419,7 @@ void uiItemS(uiLayout *layout) } /* level items */ -void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func, void *arg) +void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg) { if(!func) return; @@ -1429,8 +1429,8 @@ void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func, typedef struct MenuItemLevel { int opcontext; - char *opname; - char *propname; + const char *opname; + const char *propname; PointerRNA rnapoin; } MenuItemLevel; @@ -1442,7 +1442,7 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo uiItemsEnumO(layout, lvl->opname, lvl->propname); } -void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name, int icon) +void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name, int icon) { wmOperatorType *ot= WM_operatortype_find(opname, 0); MenuItemLevel *lvl; @@ -1473,7 +1473,7 @@ static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname); } -void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *name, int icon) +void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, int icon) { MenuItemLevel *lvl; PropertyRNA *prop; @@ -2553,7 +2553,7 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y) } } -void uiLayoutSetContextPointer(uiLayout *layout, char *name, PointerRNA *ptr) +void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *ptr) { uiBlock *block= layout->root->block; layout->context= CTX_store_add(&block->contexts, name, ptr); @@ -2631,7 +2631,7 @@ static void ui_intro_uiLayout(DynStr *ds, uiLayout *layout) } static char *str = NULL; // XXX, constant re-freeing, far from ideal. -char *uiLayoutIntrospect(uiLayout *layout) +const char *uiLayoutIntrospect(uiLayout *layout) { DynStr *ds= BLI_dynstr_new(); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index e244565a6a6..247fa62b51c 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2246,7 +2246,7 @@ static void confirm_cancel_operator(void *opv) WM_operator_free(opv); } -static void vconfirm_opname(bContext *C, char *opname, char *title, char *itemfmt, va_list ap) +static void vconfirm_opname(bContext *C, const char *opname, char *title, char *itemfmt, va_list ap) { uiPopupBlockHandle *handle; char *s, buf[512]; @@ -2258,7 +2258,7 @@ static void vconfirm_opname(bContext *C, char *opname, char *title, char *itemfm handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf); handle->popup_func= operator_name_cb; - handle->popup_arg= opname; + handle->popup_arg= (void *)opname; } static void confirm_operator(bContext *C, wmOperator *op, char *title, char *item) @@ -2276,7 +2276,7 @@ static void confirm_operator(bContext *C, wmOperator *op, char *title, char *ite handle->cancel_func= confirm_cancel_operator; } -void uiPupMenuOkee(bContext *C, char *opname, char *str, ...) +void uiPupMenuOkee(bContext *C, const char *opname, char *str, ...) { va_list ap; char titlestr[256]; @@ -2391,7 +2391,7 @@ void uiPupMenuInvoke(bContext *C, const char *idname) /*************************** Popup Block API **************************/ -void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, char *opname, int opcontext) +void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext) { wmWindow *window= CTX_wm_window(C); uiPopupBlockHandle *handle; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 719be6c3463..0baee38d396 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -230,7 +230,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, char *str) /* ************** helpers ************************ */ /* temporarily, does widget font */ -int UI_GetStringWidth(char *str) +int UI_GetStringWidth(const char *str) { uiStyle *style= U.uistyles.first; uiFontStyle *fstyle= &style->widget; @@ -249,7 +249,7 @@ int UI_GetStringWidth(char *str) } /* temporarily, does widget font */ -void UI_DrawString(float x, float y, char *str) +void UI_DrawString(float x, float y, const char *str) { uiStyle *style= U.uistyles.first; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 194e2275e41..a5964d595dd 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -95,7 +95,7 @@ static void id_search_call_cb(bContext *C, void *arg_template, void *item) } /* ID Search browse menu, do the search */ -static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSearchItems *items) +static void id_search_cb(const bContext *C, void *arg_template, const char *str, uiSearchItems *items) { TemplateID *template= (TemplateID*)arg_template; ListBase *lb= template->idlb; @@ -287,7 +287,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } } -static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop) +static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop) { uiBut *but; uiBlock *block; @@ -435,7 +435,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiBlockEndAlign(block); } -static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int flag, int prv_rows, int prv_cols) +static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols) { TemplateID *template; PropertyRNA *prop; @@ -473,17 +473,17 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char MEM_freeN(template); } -void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop) +void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0); } -void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop) +void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0); } -void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols) +void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols); } @@ -495,7 +495,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p * - propname: property identifier for property that ID-pointer gets stored to * - proptypename: property identifier for property used to determine the type of ID-pointer that can be used */ -void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text) +void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, const char *text) { PropertyRNA *propID, *propType; uiLayout *row; @@ -540,7 +540,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *pr * - propname: property identifier for property that path gets stored to * - root_ptr: struct that path gets built from */ -void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text) +void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), const char *text) { PropertyRNA *propPath; uiLayout *row; @@ -1293,7 +1293,7 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand colorband_buttons_large(layout, block, coba, 0, 0, cb); } -void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, int expand) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1323,7 +1323,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Histogram Template ************************/ -void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname) +void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1362,7 +1362,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname) /********************* Waveform Template ************************/ -void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname) +void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1398,7 +1398,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname) /********************* Vectorscope Template ************************/ -void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname) +void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1762,7 +1762,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiBlockSetNFunc(block, NULL, NULL, NULL); } -void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, char *propname, int type, int levels, int brush) +void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type, int levels, int brush) { RNAUpdateCb *cb; PropertyRNA *prop= RNA_struct_find_property(ptr, propname); @@ -1788,7 +1788,7 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, char *propname, i #define WHEEL_SIZE 100 -void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic) +void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); uiBlock *block= uiLayoutGetBlock(layout); @@ -1853,8 +1853,8 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) // - for now, grouping of layers is determined by dividing up the length of // the array of layer bitflags -void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname, - PointerRNA *used_ptr, char *used_propname, int active_layer) +void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, + PointerRNA *used_ptr, const char *used_propname, int active_layer) { uiLayout *uRow, *uCol; PropertyRNA *prop, *used_prop= NULL; @@ -1956,7 +1956,7 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon) return rnaicon; } -static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, char *activepropname) +static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, const char *activepropname) { Object *ob; uiBlock *block= uiLayoutGetBlock(layout); @@ -2025,7 +2025,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe MEM_freeN(namebuf); } -void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *activeptr, char *activepropname, int rows, int maxrows, int listtype) +void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, int rows, int maxrows, int listtype) { //Scene *scene= CTX_data_scene(C); PropertyRNA *prop= NULL, *activeprop; @@ -2212,7 +2212,7 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) +static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); |