[Bf-blender-cvs] [c17acf1] master: Code cleanup: quiet warning, 'else' would always crash (& never occurred)

Campbell Barton noreply at git.blender.org
Thu Mar 13 02:07:53 CET 2014


Commit: c17acf1d6e039305ca5549df0dd37e821dcde3d5
Author: Campbell Barton
Date:   Thu Mar 13 11:59:11 2014 +1100
https://developer.blender.org/rBc17acf1d6e039305ca5549df0dd37e821dcde3d5

Code cleanup: quiet warning, 'else' would always crash (& never occurred)

also quiet waning clamping

===================================================================

M	source/blender/editors/interface/interface_utils.c
M	source/blender/editors/space_info/textview.c

===================================================================

diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 261c666..a92226b 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -172,16 +172,14 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr,
 				if (!is_boolean)
 					uiItemL(col, name, ICON_NONE);
 			}
-			else if (label_align == 'H') {
+			else {  /* (label_align == 'H') */
+				BLI_assert(label_align == 'H');
 				split = uiLayoutSplit(layout, 0.5f, false);
 
 				col = uiLayoutColumn(split, false);
 				uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
 				col = uiLayoutColumn(split, false);
 			}
-			else {
-				col = NULL;
-			}
 
 			/* may meed to add more cases here.
 			 * don't override enum flag names */
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index d4d45af..879c99c 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -294,7 +294,9 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous
 	cdc.lofs = -BLF_descender(mono);
 	/* note, scroll bar must be already subtracted () */
 	cdc.console_width = (tvc->winx - (CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth;
-	CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */
+	/* avoid divide by zero on small windows */
+	if (cdc.console_width < 1)
+		cdc.console_width = 1;
 	cdc.winx = tvc->winx - CONSOLE_DRAW_MARGIN;
 	cdc.ymin = tvc->ymin;
 	cdc.ymax = tvc->ymax;




More information about the Bf-blender-cvs mailing list