replace strnlen with BLI_strnlen, make some args const - no functional changes.
This commit is contained in:
@@ -576,7 +576,7 @@ void uiButSetFocusOnEnter (struct wmWindow *win, uiBut *but);
|
||||
|
||||
typedef struct AutoComplete AutoComplete;
|
||||
|
||||
AutoComplete *autocomplete_begin(const char *startname, int maxlen);
|
||||
AutoComplete *autocomplete_begin(const char *startname, size_t maxlen);
|
||||
void autocomplete_do_name(AutoComplete *autocpl, const char *name);
|
||||
void autocomplete_end(AutoComplete *autocpl, char *autoname);
|
||||
|
||||
|
@@ -1528,7 +1528,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
|
||||
}
|
||||
|
||||
/* str will be overwritten */
|
||||
void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen)
|
||||
void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
|
||||
{
|
||||
if(ui_is_but_unit(but)) {
|
||||
UnitSettings *unit= but->block->unit;
|
||||
@@ -1576,7 +1576,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
|
||||
}
|
||||
|
||||
|
||||
void ui_get_but_string(uiBut *but, char *str, int maxlen)
|
||||
void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
|
||||
{
|
||||
if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
|
||||
PropertyType type;
|
||||
@@ -2176,7 +2176,7 @@ void ui_check_but(uiBut *but)
|
||||
BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
|
||||
}
|
||||
else {
|
||||
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -2194,7 +2194,7 @@ void ui_check_but(uiBut *but)
|
||||
break;
|
||||
|
||||
case KEYEVT:
|
||||
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
if (but->flag & UI_SELECT) {
|
||||
strcat(but->drawstr, "Press a key");
|
||||
}
|
||||
@@ -2226,15 +2226,15 @@ void ui_check_but(uiBut *but)
|
||||
strcat(but->drawstr, "Press a key ");
|
||||
}
|
||||
else
|
||||
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
|
||||
break;
|
||||
|
||||
case BUT_TOGDUAL:
|
||||
/* trying to get the dual-icon to left of text... not very nice */
|
||||
if(but->str[0]) {
|
||||
strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
|
||||
strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
|
||||
BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR);
|
||||
BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2242,13 +2242,13 @@ void ui_check_but(uiBut *but)
|
||||
case HSVCIRCLE:
|
||||
break;
|
||||
default:
|
||||
strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
|
||||
|
||||
}
|
||||
|
||||
/* if we are doing text editing, this will override the drawstr */
|
||||
if(but->editstr)
|
||||
strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
|
||||
BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
|
||||
|
||||
/* text clipping moved to widget drawing code itself */
|
||||
}
|
||||
@@ -2822,12 +2822,12 @@ static int findBitIndex(unsigned int x) {
|
||||
|
||||
/* autocomplete helper functions */
|
||||
struct AutoComplete {
|
||||
int maxlen;
|
||||
size_t maxlen;
|
||||
char *truncate;
|
||||
const char *startname;
|
||||
};
|
||||
|
||||
AutoComplete *autocomplete_begin(const char *startname, int maxlen)
|
||||
AutoComplete *autocomplete_begin(const char *startname, size_t maxlen)
|
||||
{
|
||||
AutoComplete *autocpl;
|
||||
|
||||
|
@@ -83,7 +83,7 @@ void ui_but_anim_flag(uiBut *but, float cfra)
|
||||
}
|
||||
}
|
||||
|
||||
int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen)
|
||||
int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen)
|
||||
{
|
||||
FCurve *fcu;
|
||||
ChannelDriver *driver;
|
||||
|
@@ -364,8 +364,8 @@ extern void ui_set_but_vectorf(uiBut *but, float *vec);
|
||||
|
||||
extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my);
|
||||
|
||||
extern void ui_get_but_string(uiBut *but, char *str, int maxlen);
|
||||
extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen);
|
||||
extern void ui_get_but_string(uiBut *but, char *str, size_t maxlen);
|
||||
extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen);
|
||||
extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str);
|
||||
extern int ui_get_but_string_max_length(uiBut *but);
|
||||
|
||||
@@ -517,7 +517,7 @@ void ui_but_anim_copy_driver(struct bContext *C);
|
||||
void ui_but_anim_paste_driver(struct bContext *C);
|
||||
void ui_but_anim_add_keyingset(struct bContext *C);
|
||||
void ui_but_anim_remove_keyingset(struct bContext *C);
|
||||
int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen);
|
||||
int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen);
|
||||
int ui_but_anim_expression_set(uiBut *but, const char *str);
|
||||
int ui_but_anim_expression_create(uiBut *but, const char *str);
|
||||
void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra);
|
||||
|
@@ -84,7 +84,7 @@ typedef struct MenuEntry {
|
||||
} MenuEntry;
|
||||
|
||||
typedef struct MenuData {
|
||||
char *instr;
|
||||
const char *instr;
|
||||
const char *title;
|
||||
int titleicon;
|
||||
|
||||
@@ -92,7 +92,7 @@ typedef struct MenuData {
|
||||
int nitems, itemssize;
|
||||
} MenuData;
|
||||
|
||||
static MenuData *menudata_new(char *instr)
|
||||
static MenuData *menudata_new(const char *instr)
|
||||
{
|
||||
MenuData *md= MEM_mallocN(sizeof(*md), "MenuData");
|
||||
|
||||
@@ -137,7 +137,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico
|
||||
|
||||
static void menudata_free(MenuData *md)
|
||||
{
|
||||
MEM_freeN(md->instr);
|
||||
MEM_freeN((void *)md->instr);
|
||||
if (md->items)
|
||||
MEM_freeN(md->items);
|
||||
MEM_freeN(md);
|
||||
@@ -156,7 +156,7 @@ static void menudata_free(MenuData *md)
|
||||
* @param str String to be parsed.
|
||||
* @retval new menudata structure, free with menudata_free()
|
||||
*/
|
||||
static MenuData *decompose_menu_string(char *str)
|
||||
static MenuData *decompose_menu_string(const char *str)
|
||||
{
|
||||
char *instr= BLI_strdup(str);
|
||||
MenuData *md= menudata_new(instr);
|
||||
@@ -1613,7 +1613,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
|
||||
uiBut *bt;
|
||||
MenuData *md;
|
||||
MenuEntry *entry;
|
||||
char *instr= arg_str;
|
||||
const char *instr= arg_str;
|
||||
int columns, rows, a, b;
|
||||
|
||||
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
|
||||
@@ -2154,7 +2154,7 @@ static int ui_popup_string_hash(char *str)
|
||||
return hash;
|
||||
}
|
||||
|
||||
static int ui_popup_menu_hash(char *str)
|
||||
static int ui_popup_menu_hash(const char *str)
|
||||
{
|
||||
return BLI_ghashutil_strhash(str);
|
||||
}
|
||||
@@ -2204,8 +2204,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
|
||||
{
|
||||
uiBlock *block;
|
||||
uiBut *bt;
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
uiPopupMenu *pup= arg_pup;
|
||||
int offset[2], direction, minwidth, width, height, flip;
|
||||
|
||||
@@ -2277,10 +2275,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
|
||||
else {
|
||||
/* for a header menu we set the direction automatic */
|
||||
if(!pup->slideout && flip) {
|
||||
sa= CTX_wm_area(C);
|
||||
ar= CTX_wm_region(C);
|
||||
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
if(sa && sa->headertype==HEADERDOWN) {
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
if(ar && ar->regiontype == RGN_TYPE_HEADER) {
|
||||
uiBlockSetDirection(block, UI_TOP);
|
||||
uiBlockFlipOrder(block);
|
||||
|
@@ -574,7 +574,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
|
||||
|
||||
|
||||
/* prepares shade colors */
|
||||
static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown)
|
||||
static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown)
|
||||
{
|
||||
|
||||
coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255);
|
||||
@@ -1493,7 +1493,7 @@ void ui_widget_color_init(ThemeUI *tui)
|
||||
|
||||
/* ************ button callbacks, state ***************** */
|
||||
|
||||
static void widget_state_blend(char *cp, const char *cpstate, const float fac)
|
||||
static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
|
||||
{
|
||||
if(fac != 0.0f) {
|
||||
cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
|
||||
|
Reference in New Issue
Block a user