gparted r828 - in trunk: . src



Author: gedakc
Date: Mon Apr 21 17:08:43 2008
New Revision: 828
URL: http://svn.gnome.org/viewvc/gparted?rev=828&view=rev

Log:
Corrected math in partition creation/resize dialogs that prevented operations on partition sizes >= 1 TB

Modified:
   trunk/ChangeLog
   trunk/src/Dialog_Base_Partition.cc
   trunk/src/Dialog_Partition_New.cc

Modified: trunk/src/Dialog_Base_Partition.cc
==============================================================================
--- trunk/src/Dialog_Base_Partition.cc	(original)
+++ trunk/src/Dialog_Base_Partition.cc	Mon Apr 21 17:08:43 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Bart
+/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -117,13 +117,15 @@
 }
 
 Partition Dialog_Base_Partition::Get_New_Partition() 
-{ 	
+{
+	//FIXME:  Partition size is limited is just less than 1024 TeraBytes due
+	//        to the maximum value of signed 4 byte integer.
 	if ( ORIG_BEFORE != spinbutton_before .get_value_as_int() )
-		selected_partition .sector_start = START + spinbutton_before .get_value_as_int() * MEBIBYTE ;	
+		selected_partition .sector_start = START + Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE ;	
 	
 	if ( ORIG_AFTER != spinbutton_after .get_value_as_int() )
 		selected_partition .sector_end = 
-			selected_partition .sector_start + spinbutton_size .get_value_as_int() * MEBIBYTE ;
+			selected_partition .sector_start + Sector(spinbutton_size .get_value_as_int()) * MEBIBYTE ;
 
 	//due to loss of precision during calcs from Sector -> MiB and back, it is possible
 	//the new partition thinks it's bigger then it can be. Here we solve this.

Modified: trunk/src/Dialog_Partition_New.cc
==============================================================================
--- trunk/src/Dialog_Partition_New.cc	(original)
+++ trunk/src/Dialog_Partition_New.cc	Mon Apr 21 17:08:43 2008
@@ -156,9 +156,11 @@
 
 		default	:	part_type = GParted::TYPE_UNALLOCATED ;
 	}
-	
-	new_start = START + (spinbutton_before .get_value_as_int() * MEBIBYTE) ;
-	new_end  = new_start + (spinbutton_size .get_value_as_int() * MEBIBYTE) ;
+
+	//FIXME:  Partition size is limited is just less than 1024 TeraBytes due
+	//        to the maximum value of signed 4 byte integer.
+	new_start = START + (Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE) ;
+	new_end  = new_start + (Sector(spinbutton_size .get_value_as_int()) * MEBIBYTE) ;
 	
 	/* due to loss of precision during calcs from Sector -> MiB and back, it is possible the new 
 	 * partition thinks it's bigger then it can be. Here we try to solve this.*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]