diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-05-15 00:58:08 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-05-15 02:08:41 +0300 |
commit | 7549ec7301cf051931878180eba52da16bc4c4ad (patch) | |
tree | a21a700ec2cd79eb9a2ebd61ea3cab0ec7672bab /source/blender/editors/screen/area.c | |
parent | 3c10ec96b5ec1c705362ccdaeaac8007050d081f (diff) |
Fix some issues found by Coverity Scan
Some of them are just brain dead code, some are potential bugs.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 3a4034d9074..7fe6518134e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -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; |