code cleanup: use bool for widget struct, also edit odd strncpy use.

This commit is contained in:
2013-07-19 10:39:44 +00:00
parent 33e0bc6b48
commit a15ac6ee09
2 changed files with 9 additions and 8 deletions

View File

@@ -191,7 +191,7 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl) char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl)
{ {
if (!strncpy(fileUrl, "file://", 7) == 0) { if (strncpy(fileUrl, "file://", 7) != 0) {
/* assume one character of encoded URL can be expanded to 4 chars max */ /* assume one character of encoded URL can be expanded to 4 chars max */
int decodedSize = 4 * strlen(fileUrl) + 1; int decodedSize = 4 * strlen(fileUrl) + 1;
char *decodedPath = (char *)malloc(decodedSize); char *decodedPath = (char *)malloc(decodedSize);

View File

@@ -96,8 +96,7 @@ typedef struct uiWidgetBase {
float inner_v[WIDGET_SIZE_MAX][2]; float inner_v[WIDGET_SIZE_MAX][2];
float inner_uv[WIDGET_SIZE_MAX][2]; float inner_uv[WIDGET_SIZE_MAX][2];
short inner, outline, emboss; /* set on/off */ bool inner, outline, emboss, shadedir;
short shadedir;
uiWidgetTrias tria1; uiWidgetTrias tria1;
uiWidgetTrias tria2; uiWidgetTrias tria2;
@@ -2365,7 +2364,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slid
uiWidgetBase wtb; uiWidgetBase wtb;
int horizontal; int horizontal;
float rad; float rad;
short outline = 0; bool outline = false;
widget_init(&wtb); widget_init(&wtb);
@@ -2409,8 +2408,9 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slid
wtb.emboss = 0; /* only emboss once */ wtb.emboss = 0; /* only emboss once */
/* exception for progress bar */ /* exception for progress bar */
if (state & UI_SCROLL_NO_OUTLINE) if (state & UI_SCROLL_NO_OUTLINE) {
SWAP(short, outline, wtb.outline); SWAP(bool, outline, wtb.outline);
}
round_box_edges(&wtb, UI_CNR_ALL, slider, rad); round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
@@ -2431,8 +2431,9 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slid
} }
widgetbase_draw(&wtb, wcol); widgetbase_draw(&wtb, wcol);
if (state & UI_SCROLL_NO_OUTLINE) if (state & UI_SCROLL_NO_OUTLINE) {
SWAP(short, outline, wtb.outline); SWAP(bool, outline, wtb.outline);
}
} }
} }