bug-parted
[Top][All Lists]
Advanced

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

Gcc3.4.1 finds probable bug


From: Andrew Walrond
Subject: Gcc3.4.1 finds probable bug
Date: Thu, 26 Aug 2004 12:40:00 +0100
User-agent: Mutt/1.4.2.1i

As well as the log2 problem already mentioned, compiling with gcc3.4.1
fails with a warning in libparted/disk_dos.c, and finds what I believe
to be a bug. See first part of patch below. The second bit addresses the log2
problem already mentioned.

Hope this is useful

Andrew Walrond 

diff -Naur parted-1.6.12/libparted/disk_dos.c 
parted-1.6.12.apw1/libparted/disk_dos.c
--- parted-1.6.12/libparted/disk_dos.c  2004-08-15 13:28:00.000000000 +0100
+++ parted-1.6.12.apw1/libparted/disk_dos.c     2004-08-26 10:22:01.976213541 
+0100
@@ -484,7 +484,7 @@
        PED_ASSERT (part->disk != NULL, return);
        PED_ASSERT (bios_geom != NULL, return);

-       if (ped_partition_is_active) {
+       if (ped_partition_is_active(part)) {
                if (probe_partition_for_geom (part, bios_geom))
                        return;
                if (part->type & PED_PARTITION_EXTENDED) {
diff -Naur parted-1.6.12/libparted/exception.c 
parted-1.6.12.apw1/libparted/exception.c
--- parted-1.6.12/libparted/exception.c 2002-04-08 11:08:27.000000000 +0100
+++ parted-1.6.12.apw1/libparted/exception.c    2004-08-26 10:10:30.977228158 
+0100
@@ -67,18 +67,13 @@
        return type_strings [ex_type - 1];
 }

-static int
-log2 (int n)
-{
-       int     x;
-       for (x=0; 1 << x <= n; x++);
-       return x - 1;
-}
-
 char*
 ped_exception_get_option_string (PedExceptionOption ex_opt)
 {
-       return option_strings [log2 (ex_opt)];
+       int n = ex_opt;
+       int x;
+       for (x=0; 1 << x <= n; x++);
+       return option_strings [x-1];
 }

 static PedExceptionOption




reply via email to

[Prev in Thread] Current Thread [Next in Thread]