[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37793] branches/soc-2011-onion/source/ blender/editors/space_file/filesel.c: warning fix, int to float conversion

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Jun 24 16:20:09 CEST 2011


Revision: 37793
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37793
Author:   jwilkins
Date:     2011-06-24 14:20:09 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
warning fix, int to float conversion

one addend was float so even though everything else was an int, or cast to int, all of it got promoted to float, then cast back to int on assignment, which caused the warning.  this does change the behavior slightly, before all the fractional parts were truncated before adding, now they are all added before truncation.  this may make the maximum length a little wider if the fractional parts sum greater than 1.

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/space_file/filesel.c

Modified: branches/soc-2011-onion/source/blender/editors/space_file/filesel.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_file/filesel.c	2011-06-24 14:00:15 UTC (rev 37792)
+++ branches/soc-2011-onion/source/blender/editors/space_file/filesel.c	2011-06-24 14:20:09 UTC (rev 37793)
@@ -511,21 +511,21 @@
 		column_widths(sfile->files, layout);
 
 		if (params->display == FILE_SHORTDISPLAY) {
-			maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
-					 (int)layout->column_widths[COLUMN_NAME] + 12 +
-					 (int)layout->column_widths[COLUMN_SIZE] + 12;
+			maxlen = (int)(ICON_DEFAULT_WIDTH_SCALE + 4 +
+					 layout->column_widths[COLUMN_NAME] + 12 +
+					 layout->column_widths[COLUMN_SIZE] + 12);
 		} else {
-			maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
-					 (int)layout->column_widths[COLUMN_NAME] + 12 +
+			maxlen = (int)(ICON_DEFAULT_WIDTH_SCALE + 4 +
+					 layout->column_widths[COLUMN_NAME] + 12 +
 #ifndef WIN32
-					 (int)layout->column_widths[COLUMN_MODE1] + 12 +
-					 (int)layout->column_widths[COLUMN_MODE2] + 12 +
-					 (int)layout->column_widths[COLUMN_MODE3] + 12 +
-					 (int)layout->column_widths[COLUMN_OWNER] + 12 +
+					 layout->column_widths[COLUMN_MODE1] + 12 +
+					 layout->column_widths[COLUMN_MODE2] + 12 +
+					 layout->column_widths[COLUMN_MODE3] + 12 +
+					 layout->column_widths[COLUMN_OWNER] + 12 +
 #endif
-					 (int)layout->column_widths[COLUMN_DATE] + 12 +
-					 (int)layout->column_widths[COLUMN_TIME] + 12 +
-					 (int)layout->column_widths[COLUMN_SIZE] + 12;
+					 layout->column_widths[COLUMN_DATE] + 12 +
+					 layout->column_widths[COLUMN_TIME] + 12 +
+					 layout->column_widths[COLUMN_SIZE] + 12);
 
 		}
 		layout->tile_w = maxlen;




More information about the Bf-blender-cvs mailing list