[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34472] trunk/blender/source/blender/ editors/interface: no functional changes.
Campbell Barton
ideasman42 at gmail.com
Mon Jan 24 03:56:24 CET 2011
Revision: 34472
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34472
Author: campbellbarton
Date: 2011-01-24 02:56:23 +0000 (Mon, 24 Jan 2011)
Log Message:
-----------
no functional changes.
- remove unneeded casts to (char*) in interface code.
- replace strcmp(.., "") with checks on the first char of the string.
Modified Paths:
--------------
trunk/blender/source/blender/editors/interface/interface.c
trunk/blender/source/blender/editors/interface/interface_handlers.c
trunk/blender/source/blender/editors/interface/interface_layout.c
trunk/blender/source/blender/editors/interface/interface_regions.c
trunk/blender/source/blender/editors/interface/interface_utils.c
Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c 2011-01-23 19:20:10 UTC (rev 34471)
+++ trunk/blender/source/blender/editors/interface/interface.c 2011-01-24 02:56:23 UTC (rev 34472)
@@ -1703,7 +1703,7 @@
}
else if(but->type == IDPOIN) {
/* ID pointer */
- but->idpoin_func(C, (char*)str, but->idpoin_idpp);
+ but->idpoin_func(C, str, but->idpoin_idpp);
return 1;
}
else if(but->type == TEX) {
@@ -2574,18 +2574,18 @@
RNA_property_enum_items(block->evil_C, ptr, prop, &item, &totitem, &free);
for(i=0; i<totitem; i++) {
if(item[i].identifier[0] && item[i].value == (int)max) {
- str= (char*)item[i].name;
+ str= item[i].name;
icon= item[i].icon;
}
}
if(!str)
- str= (char*)RNA_property_ui_name(prop);
+ str= RNA_property_ui_name(prop);
if(free)
MEM_freeN(item);
}
else {
- str= (char*)RNA_property_ui_name(prop);
+ str= RNA_property_ui_name(prop);
icon= RNA_property_ui_icon(prop);
}
}
@@ -2600,7 +2600,7 @@
for(i=0; i<totitem; i++) {
if(item[i].identifier[0] && item[i].value == (int)max) {
if(item[i].description[0])
- tip= (char*)item[i].description;
+ tip= item[i].description;
break;
}
}
@@ -2611,7 +2611,7 @@
}
if(!tip)
- tip= (char*)RNA_property_ui_description(prop);
+ tip= RNA_property_ui_description(prop);
if(min == max || a1 == -1 || a2 == -1) {
if(proptype == PROP_INT) {
@@ -2654,7 +2654,7 @@
}
else {
printf("ui_def_but_rna: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
- str= (char*)propname;
+ str= propname;
}
/* now create button */
Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c 2011-01-23 19:20:10 UTC (rev 34471)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2011-01-24 02:56:23 UTC (rev 34472)
@@ -4115,7 +4115,7 @@
button_timers_tooltip_remove(C, but);
if(but->rnaprop)
- name= (char*)RNA_property_ui_name(but->rnaprop);
+ name= RNA_property_ui_name(but->rnaprop);
else if (but->optype)
name= but->optype->name;
else
Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c 2011-01-23 19:20:10 UTC (rev 34471)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c 2011-01-24 02:56:23 UTC (rev 34472)
@@ -345,7 +345,7 @@
uiBlockSetCurLayout(block, sub);
/* create label */
- if(strcmp(name, "") != 0)
+ if(name[0])
uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
/* create buttons */
@@ -464,12 +464,12 @@
if(!item[a].identifier[0])
continue;
- name= (!uiname || uiname[0])? (char*)item[a].name: "";
+ name= (!uiname || uiname[0])? item[a].name: "";
icon= item[a].icon;
value= item[a].value;
itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
- if(icon && strcmp(name, "") != 0 && !icon_only)
+ if(icon && name[0] && !icon_only)
but= uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
else if(icon)
but= uiDefIconButR(block, ROW, 0, icon, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
@@ -508,7 +508,7 @@
sub= uiLayoutRow(layout, 0);
uiBlockSetCurLayout(block, sub);
- if(strcmp(name, "") != 0) {
+ if(name[0]) {
/* XXX UI_GetStringWidth is not accurate
labelw= UI_GetStringWidth(name);
CLAMP(labelw, w/4, 3*w/4);*/
@@ -596,7 +596,7 @@
w= ui_text_icon_width(layout, name, 0, 0);
- 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, "");
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
but->lockstr = "";
@@ -628,12 +628,12 @@
if (flag & UI_ITEM_R_NO_BG)
uiBlockSetEmboss(block, UI_EMBOSSN);
- if(icon && strcmp(name, "") != 0)
- but= uiDefIconTextButO(block, BUT, ot->idname, context, icon, (char*)name, 0, 0, w, UI_UNIT_Y, NULL);
+ if(icon && name[0])
+ but= uiDefIconTextButO(block, BUT, ot->idname, context, icon, name, 0, 0, w, UI_UNIT_Y, NULL);
else if(icon)
but= uiDefIconButO(block, BUT, ot->idname, context, icon, 0, 0, w, UI_UNIT_Y, NULL);
else
- but= uiDefButO(block, BUT, ot->idname, context, (char*)name, 0, 0, w, UI_UNIT_Y, NULL);
+ but= uiDefButO(block, BUT, ot->idname, context, name, 0, 0, w, UI_UNIT_Y, NULL);
/* text alignment for toolbar buttons */
if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
@@ -680,7 +680,7 @@
RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, &totitem, &free);
if(RNA_enum_name(item, retval, &name)) {
if(free) MEM_freeN(item);
- return (char*)name;
+ return name;
}
if(free)
@@ -740,10 +740,10 @@
tptr.data= IDP_CopyProperty(properties);
RNA_enum_set(&tptr, propname, item[i].value);
- uiItemFullO(column, opname, (char*)item[i].name, item[i].icon, tptr.data, context, flag);
+ uiItemFullO(column, opname, item[i].name, item[i].icon, tptr.data, context, flag);
}
else
- uiItemEnumO(column, opname, (char*)item[i].name, item[i].icon, propname, item[i].value);
+ uiItemEnumO(column, opname, item[i].name, item[i].icon, propname, item[i].value);
}
else {
if(item[i].name) {
@@ -753,7 +753,7 @@
block->flag |= UI_BLOCK_NO_FLIP;
}
- uiItemL(column, (char*)item[i].name, ICON_NULL);
+ uiItemL(column, item[i].name, ICON_NULL);
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
}
@@ -889,7 +889,7 @@
h += len*UI_UNIT_Y;
}
else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
- if(type == PROP_BOOLEAN && strcmp(name, "") != 0)
+ if(type == PROP_BOOLEAN && name[0])
w += UI_UNIT_X/5;
else if(type == PROP_ENUM)
w += UI_UNIT_X/4;
@@ -917,7 +917,7 @@
/* set name and icon */
if(!name)
- name= (char*)RNA_property_ui_name(prop);
+ name= RNA_property_ui_name(prop);
if(icon == ICON_NULL)
icon= RNA_property_ui_icon(prop);
@@ -959,9 +959,9 @@
ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
/* enum item */
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
- char *identifier= (char*)RNA_property_identifier(prop);
+ const char *identifier= RNA_property_identifier(prop);
- if(icon && strcmp(name, "") != 0 && !icon_only)
+ if(icon && name[0] && !icon_only)
uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
else if(icon)
uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
@@ -981,7 +981,7 @@
}
/* single button */
else {
- but= uiDefAutoButR(block, ptr, prop, index, (char*)name, icon, 0, 0, w, h);
+ but= uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
if(slider && but->type==NUM)
but->type= NUMSLI;
@@ -1046,7 +1046,7 @@
for(a=0; item[a].identifier; a++) {
if(item[a].value == ivalue) {
- uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : (char*)item[a].name, icon ? icon : item[a].icon);
+ uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : item[a].name, icon ? icon : item[a].icon);
break;
}
}
@@ -1078,7 +1078,7 @@
for(i=0; i<totitem; i++) {
if(item[i].identifier[0]) {
- uiItemEnumR(column, (char*)item[i].name, ICON_NULL, ptr, propname, item[i].value);
+ uiItemEnumR(column, item[i].name, ICON_NULL, ptr, propname, item[i].value);
}
else {
if(item[i].name) {
@@ -1088,7 +1088,7 @@
block->flag |= UI_BLOCK_NO_FLIP;
}
- uiItemL(column, (char*)item[i].name, ICON_NULL);
+ uiItemL(column, item[i].name, ICON_NULL);
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
}
@@ -1285,7 +1285,7 @@
icon= RNA_struct_ui_icon(icontype);
}
if(!name)
- name= (char*)RNA_property_ui_name(prop);
+ name= RNA_property_ui_name(prop);
/* create button */
block= uiLayoutGetBlock(layout);
@@ -1330,11 +1330,11 @@
w -= 10;
if(name[0] && icon)
- but= uiDefIconTextMenuBut(block, func, arg, icon, (char*)name, 0, 0, w, h, "");
+ but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, "");
else if(icon)
but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, "");
else
- but= uiDefMenuBut(block, func, arg, (char*)name, 0, 0, w, h, "");
+ but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, "");
if(argN) { /* ugly .. */
but->poin= (char*)but;
@@ -1384,7 +1384,7 @@
w= ui_text_icon_width(layout, name, icon, 0);
- if(icon && strcmp(name, "") != 0)
+ if(icon && name[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, "");
@@ -1426,12 +1426,12 @@
w= ui_text_icon_width(layout, name, icon, 0);
- if(icon && strcmp(name, "") != 0)
- uiDefIconTextButF(block, BUTM, 0, icon, (char*)name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, "");
+ if(icon && name[0])
+ uiDefIconTextButF(block, BUTM, 0, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, "");
else if(icon)
uiDefIconButF(block, BUTM, 0, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, "");
else
- uiDefButF(block, BUTM, 0, (char*)name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, "");
+ uiDefButF(block, BUTM, 0, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, argval, "");
}
/* separator item */
@@ -1510,7 +1510,7 @@
}
if(!name)
- name= (char*)RNA_property_ui_name(prop);
+ name= RNA_property_ui_name(prop);
if(layout->root->type == UI_LAYOUT_MENU && !icon)
icon= ICON_BLANK1;
Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c 2011-01-23 19:20:10 UTC (rev 34471)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list