[Parted-commits] GNU Parted Official Repository: Changes to 'stable-1.8.x'

David Cantrell dcantrell-guest at alioth.debian.org
Wed May 2 18:25:50 UTC 2007


 libparted/fs/linux_swap/linux_swap.c |    2 +-
 libparted/labels/dos.c               |    3 +--
 parted/parted.c                      |   14 ++++++++------
 parted/table.c                       |    7 +++++--
 4 files changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 9b04b181d6147af89a1678ebcc5a7c52898f35ed
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Mon Apr 23 16:02:13 2007 -0400

    Fix primary partition cylinder alignment error for DOS disk labels.

diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index 8e7707e..50fadfd 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1696,8 +1696,7 @@ _align_primary (PedPartition* part, const PedCHSGeometry* bios_geom,
 					 _primary_start_constraint (disk, part,
 						 bios_geom, min_geom)));
 
-	if (!solution)
-		solution = _best_solution (part, bios_geom, solution,
+	solution = _best_solution (part, bios_geom, solution,
 			_try_constraint (part, constraint,
 				_primary_constraint (disk, bios_geom,
 				min_geom)));

commit 6aa9317010b0694d2c5b1dc85cec6d8e63659236
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Mon Apr 23 16:00:54 2007 -0400

    Fix off-by-one bug in parted when displaying information about the disk label (the disk size, specifically).

diff --git a/parted/parted.c b/parted/parted.c
index 25fbf5d..598cdcc 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1240,6 +1240,7 @@ partition_print (PedPartition* part)
 static int
 do_print (PedDevice** dev)
 {
+        PedUnit         default_unit;
         PedDisk*        disk;
         Table*          table;
         StrList*        row;
@@ -1326,11 +1327,13 @@ do_print (PedDevice** dev)
         }
 
         start = ped_unit_format (*dev, 0);
+        default_unit = ped_unit_get_default ();
         end = ped_unit_format_byte (*dev, (*dev)->length * (*dev)->sector_size
-                                          - 1 );
-        
+                                    - (default_unit == PED_UNIT_CHS ||
+                                       default_unit == PED_UNIT_CYLINDER));
+
         if (opt_machine_mode) {
-            switch (ped_unit_get_default ()) {
+            switch (default_unit) {
                 case PED_UNIT_CHS:      puts ("CHS;");
                                         break;
                 case PED_UNIT_CYLINDER: puts ("CYL;");

commit 5ba0af2247450bd4c2bca53c3971f043e3563e08
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Mon Apr 23 15:58:03 2007 -0400

    Do not translate partition names in 'parted print' command. This causes problems for non-Latin-based character sets. Also, we don't want to translate the partition name here as we are just showing what is in the disklabel, translating it distorts what the value is.
    
    Also added some malloc checks in table.c.

diff --git a/parted/parted.c b/parted/parted.c
index ff72dcd..25fbf5d 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1443,8 +1443,7 @@ do_print (PedDevice** dev)
 
                     if (!(part->type & PED_PARTITION_FREESPACE)) {
                             if (has_extended) {
-                                name = 
-                                    _(ped_partition_type_get_name (part->type));
+                                name = ped_partition_type_get_name (part->type);
                                 str_list_append (row, name);
                             }
 
@@ -1452,7 +1451,7 @@ do_print (PedDevice** dev)
                                              part->fs_type->name : "");
 
                             if (has_name) {
-                                    name = _(ped_partition_get_name (part));
+                                    name = ped_partition_get_name (part);
                                     str_list_append (row, name);
                             }
 
diff --git a/parted/table.c b/parted/table.c
index 3b89e6d..c44db10 100644
--- a/parted/table.c
+++ b/parted/table.c
@@ -184,14 +184,15 @@ static void table_render_row (Table* t, int rownum, int ncols, wchar_t** s)
 
         assert(t);
         assert(s != NULL);
-        
+
         for (i = 0; i < ncols; ++i)
                 len += t->widths[i] + wcslen(DELIMITER);
 
         len += wcslen(COLSUFFIX);
 
         newsize = (wcslen(*s) + len + 1) * sizeof(wchar_t);
-        *s = realloc (*s, newsize);
+        *s = (wchar_t *) realloc (*s, newsize);
+        assert(*s != NULL);
 
         for (i = 0; i < ncols; ++i)
         {
@@ -199,6 +200,7 @@ static void table_render_row (Table* t, int rownum, int ncols, wchar_t** s)
                 int nspaces = max(t->widths[i] - wcswidth(row[i], MAX_WIDTH),
                                   0);
                 wchar_t* pad = malloc ( (nspaces + 1) * sizeof(wchar_t) );
+                assert(pad != NULL);
 
                 for (j = 0; j < nspaces; ++j)
                        pad[j] = L' '; 
@@ -211,6 +213,7 @@ static void table_render_row (Table* t, int rownum, int ncols, wchar_t** s)
                         wcscat (*s, DELIMITER);
 
                 free (pad);
+                pad = NULL;
         }
 
         wcscat (*s, COLSUFFIX);

commit e31f600fea11ba29f48d125032daea500a63acc2
Author: David Cantrell <dcantrel at mortise.boston.redhat.com>
Date:   Mon Apr 23 15:53:48 2007 -0400

    Remove unused label.

diff --git a/libparted/fs/linux_swap/linux_swap.c b/libparted/fs/linux_swap/linux_swap.c
index a8e95fd..3dd3780 100644
--- a/libparted/fs/linux_swap/linux_swap.c
+++ b/libparted/fs/linux_swap/linux_swap.c
@@ -121,7 +121,7 @@ _generic_swap_probe (PedGeometry* geom, int kind)
 
 error_close_fs:
 	swap_close (fs);
-error:
+
 	return NULL;
 }
 



More information about the Parted-commits mailing list