[Bf-blender-cvs] [66c3eb36d27] blender2.7: Cleanup: use typed unsigned ints
Campbell Barton
noreply at git.blender.org
Fri Jan 4 01:20:57 CET 2019
Commit: 66c3eb36d274597b08930215bfc54094f1bcc14a
Author: Campbell Barton
Date: Fri Jan 4 11:09:18 2019 +1100
Branches: blender2.7
https://developer.blender.org/rB66c3eb36d274597b08930215bfc54094f1bcc14a
Cleanup: use typed unsigned ints
===================================================================
M source/blender/editors/interface/interface.c
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/interface/interface_eyedropper.c
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/interface/interface_icons.c
M source/blender/editors/interface/interface_intern.h
M source/blender/editors/interface/interface_layout.c
M source/blender/editors/interface/interface_panel.c
M source/blender/editors/interface/interface_region_color_picker.c
M source/blender/editors/interface/interface_region_tooltip.c
M source/blender/editors/interface/interface_regions_intern.h
M source/blender/editors/interface/interface_style.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/interface/resources.c
M source/blender/editors/interface/view2d.c
===================================================================
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index c2a0d00b2cd..94b17209655 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -867,8 +867,8 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
{
uiBut *but;
- unsigned int menu_key_mask = 0;
- unsigned char menu_key;
+ uint menu_key_mask = 0;
+ uchar menu_key;
const char *str_pt;
int pass;
int tot_missing = 0;
@@ -3677,7 +3677,7 @@ uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, in
* ((1 << findBitIndex(x)) == x);
* \endcode
*/
-static int findBitIndex(unsigned int x)
+static int findBitIndex(uint x)
{
if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
return -1;
@@ -4197,7 +4197,7 @@ PointerRNA *UI_but_operator_ptr_get(uiBut *but)
void UI_but_unit_type_set(uiBut *but, const int unit_type)
{
- but->unit_type = (unsigned char)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
+ but->unit_type = (uchar)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
}
int UI_but_unit_type_get(const uiBut *but)
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 50cd1c544c4..13acc632929 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1193,7 +1193,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
float size;
/* backdrop */
- glColor3ubv((unsigned char *)wcol->inner);
+ glColor3ubv((uchar *)wcol->inner);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_gl_mode(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f);
@@ -1252,7 +1252,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
/* AA circle */
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- glColor3ubv((unsigned char *)wcol->inner);
+ glColor3ubv((uchar *)wcol->inner);
glutil_draw_lined_arc(0.0f, M_PI * 2.0, 100.0f, 32);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
@@ -1288,7 +1288,7 @@ static void ui_draw_but_curve_grid(const rcti *rect, float zoomx, float zoomy, f
}
-static void gl_shaded_color(unsigned char *col, int shade)
+static void gl_shaded_color(uchar *col, int shade)
{
glColor3ub(col[0] - shade > 0 ? col[0] - shade : 0,
col[1] - shade > 0 ? col[1] - shade : 0,
@@ -1354,27 +1354,27 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
}
else {
if (cumap->flag & CUMA_DO_CLIP) {
- gl_shaded_color((unsigned char *)wcol->inner, -20);
+ gl_shaded_color((uchar *)wcol->inner, -20);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
- glColor3ubv((unsigned char *)wcol->inner);
+ glColor3ubv((uchar *)wcol->inner);
glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
}
else {
- glColor3ubv((unsigned char *)wcol->inner);
+ glColor3ubv((uchar *)wcol->inner);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
/* grid, every 0.25 step */
- gl_shaded_color((unsigned char *)wcol->inner, -16);
+ gl_shaded_color((uchar *)wcol->inner, -16);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
/* grid, every 1.0 step */
- gl_shaded_color((unsigned char *)wcol->inner, -24);
+ gl_shaded_color((uchar *)wcol->inner, -24);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
/* axes */
- gl_shaded_color((unsigned char *)wcol->inner, -50);
+ gl_shaded_color((uchar *)wcol->inner, -50);
glBegin(GL_LINES);
glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
@@ -1430,7 +1430,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
}
/* the curve */
- glColor3ubv((unsigned char *)wcol->item);
+ glColor3ubv((uchar *)wcol->item);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBegin(GL_LINE_STRIP);
@@ -1486,7 +1486,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
/* outline */
- glColor3ubv((unsigned char *)wcol->outline);
+ glColor3ubv((uchar *)wcol->outline);
fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
@@ -1677,7 +1677,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
/* ****************************************************** */
-static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha)
+static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, uchar alpha)
{
/* right quad */
glColor4ub(0, 0, 0, alpha);
@@ -1704,7 +1704,7 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s
glVertex2f(minx + 0.5f * shadsize, miny - shadsize);
}
-void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy)
+void UI_draw_box_shadow(uchar alpha, float minx, float miny, float maxx, float maxy)
{
glEnable(GL_BLEND);
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 67486f38760..e632055e63d 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -136,8 +136,8 @@ void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, co
wmWindow *win = CTX_wm_window(C);
int x = win->eventstate->x;
int y = win->eventstate->y;
- const unsigned char fg[4] = {255, 255, 255, 255};
- const unsigned char bg[4] = {0, 0, 0, 50};
+ const uchar fg[4] = {255, 255, 255, 255};
+ const uchar bg[4] = {0, 0, 0, 50};
if ((name[0] == '\0') ||
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index d454d3bcbeb..ac60140e2d8 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -290,7 +290,7 @@ typedef struct uiHandleButtonData {
ColorBand *coba;
/* tooltip */
- unsigned int tooltip_force : 1;
+ uint tooltip_force : 1;
/* auto open */
bool used_mouse;
@@ -2818,7 +2818,7 @@ static bool ui_textedit_insert_ascii(uiBut *but, uiHandleButtonData *data, char
if (ui_but_is_utf8(but) && (BLI_str_utf8_size(buf) == -1)) {
printf("%s: entering invalid ascii char into an ascii key (%d)\n",
- __func__, (int)(unsigned char)ascii);
+ __func__, (int)(uchar)ascii);
return false;
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index eed7f2ec0f2..7ef95ca87d4 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -83,8 +83,8 @@
typedef struct IconImage {
int w;
int h;
- unsigned int *rect;
- unsigned char *datatoc_rect;
+ uint *rect;
+ uchar *datatoc_rect;
int datatoc_size;
} IconImage;
@@ -159,7 +159,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
if (bbuf) {
int y, imgsize;
- iimg->rect = MEM_mallocN(size * size * sizeof(unsigned int), "icon_rect");
+ iimg->rect = MEM_mallocN(size * size * sizeof(uint), "icon_rect");
/* Here we store the rect in the icon - same as before */
if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0)
@@ -302,15 +302,15 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU
/* XXX: Include alpha into this... */
/* normal */
- glColor3ubv((unsigned char *)cs->solid);
+ glColor3ubv((uchar *)cs->solid);
glRecti(x, y, a, y + h);
/* selected */
- glColor3ubv((unsigned char *)cs->select);
+ glColor3ubv((uchar *)cs->select);
glRecti(a, y, b, y + h);
/* active */
- glColor3ubv((unsigned char *)cs->active);
+ glColor3ubv((uchar *)cs->active);
glRecti(b, y, c, y + h);
}
@@ -350,7 +350,7 @@ static void init_brush_icons(void)
#define INIT_BRUSH_ICON(icon_id, name) \
{ \
- unsigned char *rect = (unsigned char *)datatoc_ ##name## _png; \
+ uchar *rect = (uchar *)datatoc_ ##name## _png; \
int size = datatoc_ ##name## _png_size; \
DrawInfo *di; \
\
@@ -422,7 +422,7 @@ static void init_matcap_icons(void)
/* dynamic allocation now, tucking datatoc pointers in DrawInfo */
#define INIT_MATCAP_ICON(icon_id, name) \
{ \
- unsigned char *rect = (unsigned char *)datatoc_ ##name## _jpg; \
+ uchar *rect = (uchar *)datatoc_ ##name## _jpg; \
int size = datatoc_ ##name## _jpg_size; \
DrawInfo *di; \
\
@@ -486,13 +486,13 @@ static void init_internal_icons(void)
}
#endif
if (b16buf == NULL)
- b16buf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons16_png,
+ b16buf = IMB_ibImageFromMemory((uchar *)datatoc_blender_icons16_png,
datatoc_blender_icons16_png_size, IB_rect, NULL, "<blender icons>");
if (b16buf)
IMB_premultiply_alpha(b16buf);
if (b32buf == NULL)
- b32buf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons32_png,
+ b32buf = IMB_ibImageFromMemory((uchar *)datatoc_blender_icons32_png,
datatoc_blender_icons32_png_size, IB_rect, NULL, "<blender icons>");
if (b32buf)
IMB_premultiply_alpha(b32buf);
@@ -813,7 +813,7 @@ int UI_preview_render_size(enum eIconSizes size)
*/
static voi
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list