svn commit: r216872 - user/nwhitehorn/bsdinstall/partedit

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Jan 1 16:47:13 UTC 2011


Author: nwhitehorn
Date: Sat Jan  1 16:47:12 2011
New Revision: 216872
URL: http://svn.freebsd.org/changeset/base/216872

Log:
  Fix two display issues. Autocomputed and existing sizes were truncated to
  too few digits, which sometimes led to rounding errors when adding new
  partitions. Also, on systems with 32-bit size_t, the main panel could
  truncate the medium size, producing nonsense for the displayed sizes of
  large devices.

Modified:
  user/nwhitehorn/bsdinstall/partedit/diskeditor.h
  user/nwhitehorn/bsdinstall/partedit/gpart_ops.c

Modified: user/nwhitehorn/bsdinstall/partedit/diskeditor.h
==============================================================================
--- user/nwhitehorn/bsdinstall/partedit/diskeditor.h	Sat Jan  1 15:25:15 2011	(r216871)
+++ user/nwhitehorn/bsdinstall/partedit/diskeditor.h	Sat Jan  1 16:47:12 2011	(r216872)
@@ -1,7 +1,9 @@
+#include <inttypes.h>
+
 struct partedit_item {
 	int indentation;
 	const char *name;
-	size_t size;
+	intmax_t size;
 	const char *type;
 	char *mountpoint;
 

Modified: user/nwhitehorn/bsdinstall/partedit/gpart_ops.c
==============================================================================
--- user/nwhitehorn/bsdinstall/partedit/gpart_ops.c	Sat Jan  1 15:25:15 2011	(r216871)
+++ user/nwhitehorn/bsdinstall/partedit/gpart_ops.c	Sat Jan  1 16:47:12 2011	(r216872)
@@ -353,7 +353,7 @@ gpart_edit(struct gprovider *pp)
 		}
 	}
 
-	humanize_number(sizestr, 6, pp->lg_mediasize, "B", HN_AUTOSCALE,
+	humanize_number(sizestr, 7, pp->lg_mediasize, "B", HN_AUTOSCALE,
 	    HN_NOSPACE | HN_DECIMAL);
 	items[1].text = sizestr;
 
@@ -566,7 +566,7 @@ gpart_create(struct gprovider *pp)
 	if (size*sector >= 1024*1024)
 		size -= 1024*1024/sector;
 
-	humanize_number(sizestr, 6, size*sector, "B", HN_AUTOSCALE,
+	humanize_number(sizestr, 7, size*sector, "B", HN_AUTOSCALE,
 	    HN_NOSPACE | HN_DECIMAL);
 	items[1].text = sizestr;
 


More information about the svn-src-user mailing list