forked from bartvdbraak/blender
Fix some issues found by Coverity Scan
Some of them are just brain dead code, some are potential bugs.
This commit is contained in:
parent
3c10ec96b5
commit
7549ec7301
@ -3055,7 +3055,7 @@ static bool select_anim_channel_keys(bAnimContext *ac, int channel_index, bool e
|
||||
ANIM_animdata_freelist(&anim_data);
|
||||
|
||||
/* F-Curve may not have any keyframes */
|
||||
if (fcu->bezt) {
|
||||
if (fcu && fcu->bezt) {
|
||||
BezTriple *bezt;
|
||||
|
||||
if (!extend) {
|
||||
|
@ -9077,6 +9077,9 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
|
||||
block = ar->uiblocks.first;
|
||||
|
||||
but = ui_but_find_active_in_region(ar);
|
||||
|
||||
BLI_assert(but);
|
||||
|
||||
data = but->active;
|
||||
submenu = data->menu;
|
||||
|
||||
|
@ -1215,7 +1215,6 @@ static void ui_panel_drag_collapse(bContext *C, uiPanelDragCollapseHandle *dragc
|
||||
rect.ymin = rect.ymax;
|
||||
rect.ymax = rect.ymin + PNL_HEADER;
|
||||
if (pa->flag & PNL_CLOSEDX) {
|
||||
rect.xmin = rect.xmin;
|
||||
rect.xmax = rect.xmin + PNL_HEADER;
|
||||
}
|
||||
|
||||
|
@ -1427,7 +1427,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
|
||||
if (down || top) {
|
||||
if (dir1 == UI_DIR_UP && top == 0) dir1 = UI_DIR_DOWN;
|
||||
if (dir1 == UI_DIR_DOWN && down == 0) dir1 = UI_DIR_UP;
|
||||
if (dir2 == UI_DIR_UP && top == 0) dir2 = UI_DIR_DOWN;
|
||||
/* dir2 is never set to UI_DIR_UP here */
|
||||
// if (dir2 == UI_DIR_UP && top == 0) dir2 = UI_DIR_DOWN;
|
||||
if (dir2 == UI_DIR_DOWN && down == 0) dir2 = UI_DIR_UP;
|
||||
}
|
||||
|
||||
|
@ -323,10 +323,14 @@ void UI_fontstyle_draw_simple_backdrop(
|
||||
/* XXX: read a style configure */
|
||||
uiStyle *UI_style_get(void)
|
||||
{
|
||||
#if 0
|
||||
uiStyle *style = NULL;
|
||||
/* offset is two struct uiStyle pointers */
|
||||
/* style = BLI_findstring(&U.uistyles, "Unifont Style", sizeof(style) * 2) */;
|
||||
style = BLI_findstring(&U.uistyles, "Unifont Style", sizeof(style) * 2);
|
||||
return (style != NULL) ? style : U.uistyles.first;
|
||||
#else
|
||||
return U.uistyles.first;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* for drawing, scaled with DPI setting */
|
||||
|
@ -3214,7 +3214,6 @@ void uiTemplateList(
|
||||
|
||||
/* add scrollbar */
|
||||
if (len > layoutdata.visual_items) {
|
||||
col = uiLayoutColumn(row, false);
|
||||
uiDefButI(block, UI_BTYPE_SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * dyn_data->visual_height,
|
||||
&ui_list->list_scroll, 0, dyn_data->height - dyn_data->visual_height,
|
||||
dyn_data->visual_height, 0, "");
|
||||
|
@ -1263,16 +1263,22 @@ static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti
|
||||
if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
|
||||
ar->winrct = *remainder;
|
||||
|
||||
if (alignment == RGN_ALIGN_TOP)
|
||||
ar->winrct.ymin = ar->winrct.ymax;
|
||||
else if (alignment == RGN_ALIGN_BOTTOM)
|
||||
ar->winrct.ymax = ar->winrct.ymin;
|
||||
else if (alignment == RGN_ALIGN_RIGHT)
|
||||
ar->winrct.xmin = ar->winrct.xmax;
|
||||
else if (alignment == RGN_ALIGN_LEFT)
|
||||
ar->winrct.xmax = ar->winrct.xmin;
|
||||
else /* prevent winrct to be valid */
|
||||
ar->winrct.xmax = ar->winrct.xmin;
|
||||
switch (alignment) {
|
||||
case RGN_ALIGN_TOP:
|
||||
ar->winrct.ymin = ar->winrct.ymax;
|
||||
break;
|
||||
case RGN_ALIGN_BOTTOM:
|
||||
ar->winrct.ymax = ar->winrct.ymin;
|
||||
break;
|
||||
case RGN_ALIGN_RIGHT:
|
||||
ar->winrct.xmin = ar->winrct.xmax;
|
||||
break;
|
||||
case RGN_ALIGN_LEFT:
|
||||
default:
|
||||
/* prevent winrct to be valid */
|
||||
ar->winrct.xmax = ar->winrct.xmin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* restore prev-split exception */
|
||||
@ -2161,7 +2167,7 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rctf rect, int fontid, const bool i
|
||||
|
||||
static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top)
|
||||
{
|
||||
char str[MAX_METADATA_STR];
|
||||
char str[MAX_METADATA_STR] = "";
|
||||
short i, count = 0;
|
||||
const float height = BLF_height_max(fontid) + 0.1f * U.widget_unit;
|
||||
|
||||
|
@ -1748,7 +1748,9 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
|
||||
newsa = sa;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BLI_assert(newsa);
|
||||
|
||||
if (sa && (sa->spacetype != type)) {
|
||||
newsa->flag |= AREA_FLAG_TEMP_TYPE;
|
||||
}
|
||||
|
@ -1234,7 +1234,7 @@ static void filelist_from_main(struct FileList *filelist)
|
||||
|
||||
files = filelist->filelist;
|
||||
|
||||
if (!filelist->filter_data.hide_parent) {
|
||||
if (files && !filelist->filter_data.hide_parent) {
|
||||
memset(&(filelist->filelist[0]), 0, sizeof(struct direntry));
|
||||
filelist->filelist[0].relname = BLI_strdup(FILENAME_PARENT);
|
||||
filelist->filelist[0].type |= S_IFDIR;
|
||||
@ -1246,7 +1246,7 @@ static void filelist_from_main(struct FileList *filelist)
|
||||
for (id = lb->first; id; id = id->next) {
|
||||
ok = 1;
|
||||
if (ok) {
|
||||
if (!filelist->filter_data.hide_dot || id->name[2] != '.') {
|
||||
if (files && (!filelist->filter_data.hide_dot || id->name[2] != '.')) {
|
||||
memset(files, 0, sizeof(struct direntry));
|
||||
if (id->lib == NULL) {
|
||||
files->relname = BLI_strdup(id->name + 2);
|
||||
|
@ -3262,6 +3262,9 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
|
||||
GPUOffScreen *ofs;
|
||||
bool draw_sky = (alpha_mode == R_ADDSKY) && v3d && (v3d->flag3 & V3D_SHOW_WORLD);
|
||||
|
||||
if (UNLIKELY(v3d == NULL))
|
||||
return NULL;
|
||||
|
||||
/* state changes make normal drawing go weird otherwise */
|
||||
glPushAttrib(GL_LIGHTING_BIT);
|
||||
|
||||
|
@ -1056,8 +1056,6 @@ static void draw_manipulator_rotate(
|
||||
glRotatef(90.0, 1.0, 0.0, 0.0);
|
||||
postOrtho(ortho);
|
||||
}
|
||||
|
||||
if (arcs) glDisable(GL_CLIP_PLANE0);
|
||||
}
|
||||
// donut arcs
|
||||
if (arcs) {
|
||||
|
@ -1173,7 +1173,7 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
|
||||
CTX_wm_operator_poll_msg_set(C, NULL);
|
||||
|
||||
/* dummie test */
|
||||
if (ot && C) {
|
||||
if (ot) {
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
|
||||
switch (context) {
|
||||
@ -2434,7 +2434,7 @@ void wm_event_do_handlers(bContext *C)
|
||||
|
||||
/* XXX hrmf, this gives reliable previous mouse coord for area change, feels bad?
|
||||
* doing it on ghost queue gives errors when mousemoves go over area borders */
|
||||
if (doit && win->screen && win->screen->subwinactive != win->screen->mainwin) {
|
||||
if (doit && win->screen->subwinactive != win->screen->mainwin) {
|
||||
win->eventstate->prevx = event->x;
|
||||
win->eventstate->prevy = event->y;
|
||||
//printf("win->eventstate->prev = %d %d\n", event->x, event->y);
|
||||
|
@ -546,7 +546,7 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
|
||||
if (to_kmi) {
|
||||
orig_kmi = WM_keymap_item_find_id(orig_km, kmi->id);
|
||||
|
||||
if (!orig_kmi)
|
||||
if (!orig_kmi && addon_km)
|
||||
orig_kmi = wm_keymap_find_item_equals(addon_km, kmi);
|
||||
|
||||
if (orig_kmi) {
|
||||
|
Loading…
Reference in New Issue
Block a user