From 66c3eb36d274597b08930215bfc54094f1bcc14a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 4 Jan 2019 11:09:18 +1100 Subject: Cleanup: use typed unsigned ints --- source/blender/editors/interface/interface.c | 8 +-- source/blender/editors/interface/interface_draw.c | 26 ++++----- .../editors/interface/interface_eyedropper.c | 4 +- .../blender/editors/interface/interface_handlers.c | 4 +- source/blender/editors/interface/interface_icons.c | 28 +++++----- .../blender/editors/interface/interface_intern.h | 8 +-- .../blender/editors/interface/interface_layout.c | 12 ++-- source/blender/editors/interface/interface_panel.c | 24 ++++---- .../interface/interface_region_color_picker.c | 4 +- .../editors/interface/interface_region_tooltip.c | 4 +- .../editors/interface/interface_regions_intern.h | 2 +- source/blender/editors/interface/interface_style.c | 14 ++--- .../blender/editors/interface/interface_widgets.c | 52 +++++++++--------- source/blender/editors/interface/resources.c | 64 +++++++++++----------- source/blender/editors/interface/view2d.c | 6 +- 15 files changed, 130 insertions(+), 130 deletions(-) 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, ""); 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, ""); if (b32buf) IMB_premultiply_alpha(b32buf); @@ -813,7 +813,7 @@ int UI_preview_render_size(enum eIconSizes size) */ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size) { - unsigned int render_size = UI_preview_render_size(size); + uint render_size = UI_preview_render_size(size); if (!prv_img) { if (G.debug & G_DEBUG) @@ -824,7 +824,7 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size) prv_img->h[size] = render_size; prv_img->flag[size] |= PRV_CHANGED; prv_img->changed_timestamp[size] = 0; - prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(unsigned int), "prv_rect"); + prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(uint), "prv_rect"); } } @@ -936,7 +936,7 @@ PreviewImage *UI_icon_to_preview(int icon_id) } static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, - unsigned int *rect, float alpha, const float rgb[3], const bool is_preview) + uint *rect, float alpha, const float rgb[3], const bool is_preview) { ImBuf *ima = NULL; int draw_w = w; @@ -978,7 +978,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), /* first allocate imbuf for scaling and copy preview into it */ ima = IMB_allocImBuf(rw, rh, 32, IB_rect); - memcpy(ima->rect, rect, rw * rh * sizeof(unsigned int)); + memcpy(ima->rect, rect, rw * rh * sizeof(uint)); IMB_scaleImBuf(ima, draw_w, draw_h); /* scale it */ rect = ima->rect; } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 11691fd8365..671bd07b69e 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -242,7 +242,7 @@ struct uiBut { */ float a2; - unsigned char col[4]; + uchar col[4]; uiButHandleFunc func; void *func_arg1; @@ -282,7 +282,7 @@ struct uiBut { char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied from the block */ signed char pie_dir; /* direction in a pie menu, used for collision detection (RadialDirection) */ char changed; /* could be made into a single flag */ - unsigned char unit_type; /* so buttons can support unit systems which are not RNA */ + uchar unit_type; /* so buttons can support unit systems which are not RNA */ short modifier_key; short iconadd; @@ -306,7 +306,7 @@ struct uiBut { struct wmOperatorType *optype; struct PointerRNA *opptr; short opcontext; - unsigned char menu_key; /* 'a'-'z', always lower case */ + uchar menu_key; /* 'a'-'z', always lower case */ /* Draggable data, type is WM_DRAG_... */ char dragtype; @@ -377,7 +377,7 @@ struct uiBlock { rctf rect; float aspect; - unsigned int puphash; /* popup menu hash for memory */ + uint puphash; /* popup menu hash for memory */ uiButHandleFunc func; void *func_arg1; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 922b5779c9f..4324e050cec 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -399,7 +399,7 @@ static void ui_item_array( PropertyType type; PropertySubType subtype; uiLayout *sub; - unsigned int a, b; + uint a, b; /* retrieve type and subtype */ type = RNA_property_type(prop); @@ -417,9 +417,9 @@ static void ui_item_array( /* special check for layer layout */ int butw, buth, unit; int cols = (len >= 20) ? 2 : 1; - const unsigned int colbuts = len / (2 * cols); - unsigned int layer_used = 0; - unsigned int layer_active = 0; + const uint colbuts = len / (2 * cols); + uint layer_used = 0; + uint layer_active = 0; UI_block_layout_set_current(block, uiLayoutAbsolute(layout, false)); @@ -449,7 +449,7 @@ static void ui_item_array( for (a = 0; a < colbuts; a++) { const int layer_num = a + b * colbuts; - const unsigned int layer_flag = (1u << layer_num); + const uint layer_flag = (1u << layer_num); if (layer_used & layer_flag) { if (layer_active & layer_flag) @@ -467,7 +467,7 @@ static void ui_item_array( } for (a = 0; a < colbuts; a++) { const int layer_num = a + len / 2 + b * colbuts; - const unsigned int layer_flag = (1u << layer_num); + const uint layer_flag = (1u << layer_num); if (layer_used & layer_flag) { if (layer_active & layer_flag) diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 20f38b91b98..8332ab77bb2 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -492,7 +492,7 @@ static void ui_draw_panel_scalewidget(const rcti *rect) } static void ui_draw_panel_dragwidget(const rctf *rect) { - unsigned char col_back[3], col_high[3], col_dark[3]; + uchar col_back[3], col_high[3], col_dark[3]; const int col_tint = 84; const int px = (int)U.pixelsize; @@ -1519,7 +1519,7 @@ static void ui_panel_category_draw_tab( int mode, float minx, float miny, float maxx, float maxy, float rad, int roundboxtype, const bool use_highlight, const bool use_shadow, - const unsigned char highlight_fade[3]) + const uchar highlight_fade[3]) { float vec[4][2] = { {0.195, 0.02}, @@ -1637,20 +1637,20 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) int y_ofs = tab_v_pad; /* Primary theme colors */ - unsigned char theme_col_back[4]; - unsigned char theme_col_text[3]; - unsigned char theme_col_text_hi[3]; + uchar theme_col_back[4]; + uchar theme_col_text[3]; + uchar theme_col_text_hi[3]; /* Tab colors */ - unsigned char theme_col_tab_bg[4]; - unsigned char theme_col_tab_active[3]; - unsigned char theme_col_tab_inactive[3]; + uchar theme_col_tab_bg[4]; + uchar theme_col_tab_active[3]; + uchar theme_col_tab_inactive[3]; /* Secondary theme colors */ - unsigned char theme_col_tab_outline[3]; - unsigned char theme_col_tab_divider[3]; /* line that divides tabs from the main region */ - unsigned char theme_col_tab_highlight[3]; - unsigned char theme_col_tab_highlight_inactive[3]; + uchar theme_col_tab_outline[3]; + uchar theme_col_tab_divider[3]; /* line that divides tabs from the main region */ + uchar theme_col_tab_highlight[3]; + uchar theme_col_tab_highlight_inactive[3]; diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c index afa3486cf6c..f1079957592 100644 --- a/source/blender/editors/interface/interface_region_color_picker.c +++ b/source/blender/editors/interface/interface_region_color_picker.c @@ -169,7 +169,7 @@ static void ui_update_color_picker_buts_rgb( } else if (STREQ(bt->str, "Hex: ")) { float rgb_gamma[3]; - unsigned char rgb_gamma_uchar[3]; + uchar rgb_gamma_uchar[3]; double intpart; char col[16]; @@ -386,7 +386,7 @@ static void ui_block_colorpicker( static char tip[50]; static char hexcol[128]; float rgb_gamma[3]; - unsigned char rgb_gamma_uchar[3]; + uchar rgb_gamma_uchar[3]; float softmin, softmax, hardmin, hardmax, step, precision; int yco; ColorPicker *cpicker = ui_block_colorpicker_create(block); diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index 7bb0a02bbf6..7b844f9064d 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -187,10 +187,10 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) ui_draw_tooltip_background(UI_style_get(), NULL, &bbox); /* set background_color */ - rgb_uchar_to_float(background_color, (const unsigned char *)theme->inner); + rgb_uchar_to_float(background_color, (const uchar *)theme->inner); /* calculate normal_color */ - rgb_uchar_to_float(main_color, (const unsigned char *)theme->text); + rgb_uchar_to_float(main_color, (const uchar *)theme->text); copy_v3_v3(active_color, main_color); copy_v3_v3(normal_color, main_color); copy_v3_v3(python_color, main_color); diff --git a/source/blender/editors/interface/interface_regions_intern.h b/source/blender/editors/interface/interface_regions_intern.h index d23cf964c5e..7a0c4cd2111 100644 --- a/source/blender/editors/interface/interface_regions_intern.h +++ b/source/blender/editors/interface/interface_regions_intern.h @@ -30,7 +30,7 @@ #define MENU_PADDING (int)(0.2f * UI_UNIT_Y) /* interface_region_menu_popup.c */ -unsigned int ui_popup_menu_hash(const char *str); +uint ui_popup_menu_hash(const char *str); /* interface_regions_intern.h */ ARegion *ui_region_temp_add(bScreen *sc); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index c7ecc37b0bf..5991d99d980 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -293,7 +293,7 @@ void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const cha */ void UI_fontstyle_draw_simple_backdrop( const uiFontStyle *fs, float x, float y, const char *str, - const unsigned char fg[4], const unsigned char bg[4]) + const uchar fg[4], const uchar bg[4]) { if (fs->kerning == 1) BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT); @@ -401,7 +401,7 @@ void uiStyleInit(void) uiFont *font; uiStyle *style = U.uistyles.first; int monofont_size = datatoc_bmonofont_ttf_size; - unsigned char *monofont_ttf = (unsigned char *)datatoc_bmonofont_ttf; + uchar *monofont_ttf = (uchar *)datatoc_bmonofont_ttf; /* recover from uninitialized dpi */ if (U.dpi == 0) @@ -444,7 +444,7 @@ void uiStyleInit(void) if (font->uifont_id == UIFONT_DEFAULT) { #ifdef WITH_INTERNATIONAL int font_size = datatoc_bfont_ttf_size; - unsigned char *font_ttf = (unsigned char *)datatoc_bfont_ttf; + uchar *font_ttf = (uchar *)datatoc_bfont_ttf; static int last_font_size = 0; /* use unicode font for translation */ @@ -454,7 +454,7 @@ void uiStyleInit(void) if (!font_ttf) { /* fall back if not found */ font_size = datatoc_bfont_ttf_size; - font_ttf = (unsigned char *)datatoc_bfont_ttf; + font_ttf = (uchar *)datatoc_bfont_ttf; } } @@ -466,13 +466,13 @@ void uiStyleInit(void) font->blf_id = BLF_load_mem("default", font_ttf, font_size); #else - font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size); + font->blf_id = BLF_load_mem("default", (uchar *)datatoc_bfont_ttf, datatoc_bfont_ttf_size); #endif } else { font->blf_id = BLF_load(font->filename); if (font->blf_id == -1) { - font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size); + font->blf_id = BLF_load_mem("default", (uchar *)datatoc_bfont_ttf, datatoc_bfont_ttf_size); } } @@ -505,7 +505,7 @@ void uiStyleInit(void) if (!monofont_ttf) { /* fall back if not found */ monofont_size = datatoc_bmonofont_ttf_size; - monofont_ttf = (unsigned char *)datatoc_bmonofont_ttf; + monofont_ttf = (uchar *)datatoc_bmonofont_ttf; } } #endif diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index a655dea9215..5aa56dda0ff 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -97,10 +97,10 @@ enum { /* it has outline, back, and two optional tria meshes */ typedef struct uiWidgetTrias { - unsigned int tot; + uint tot; float vec[16][2]; - const unsigned int (*index)[3]; + const uint (*index)[3]; } uiWidgetTrias; @@ -514,7 +514,7 @@ static void shape_preset_init_trias_ex( uiWidgetTrias *tria, const rcti *rect, float triasize, char where, /* input data */ const float verts[][2], const int verts_tot, - const unsigned int tris[][3], const int tris_tot) + const uint tris[][3], const int tris_tot) { float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; @@ -636,7 +636,7 @@ static void shadecolors4(char coltop[4], char coldown[4], const char *color, sho coldown[3] = color[3]; } -static void round_box_shade_col4_r(unsigned char r_col[4], const char col1[4], const char col2[4], const float fac) +static void round_box_shade_col4_r(uchar r_col[4], const char col1[4], const char col2[4], const float fac) { const int faci = unit_float_to_uchar_clamp(fac); const int facm = 255 - faci; @@ -715,7 +715,7 @@ static void widgetbase_draw_ex( /* alpha fill */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4ubv((unsigned char *)wcol->inner); + glColor4ubv((uchar *)wcol->inner); for (a = 0; a < wtb->totvert; a++) { x_mid += wtb->inner_v[a][0]; @@ -739,7 +739,7 @@ static void widgetbase_draw_ex( } else { /* simple fill */ - glColor4ubv((unsigned char *)wcol->inner); + glColor4ubv((uchar *)wcol->inner); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v); @@ -749,8 +749,8 @@ static void widgetbase_draw_ex( } else { char col1[4], col2[4]; - unsigned char col_array[WIDGET_SIZE_MAX * 4]; - unsigned char *col_pt = col_array; + uchar col_array[WIDGET_SIZE_MAX * 4]; + uchar *col_pt = col_array; shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown); @@ -774,13 +774,13 @@ static void widgetbase_draw_ex( float triangle_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 because the last pair is wrapped */ float triangle_strip_emboss[WIDGET_SIZE_MAX * 2][2]; /* only for emboss */ - const unsigned char tcol[4] = { + const uchar tcol[4] = { wcol->outline[0], wcol->outline[1], wcol->outline[2], wcol->outline[3] / WIDGET_AA_JITTER, }; - unsigned char emboss[4]; + uchar emboss[4]; widget_verts_to_triangle_strip(wtb, wtb->totvert, triangle_strip); @@ -817,11 +817,11 @@ static void widgetbase_draw_ex( /* decoration */ if (wtb->tria1.tot || wtb->tria2.tot) { - const unsigned char tcol[4] = { + const uchar tcol[4] = { wcol->item[0], wcol->item[1], wcol->item[2], - (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER), + (uchar)((float)wcol->item[3] / WIDGET_AA_JITTER), }; glColor4ubv(tcol); @@ -1318,7 +1318,7 @@ static void widget_draw_text_ime_underline( fstyle->uifont_id, drawstr + but->ofs, ime_data->composite_len + but->pos - but->ofs); - glColor4ubv((unsigned char *)wcol->text); + glColor4ubv((uchar *)wcol->text); UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1); /* draw the thick line */ @@ -1422,7 +1422,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs); - glColor4ubv((unsigned char *)wcol->item); + glColor4ubv((uchar *)wcol->item); glRecti(rect->xmin + selsta_draw, rect->ymin + 2, min_ii(rect->xmin + selwidth_draw, rect->xmax - 2), @@ -1516,7 +1516,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b } #endif - glColor4ubv((unsigned char *)wcol->text); + glColor4ubv((uchar *)wcol->text); if (!use_right_only) { /* for underline drawing */ @@ -2396,7 +2396,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * glTranslatef(centx, centy, 0.0f); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); - glColor3ubv((unsigned char *)wcol->outline); + glColor3ubv((uchar *)wcol->outline); glutil_draw_lined_arc(0.0f, M_PI * 2.0, radius, tot + 1); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); @@ -2682,7 +2682,7 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol) { int y = rect->ymin + BLI_rcti_size_y(rect) / 2 - 1; - unsigned char col[4] = { + uchar col[4] = { wcol->text[0], wcol->text[1], wcol->text[2], @@ -3106,7 +3106,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat if (color_profile) ui_block_cm_to_display_space_v3(but->block, col); - rgba_float_to_uchar((unsigned char *)wcol->inner, col); + rgba_float_to_uchar((uchar *)wcol->inner, col); const bool show_alpha_checkers = (wcol->inner[3] < 255); wcol->shaded = 0; @@ -3358,9 +3358,9 @@ static void widget_state_label(uiWidgetType *wt, int state) /* call this for option button */ widget_state(wt, state); if (state & UI_SELECT) - UI_GetThemeColor3ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text); + UI_GetThemeColor3ubv(TH_TEXT_HI, (uchar *)wt->wcol.text); else - UI_GetThemeColor3ubv(TH_TEXT, (unsigned char *)wt->wcol.text); + UI_GetThemeColor3ubv(TH_TEXT, (uchar *)wt->wcol.text); } } @@ -3455,7 +3455,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * { uiWidgetBase wtb; const float rad = 0.25f * U.widget_unit; - unsigned char col[4]; + uchar col[4]; /* state copy! */ wt->wcol = *(wt->wcol_theme); @@ -4000,12 +4000,12 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) if (block) { if (block->flag & UI_BLOCK_CLIPTOP) { /* XXX no scaling for UI here yet */ - glColor3ubv((unsigned char *)wt->wcol.text); + glColor3ubv((uchar *)wt->wcol.text); UI_draw_icon_tri(BLI_rcti_cent_x(rect), rect->ymax - 8, 't'); } if (block->flag & UI_BLOCK_CLIPBOTTOM) { /* XXX no scaling for UI here yet */ - glColor3ubv((unsigned char *)wt->wcol.text); + glColor3ubv((uchar *)wt->wcol.text); UI_draw_icon_tri(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); } } @@ -4023,7 +4023,7 @@ static void draw_disk_shaded( float s, c; float y1, y2; float fac; - unsigned char r_col[4]; + uchar r_col[4]; glBegin(GL_TRIANGLE_STRIP); @@ -4217,7 +4217,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0'); } - glColor4ubv((unsigned char *)wt->wcol.text); + glColor4ubv((uchar *)wt->wcol.text); UI_fontstyle_draw(fstyle, rect, drawstr); } @@ -4284,7 +4284,7 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int BLI_strncpy(drawstr, name, sizeof(drawstr)); UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0'); - glColor4ubv((unsigned char *)wt->wcol.text); + glColor4ubv((uchar *)wt->wcol.text); UI_fontstyle_draw(fstyle, &trect, drawstr); } } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 77c36bf47f3..9681d771521 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -88,7 +88,7 @@ void ui_resources_free(void) /* THEMES */ /* ******************************************************** */ -const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) +const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) { ThemeSpace *ts = NULL; static char error[4] = {240, 0, 240, 255}; @@ -703,7 +703,7 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo } } - return (const unsigned char *)cp; + return (const uchar *)cp; } /* use this call to init new bone color sets in Theme */ @@ -1259,7 +1259,7 @@ void UI_Theme_Restore(struct bThemeState *theme_state) /* for space windows only */ void UI_ThemeColor(int colorid) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); glColor3ubv(cp); @@ -1269,7 +1269,7 @@ void UI_ThemeColor(int colorid) /* plus alpha */ void UI_ThemeColor4(int colorid) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); glColor4ubv(cp); @@ -1280,7 +1280,7 @@ void UI_ThemeColor4(int colorid) void UI_ThemeColorShade(int colorid, int offset) { int r, g, b; - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); r = offset + (int) cp[0]; @@ -1294,7 +1294,7 @@ void UI_ThemeColorShade(int colorid, int offset) void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) { int r, g, b, a; - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); r = coloffset + (int) cp[0]; @@ -1308,9 +1308,9 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) glColor4ub(r, g, b, a); } -void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]) +void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, uchar col[3]) { - const unsigned char *cp1, *cp2; + const uchar *cp1, *cp2; cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); @@ -1324,7 +1324,7 @@ void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned c /* blend between to theme colors, and set it */ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac) { - unsigned char col[3]; + uchar col[3]; UI_GetThemeColorBlend3ubv(colorid1, colorid2, fac, col); glColor3ubv(col); } @@ -1333,7 +1333,7 @@ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac) void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) { int r, g, b; - const unsigned char *cp1, *cp2; + const uchar *cp1, *cp2; cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); @@ -1354,7 +1354,7 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset) { int r, g, b, a; - const unsigned char *cp1, *cp2; + const uchar *cp1, *cp2; cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); @@ -1377,7 +1377,7 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off /* get individual values, not scaled */ float UI_GetThemeValuef(int colorid) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((float)cp[0]); @@ -1386,7 +1386,7 @@ float UI_GetThemeValuef(int colorid) /* get individual values, not scaled */ int UI_GetThemeValue(int colorid) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((int) cp[0]); @@ -1395,7 +1395,7 @@ int UI_GetThemeValue(int colorid) /* versions of the function above, which take a space-type */ float UI_GetThemeValueTypef(int colorid, int spacetype) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid); return ((float)cp[0]); @@ -1403,7 +1403,7 @@ float UI_GetThemeValueTypef(int colorid, int spacetype) int UI_GetThemeValueType(int colorid, int spacetype) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid); return ((int)cp[0]); @@ -1413,7 +1413,7 @@ int UI_GetThemeValueType(int colorid, int spacetype) /* get the color, range 0.0-1.0 */ void UI_GetThemeColor3fv(int colorid, float col[3]) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0] = ((float)cp[0]) / 255.0f; @@ -1423,7 +1423,7 @@ void UI_GetThemeColor3fv(int colorid, float col[3]) void UI_GetThemeColor4fv(int colorid, float col[4]) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0] = ((float)cp[0]) / 255.0f; @@ -1436,7 +1436,7 @@ void UI_GetThemeColor4fv(int colorid, float col[4]) void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) { int r, g, b; - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1452,10 +1452,10 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) col[2] = ((float)b) / 255.0f; } -void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]) +void UI_GetThemeColorShade3ubv(int colorid, int offset, uchar col[3]) { int r, g, b; - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1472,9 +1472,9 @@ void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]) } /* get the color, in char pointer */ -void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) +void UI_GetThemeColor3ubv(int colorid, uchar col[3]) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0] = cp[0]; @@ -1486,7 +1486,7 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) { int r, g, b, a; - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1507,9 +1507,9 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) } /* get the color, in char pointer */ -void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]) +void UI_GetThemeColor4ubv(int colorid, uchar col[4]) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0] = cp[0]; @@ -1520,7 +1520,7 @@ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]) void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]) { - const unsigned char *cp; + const uchar *cp; cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid); col[0] = cp[0]; @@ -1530,7 +1530,7 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]) } /* blends and shades between two char color pointers */ -void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset) +void UI_ColorPtrBlendShade3ubv(const uchar cp1[3], const uchar cp2[3], float fac, int offset) { int r, g, b; CLAMP(fac, 0.0f, 1.0f); @@ -1545,7 +1545,7 @@ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char c glColor3ub(r, g, b); } -void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], int offset) +void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset) { int r, g, b; @@ -1564,7 +1564,7 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in /* get a 3 byte color, blended and shaded between two other char color pointers */ void UI_GetColorPtrBlendShade3ubv( - const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], + const uchar cp1[3], const uchar cp2[3], uchar col[3], float fac, int offset) { int r, g, b; @@ -1605,9 +1605,9 @@ int UI_ThemeMenuShadowWidth(void) return (int)(btheme->tui.menu_shadow_width * UI_DPI_FAC); } -void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis) +void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axis) { - unsigned char col[3]; + uchar col[3]; switch (axis) { case 'X': @@ -2637,7 +2637,7 @@ void init_userdef_do_versions(Main *bmain) if (!USER_VERSION_ATLEAST(273, 5)) { bTheme *btheme; for (btheme = U.themes.first; btheme; btheme = btheme->next) { - unsigned char *cp = (unsigned char *)btheme->tv3d.clipping_border_3d; + uchar *cp = (uchar *)btheme->tv3d.clipping_border_3d; int c; copy_v4_v4_char((char *)cp, btheme->tv3d.back); c = cp[0] - 8; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 622d47bae18..eebe0f6dfe6 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1712,7 +1712,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v uiWidgetColors wcol = btheme->tui.wcol_scroll; rcti slider; int state; - unsigned char col[4]; + uchar col[4]; slider.xmin = vs->hor_min; slider.xmax = vs->hor_max; @@ -1813,7 +1813,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v uiWidgetColors wcol = btheme->tui.wcol_scroll; rcti slider; int state; - unsigned char col[4]; + uchar col[4]; slider.xmin = vert.xmin; slider.xmax = vert.xmax; @@ -2326,7 +2326,7 @@ short UI_view2d_mouse_in_scrollers(const bContext *C, View2D *v2d, int x, int y) typedef struct View2DString { struct View2DString *next; union { - unsigned char ub[4]; + uchar ub[4]; int pack; } col; rcti rect; -- cgit v1.2.3