Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jan 2011 16:47:13 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r216872 - user/nwhitehorn/bsdinstall/partedit
Message-ID:  <201101011647.p01GlD9G015992@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101011647.p01GlD9G015992>