replace fixed sizes with sizeof when passing string length since size wasn't always correct.
This commit is contained in:
@@ -310,7 +310,7 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = recv(connsock, buf, 4095, 0);
|
len = recv(connsock, buf, sizeof(buf) - 1, 0);
|
||||||
|
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ int BLI_file_gzip(const char *from, const char *to)
|
|||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
readsize = read(file, buffer, 10240);
|
readsize = read(file, buffer, sizeof(buffer));
|
||||||
|
|
||||||
if(readsize < 0) {
|
if(readsize < 0) {
|
||||||
rval= -2; /* error happened in reading */
|
rval= -2; /* error happened in reading */
|
||||||
|
|||||||
@@ -831,7 +831,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
|
|||||||
if(but->optype) {
|
if(but->optype) {
|
||||||
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
|
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
|
||||||
|
|
||||||
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) {
|
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
|
||||||
|
buf, sizeof(buf)))
|
||||||
|
{
|
||||||
UI_MENU_KEY_STR_CAT
|
UI_MENU_KEY_STR_CAT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -846,7 +848,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
|
|||||||
|
|
||||||
IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname));
|
IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname));
|
||||||
|
|
||||||
if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE, buf, sizeof(buf))) {
|
if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
|
||||||
|
buf, sizeof(buf)))
|
||||||
|
{
|
||||||
UI_MENU_KEY_STR_CAT
|
UI_MENU_KEY_STR_CAT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4388,7 +4388,9 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
|
|||||||
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
|
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
|
||||||
|
|
||||||
/* complex code to change name of button */
|
/* complex code to change name of button */
|
||||||
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) {
|
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
|
||||||
|
buf, sizeof(buf)))
|
||||||
|
{
|
||||||
char *butstr_orig;
|
char *butstr_orig;
|
||||||
|
|
||||||
// XXX but->str changed... should not, remove the hotkey from it
|
// XXX but->str changed... should not, remove the hotkey from it
|
||||||
|
|||||||
@@ -409,7 +409,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
|||||||
/* operator keymap (not menus, they already have it) */
|
/* operator keymap (not menus, they already have it) */
|
||||||
prop= (but->opptr)? but->opptr->data: NULL;
|
prop= (but->opptr)? but->opptr->data: NULL;
|
||||||
|
|
||||||
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, buf, sizeof(buf))) {
|
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
|
||||||
|
buf, sizeof(buf)))
|
||||||
|
{
|
||||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf);
|
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf);
|
||||||
data->color[data->totline]= 0x888888;
|
data->color[data->totline]= 0x888888;
|
||||||
data->totline++;
|
data->totline++;
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
|
|||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL);
|
uiDefBut(block, LABEL, 0, "", 10, 15, w, h, NULL, 0, 0, 0, 0, NULL);
|
||||||
|
|
||||||
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, w, 19, template.prv_rows, template.prv_cols, "");
|
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, w, 19, template.prv_rows, template.prv_cols, "");
|
||||||
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
|
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
|
||||||
}
|
}
|
||||||
/* list view */
|
/* list view */
|
||||||
@@ -189,7 +189,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
|
|||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
||||||
|
|
||||||
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, 19, 0, 0, "");
|
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
|
uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -884,7 +884,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
|||||||
if(getenv(strEnvName)) {
|
if(getenv(strEnvName)) {
|
||||||
int dlevel = atoi(getenv(strEnvName));
|
int dlevel = atoi(getenv(strEnvName));
|
||||||
elbeemSetDebugLevel(dlevel);
|
elbeemSetDebugLevel(dlevel);
|
||||||
BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
|
BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
|
||||||
elbeemDebugOut(debugStrBuffer);
|
elbeemDebugOut(debugStrBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,7 +921,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
|||||||
|
|
||||||
/* rough check of settings... */
|
/* rough check of settings... */
|
||||||
if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
|
if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
|
||||||
BLI_snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
|
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
|
||||||
elbeemDebugOut(debugStrBuffer);
|
elbeemDebugOut(debugStrBuffer);
|
||||||
domainSettings->previewresxyz = domainSettings->resolutionxyz;
|
domainSettings->previewresxyz = domainSettings->resolutionxyz;
|
||||||
}
|
}
|
||||||
@@ -941,7 +941,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
|||||||
} else {
|
} else {
|
||||||
gridlevels = domainSettings->maxRefine;
|
gridlevels = domainSettings->maxRefine;
|
||||||
}
|
}
|
||||||
BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
|
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
|
||||||
elbeemDebugOut(debugStrBuffer);
|
elbeemDebugOut(debugStrBuffer);
|
||||||
|
|
||||||
|
|
||||||
@@ -993,7 +993,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
|||||||
/* ******** init domain object's matrix ******** */
|
/* ******** init domain object's matrix ******** */
|
||||||
copy_m4_m4(domainMat, fsDomain->obmat);
|
copy_m4_m4(domainMat, fsDomain->obmat);
|
||||||
if(!invert_m4_m4(invDomMat, domainMat)) {
|
if(!invert_m4_m4(invDomMat, domainMat)) {
|
||||||
BLI_snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n");
|
BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::error - Invalid obj matrix?\n");
|
||||||
elbeemDebugOut(debugStrBuffer);
|
elbeemDebugOut(debugStrBuffer);
|
||||||
BKE_report(reports, RPT_ERROR, "Invalid object matrix");
|
BKE_report(reports, RPT_ERROR, "Invalid object matrix");
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ ImBuf* get_brush_icon(Brush *brush)
|
|||||||
{
|
{
|
||||||
static const int flags = IB_rect|IB_multilayer|IB_metadata;
|
static const int flags = IB_rect|IB_multilayer|IB_metadata;
|
||||||
|
|
||||||
char path[240];
|
char path[FILE_MAX];
|
||||||
char *folder;
|
char *folder;
|
||||||
|
|
||||||
if (!(brush->icon_imbuf)) {
|
if (!(brush->icon_imbuf)) {
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
|
|||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
||||||
|
|
||||||
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 0, 150, UI_UNIT_Y, 0, 0, "");
|
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, UI_UNIT_Y, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot);
|
uiButSetSearchFunc(but, operator_search_cb, arg_kmi, operator_call_cb, ot);
|
||||||
|
|
||||||
uiBoundsBlock(block, 6);
|
uiBoundsBlock(block, 6);
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
|||||||
dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
|
dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
|
||||||
if(dg) {
|
if(dg) {
|
||||||
max+= BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr);
|
max+= BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr);
|
||||||
if(max<320) strcat(defstr, str);
|
if (max < sizeof(str)) strcat(defstr, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tfp->curdef==dvert->dw[i].def_nr) {
|
if(tfp->curdef==dvert->dw[i].def_nr) {
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
|
|||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
|
||||||
|
|
||||||
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, OP_MAX_TYPENAME, 10, 0, 150, 19, 0, 0, "");
|
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL);
|
uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL);
|
||||||
|
|
||||||
uiBoundsBlock(block, 6);
|
uiBoundsBlock(block, 6);
|
||||||
|
|||||||
@@ -386,12 +386,12 @@ static void get_proxy_filename(struct anim * anim, IMB_Proxy_Size preview_size,
|
|||||||
stream_suffix[0] = 0;
|
stream_suffix[0] = 0;
|
||||||
|
|
||||||
if (anim->streamindex > 0) {
|
if (anim->streamindex > 0) {
|
||||||
BLI_snprintf(stream_suffix, 20, "_st%d", anim->streamindex);
|
BLI_snprintf(stream_suffix, sizeof(stream_suffix), "_st%d", anim->streamindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_snprintf(proxy_name, 256, "proxy_%d%s.avi",
|
BLI_snprintf(proxy_name, sizeof(proxy_name), "proxy_%d%s.avi",
|
||||||
(int) (proxy_fac[i] * 100), stream_suffix);
|
(int) (proxy_fac[i] * 100), stream_suffix);
|
||||||
BLI_snprintf(proxy_temp_name, 256, "proxy_%d%s_part.avi",
|
BLI_snprintf(proxy_temp_name, sizeof(proxy_temp_name), "proxy_%d%s_part.avi",
|
||||||
(int) (proxy_fac[i] * 100), stream_suffix);
|
(int) (proxy_fac[i] * 100), stream_suffix);
|
||||||
|
|
||||||
get_index_dir(anim, index_dir);
|
get_index_dir(anim, index_dir);
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
|
|||||||
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
|
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
|
||||||
|
|
||||||
//uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy...
|
//uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy...
|
||||||
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
|
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL);
|
uiButSetSearchFunc(but, operator_enum_search_cb, op->type, operator_enum_call_cb, NULL);
|
||||||
|
|
||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
@@ -1397,12 +1397,15 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
|
|||||||
int len= strlen(ot->name);
|
int len= strlen(ot->name);
|
||||||
|
|
||||||
/* display name for menu, can hold hotkey */
|
/* display name for menu, can hold hotkey */
|
||||||
BLI_strncpy(name, ot->name, 256);
|
BLI_strncpy(name, ot->name, sizeof(name));
|
||||||
|
|
||||||
/* check for hotkey */
|
/* check for hotkey */
|
||||||
if(len < 256-6) {
|
if (len < sizeof(name) - 6) {
|
||||||
if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, &name[len+1], 256-len-1))
|
if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE,
|
||||||
|
&name[len+1], sizeof(name)-len-1))
|
||||||
|
{
|
||||||
name[len]= '|';
|
name[len]= '|';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(0==uiSearchItemAdd(items, name, ot, 0))
|
if(0==uiSearchItemAdd(items, name, ot, 0))
|
||||||
@@ -1424,7 +1427,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_
|
|||||||
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
|
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
|
||||||
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
|
uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
|
||||||
|
|
||||||
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
|
but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
|
||||||
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
|
uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL);
|
||||||
|
|
||||||
/* fake button, it holds space for search items */
|
/* fake button, it holds space for search items */
|
||||||
|
|||||||
Reference in New Issue
Block a user