OSDN Git Service

Avoid compiler warnings with gcc -Wall -Wshadow.
authorJim Meyering <jim@meyering.net>
Fri, 16 Feb 2007 14:55:40 +0000 (15:55 +0100)
committerOtavio Salvador <otavio@ossystems.com.br>
Fri, 16 Feb 2007 16:22:39 +0000 (14:22 -0200)
* libparted/arch/linux.c (init_ide): Add missing "break" at end of
final case: stmt.
Add "default:" in the same switch to avoid a compiler warning.
* libparted/fs/fat/bootsector.c (fat_boot_sector_analyse): Likewise.
* libparted/fs/fat/resize.c (ask_type): Likewise.
* libparted/fs/fat/traverse.c (fat_dir_entry_set_first_cluster):
Likewise.
* debug/clearfat/clearfat.c (_calc_fat_entry_offset): Likewise.

* parted/parted.c (_timer_handler): Cast time_t values to "int"
to agree with %d printf format.
(g_timer): Rename file-scoped global from shadowed "timer".
Update all uses of the global.
(version_msg): Remove decl of unused global.

* parted/ui.c (current_exception_opt): Remove decl of unused global.

* libparted/filesys.c (ped_file_system_close): Remove unused label.
* libparted/unit.c (parse_chs): Likewise.

* libparted/debug.c (ped_assert): Use "int" as type of backtrace
return value, not size_t.

* libparted/fs/reiserfs/reiserfs.c (reiserfs_check):
Guard declaration of local with #ifdef HAVE_REISERFS_FS_CHECK,
since it's used only in a similarly-guarded block.
(reiserfs_fs_check): Likewise for this file-scoped global.

Avoid warnings about unused file-scoped global variables.
* libparted/fs/hfs/hfs.h (hfs_type, hfsplus_type): Remove these
declarations of file-scoped static variables.
* libparted/fs/hfs/hfs.c: Put them here, instead.

* libparted/fs/fat/table.c (_test_code_active): Remove unused function.

* libparted/arch/linux.c: Add casts to avoid performing
pointer arithmetic on "void *" pointers.

* libparted/fs/hfs/file_plus.c (hfsplus_file_read):
Don't do pointer arithmetic on a "void *" pointer.
(hfsplus_file_write): Likewise.

* libparted/fs/fat/count.c (flag_traverse_dir): Move decl of
unused local into #if-0'd block where it is referenced.
(print_chain): Guard definition with #ifdef PED_VERBOSE,
since the sole use of this function is guarded the same way.

* libparted/fs/amiga/amiga.c: (_amiga_valid_block_id):
Remove unused function.
(_amiga_get_bstr): Likewise.
(_amiga_set_bstr): Likewise.

Remove unused labels and/or declarations of unused variables.
* parted/ui.c (_readline): Likewise.
* libparted/cs/constraint.c (_constraint_get_canonical_start_range):
Likewise.
* libparted/cs/geom.c (ped_geometry_read): Likewise.
* libparted/fs/amiga/apfs.c (_generic_apfs_probe): Likewise.
* libparted/fs/ext2/ext2_mkfs.c (ext2_mkfs_write_meta): Likewise.
* libparted/disk.c: Likewise.
* libparted/fs/hfs/hfs.c: Likewise.
* libparted/fs/fat/fat.c: Likewise.
* libparted/fs/fat/clstdup.c: Likewise.
* libparted/fs/fat/calc.c: Likewise.
* libparted/fs/ext2/ext2.c: Likewise.
* libparted/fs/amiga/affs.c: Likewise.
* libparted/fs/amiga/asfs.c: Likewise.
* libparted/labels/aix.c: Likewise.
* libparted/labels/sun.c: Likewise.
* libparted/labels/pc98.c: Likewise.
* libparted/labels/mac.c: Likewise.
* libparted/labels/dos.c: Likewise.
* libparted/labels/loop.c (loop_alloc): Likewise.
* libparted/labels/gpt.c: Likewise.
* libparted/labels/dvh.c (dvh_alloc): Likewise.
(dvh_read) [!DISCOVER_ONLY]: Add "default:" in a switch.

* libparted/labels/fdasd.c (fdasd_reread_partition_table):
Remove decl of unused local(s).
(fdasd_get_partition_data): Likewise.
(fdasd_partition_type): Remove unused function.
(fdasd_write_vtoc_labels): Likewise.
(fdasd_change_volser): Likewise.
(fdasd_check_volser): Likewise.
(fdasd_reread_partition_table): Likewise.

Signed-off-by: Jim Meyering <jim@meyering.net>
37 files changed:
debug/clearfat/clearfat.c
libparted/arch/linux.c
libparted/cs/constraint.c
libparted/cs/geom.c
libparted/debug.c
libparted/disk.c
libparted/filesys.c
libparted/fs/amiga/affs.c
libparted/fs/amiga/amiga.c
libparted/fs/amiga/apfs.c
libparted/fs/amiga/asfs.c
libparted/fs/ext2/ext2.c
libparted/fs/ext2/ext2_mkfs.c
libparted/fs/fat/bootsector.c
libparted/fs/fat/calc.c
libparted/fs/fat/clstdup.c
libparted/fs/fat/count.c
libparted/fs/fat/fat.c
libparted/fs/fat/resize.c
libparted/fs/fat/table.c
libparted/fs/fat/traverse.c
libparted/fs/hfs/file_plus.c
libparted/fs/hfs/hfs.c
libparted/fs/hfs/hfs.h
libparted/fs/reiserfs/reiserfs.c
libparted/labels/aix.c
libparted/labels/dos.c
libparted/labels/dvh.c
libparted/labels/fdasd.c
libparted/labels/gpt.c
libparted/labels/loop.c
libparted/labels/mac.c
libparted/labels/pc98.c
libparted/labels/sun.c
libparted/unit.c
parted/parted.c
parted/ui.c

index 6cda308..896747d 100644 (file)
@@ -1,6 +1,6 @@
 /*
     clear_fat - a tool to clear unused space (for testing purposes)
-    Copyright (C) 2000 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2007 Free Software Foundation, Inc.
 
     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
@@ -130,6 +130,10 @@ _calc_fat_entry_offset (PedFileSystem* fs, FatCluster cluster)
        FatSpecific*    fs_info = FAT_SPECIFIC (fs);
 
        switch (fs_info->fat_type) {
+                case FAT_TYPE_FAT12:
+                        PED_ASSERT (0, (void) 0);
+                        break;
+
                case FAT_TYPE_FAT16:
                        return cluster * 2;
 
index 568ada3..477ce2a 100644 (file)
@@ -424,7 +424,6 @@ _device_probe_type (PedDevice* dev)
         struct stat             dev_stat;
         int                     dev_major;
         int                     dev_minor;
-        PedExceptionOption      ex_status;
 
         if (!_device_stat (dev, &dev_stat))
                 return 0;
@@ -680,6 +679,10 @@ init_ide (PedDevice* dev)
                                 ped_exception_catch ();
                         case PED_EXCEPTION_IGNORE:
                                 dev->model = strdup(_("Generic IDE"));
+                                break;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
         } else {
                 /* hdi.model is not guaranteed to be NULL terminated */
@@ -712,7 +715,10 @@ init_ide (PedDevice* dev)
                                 case PED_EXCEPTION_UNHANDLED:
                                         ped_exception_catch ();
                                 case PED_EXCEPTION_IGNORE:
-                                        ;
+                                        break;
+                                default:
+                                        PED_ASSERT (0, (void) 0);
+                                        break;
                         }
                 }
                 
@@ -950,10 +956,7 @@ static int
 init_dasd (PedDevice* dev, char* model_name)
 {
         struct stat             dev_stat;
-        PedExceptionOption      ex_status;
-        dasd_information_t      dasd_info;
         struct hd_geometry      geo;
-        int f, blksize = 0;
         char *errstr = 0;
 
         if (!_device_stat (dev, &dev_stat))
@@ -995,7 +998,6 @@ init_dasd (PedDevice* dev, char* model_name)
         ped_device_close (dev);
         return 1;
 
-except:
         ped_exception_throw ( PED_EXCEPTION_ERROR,
                               PED_EXCEPTION_IGNORE_CANCEL,
                               errstr );
@@ -1040,7 +1042,10 @@ init_generic (PedDevice* dev, char* model_name)
                         case PED_EXCEPTION_UNHANDLED:
                                 ped_exception_catch ();
                         case PED_EXCEPTION_IGNORE:
-                                ; // just workaround for gcc 3.0
+                                break;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
 
                 /* what should we stick in here? */
@@ -1417,7 +1422,7 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                     && start + count - 1 == dev->length - 1)
                         return ped_device_read (dev, buffer, start, count - 1)
                                 && _read_lastoddsector (
-                                        dev, buffer + (count-1) * 512);
+                                        dev, (char *) buffer + (count-1) * 512);
         }
         while (1) {
                 if (_device_seek (dev, start))
@@ -1440,6 +1445,9 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                                 ped_exception_catch ();
                         case PED_EXCEPTION_CANCEL:
                                 return 0;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
         }
 
@@ -1455,7 +1463,7 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                 if (status == count * dev->sector_size) break;
                 if (status > 0) {
                         read_length -= status;
-                        buffer += status;
+                        buffer = (char *) buffer + status;
                         continue;
                 }
 
@@ -1479,6 +1487,9 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                         case PED_EXCEPTION_CANCEL:
                                 free(diobuf);
                                 return 0;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
         }
         free(diobuf);
@@ -1552,7 +1563,7 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
                     && start + count - 1 == dev->length - 1)
                         return ped_device_write (dev, buffer, start, count - 1)
                                 && _write_lastoddsector (
-                                        dev, buffer + (count-1) * 512);
+                                        dev, (char*) buffer + (count-1) * 512);
         }
         while (1) {
                 if (_device_seek (dev, start))
@@ -1574,6 +1585,9 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
                                 ped_exception_catch ();
                         case PED_EXCEPTION_CANCEL:
                                 return 0;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
         }
 
@@ -1592,7 +1606,7 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
                 if (status == count * dev->sector_size) break;
                 if (status > 0) {
                         write_length -= status;
-                        diobuf += status;
+                        diobuf = (char *) diobuf + status;
                         continue;
                 }
 
@@ -1615,6 +1629,9 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
                         case PED_EXCEPTION_CANCEL:
                                 free(diobuf_start);
                                 return 0;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
         }
         free(diobuf_start);
@@ -1682,6 +1699,9 @@ _do_fsync (PedDevice* dev)
                                 ped_exception_catch ();
                         case PED_EXCEPTION_CANCEL:
                                 return 0;
+                        default:
+                                PED_ASSERT (0, (void) 0);
+                                break;
                 }
         } 
         return 1;
index 7fa7f24..b21e9af 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
@@ -296,7 +296,6 @@ _constraint_get_canonical_start_range (const PedConstraint* constraint)
        PedSector       min_start;
        PedSector       max_start;
        PedGeometry     start_min_max_range;
-       PedGeometry*    result;
 
        if (constraint->min_size > constraint->max_size)
                return NULL;
index 4d2f5e7..95a5dcf 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -288,7 +288,6 @@ int
 ped_geometry_read (const PedGeometry* geom, void* buffer, PedSector start,
                   PedSector count)
 {
-       int             exception_status;
        PedSector       real_start;
 
        PED_ASSERT (geom != NULL, return 0);
index 87d891e..a7d73f9 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2005 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -94,10 +94,8 @@ int ped_assert ( int cond, const char* cond_text,
 #if HAVE_BACKTRACE
        /* Print backtrace stack */
        void *stack[20];
-       size_t size;
        char **strings, **string;
-       
-       size = backtrace(stack, 20);
+        int size = backtrace(stack, 20);
        strings = backtrace_symbols(stack, size);
 
        if (strings) {
index de2c3d2..935a0fc 100644 (file)
@@ -1,6 +1,6 @@
  /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005
+    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2007
                   Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
@@ -391,7 +391,6 @@ _ped_disk_alloc (const PedDevice* dev, const PedDiskType* disk_type)
        disk->part_list = NULL;
        return disk;
 
-error_free_disk:
        ped_free (disk);
 error:
        return NULL;
@@ -1218,7 +1217,6 @@ ped_partition_is_flag_available (const PedPartition* part,
 int
 ped_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
 {
-       PedFileSystem*          fs;
        const PedDiskType*      disk_type;
 
        PED_ASSERT (part != NULL, return 0);
@@ -1965,7 +1963,6 @@ ped_disk_set_partition_geom (PedDisk* disk, PedPartition* part,
 
 error_pop_update_mode:
        _disk_pop_update_mode (disk);
-error:
        ped_constraint_destroy (overlap_constraint);
        ped_constraint_destroy (constraints);
        part->geom = old_geom;
index 0cc64ac..fa5f98f 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
@@ -483,7 +483,6 @@ ped_file_system_close (PedFileSystem* fs)
 
 error_close_dev:
        ped_device_close (dev);
-error:
        return 0;
 }
 
index d33982d..3fb7928 100644 (file)
@@ -1,6 +1,6 @@
 /*
     affs.c -- parted support for affs file systems
-    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+    Copyright (C) 1998-2000, 2007 Free Software Foundation, Inc.
   
     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
@@ -50,7 +50,6 @@ static PedGeometry*
 _generic_affs_probe (PedGeometry* geom, uint32_t kind)
 {
        uint32_t *block;
-       int32_t i;
        PedSector root, len, pos;
        struct PartitionBlock * part;
        int blocksize = 1, reserved = 2, prealloc = 0;
index 0c8315c..8d06c88 100644 (file)
@@ -1,6 +1,6 @@
 /* 
     libparted/fs_amiga - amiga file system support.
-    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
 #  define _(String) (String)
 #endif /* ENABLE_NLS */
 
-/* String manipulation */
-static void _amiga_set_bstr (const char *cstr, char *bstr, int maxsize) {
-       int size = strlen (cstr);
-       int i;
-
-       if (size >= maxsize) return;
-       bstr[0] = size;
-       for (i = 0; i<size; i++) bstr[i+1] = cstr[i];
-}
-static const char * _amiga_get_bstr (char * bstr) {
-       char * cstr = bstr + 1;
-       int size = bstr[0];
-       
-       cstr[size] = '\0';
-       return cstr;
-}
-
 #define        IDNAME_RIGIDDISK        (uint32_t)0x5244534B    /* 'RDSK' */
 #define IDNAME_BADBLOCK                (uint32_t)0x42414442    /* 'BADB' */
 #define        IDNAME_PARTITION        (uint32_t)0x50415254    /* 'PART' */
@@ -78,21 +61,6 @@ _amiga_block_id (uint32_t id) {
                        return "<unknown>";
        }
 }
-static int
-_amiga_valid_block_id (uint32_t id) {
-       switch (id) {
-               case IDNAME_RIGIDDISK :
-               case IDNAME_BADBLOCK :
-               case IDNAME_PARTITION :
-               case IDNAME_FILESYSHEADER :
-               case IDNAME_LOADSEG :
-               case IDNAME_BOOT :
-                       return 1;
-               case IDNAME_FREE :
-               default :
-                       return 0;
-       }
-}
 
 struct AmigaIds *
 _amiga_add_id (uint32_t id, struct AmigaIds *ids) {
index 0f48ccf..64128fd 100644 (file)
@@ -1,6 +1,6 @@
 /*
     apfs.c -- parted support for apfs file systems
-    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+    Copyright (C) 1998-2000, 2007 Free Software Foundation, Inc.
   
     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
@@ -43,7 +43,6 @@ static PedGeometry*
 _generic_apfs_probe (PedGeometry* geom, uint32_t kind)
 {
        uint32_t *block;
-       int32_t i, sum;
        PedSector root;
        struct PartitionBlock * part;
        uint32_t blocksize = 1, reserved = 2, prealloc = 0;
index 262d9c6..d50c359 100644 (file)
@@ -1,6 +1,6 @@
 /*
     asfs.c -- parted asfs filesystem support
-    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+    Copyright (C) 1998-2000, 2007 Free Software Foundation, Inc.
   
     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
@@ -58,8 +58,8 @@ _asfs_probe (PedGeometry* geom)
        uint32_t *block;
        struct PartitionBlock * part;
        int blocksize = 1, reserved = 1, prealloc = 1;
-       PedSector root, root2;
-       int found = 0;
+        PedSector root;
+        int found = 0;
 
        PED_ASSERT (geom != NULL, return NULL);
        PED_ASSERT (geom->dev != NULL, return NULL);
index c7e6592..75ec9cb 100644 (file)
@@ -1,6 +1,6 @@
 /*
     ext2.c -- generic ext2 stuff
-    Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
   
     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
@@ -781,7 +781,6 @@ struct ext2_fs *ext2_open(struct ext2_dev_handle *handle, int state)
        fs->metadirty = 0;
        return fs;
 
-error_free_gd:
        ped_free(fs->gd);
 error_deinit_bcache:
        ext2_bcache_deinit(fs);
index a37e63c..213e3b7 100644 (file)
@@ -1,6 +1,6 @@
 /*
     ext2_mkfs.c -- ext2 fs creator
-    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
   
     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
@@ -255,7 +255,6 @@ static int ext2_mkfs_write_meta(struct ext2_dev_handle *handle,
 
 error_free_zero:
        ped_free(zero);
-error_free_ib:
        ped_free(ib);
 error_free_bb:
        ped_free(bb);
index 10426cd..53ff50b 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
 
     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
@@ -126,7 +126,6 @@ int
 fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs)
 {
        FatSpecific*            fs_info = FAT_SPECIFIC (fs);
-       PedExceptionOption      ex_status;
        int                     fat_entry_size;
 
        PED_ASSERT (bs != NULL, return 0);
@@ -186,6 +185,9 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs)
 
                case PED_EXCEPTION_IGNORE:
                        break;
+
+                default:
+                        break;
                }
        }
 
index d09959f..615ce0b 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
 
     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
@@ -290,8 +290,6 @@ fat_calc_resize_sizes (
        FatCluster* out_cluster_count,
        PedSector* out_fat_size)
 {
-       PedSector       min_cluster_sectors;
-
        PED_ASSERT (geom != NULL, return 0);
        PED_ASSERT (out_cluster_sectors != NULL, return 0);
        PED_ASSERT (out_cluster_count != NULL, return 0);
index b9b0534..a964a57 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
@@ -396,7 +396,6 @@ count_frags_to_dup (FatOpContext* ctx)
 int
 fat_duplicate_clusters (FatOpContext* ctx, PedTimer* timer)
 {
-       FatSpecific*    old_fs_info = FAT_SPECIFIC (ctx->old_fs);
        FatFragment     total_frags_to_dup;
 
        init_remap (ctx);
index 747f3ef..dba0edb 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
 
     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
@@ -98,6 +98,7 @@ is_movable_system_file (char* file_name)
     prints out the sequence of clusters for a given file chain, beginning
     at start_cluster.
 */
+#ifdef PED_VERBOSE
 static void
 print_chain (PedFileSystem* fs, FatCluster start)
 {
@@ -116,6 +117,7 @@ print_chain (PedFileSystem* fs, FatCluster start)
        }
        printf ("\n");
 }
+#endif /* PED_VERBOSE */
 
 static PedSector
 remainder_round_up (PedSector a, PedSector b)
@@ -229,7 +231,6 @@ flag_traverse_dir (FatTraverseInfo* trav_info) {
        char*                   file_name_start;
        FatCluster              first_cluster;
        PedSector               size;
-       PedExceptionOption      ex_status;
 
        PED_ASSERT (trav_info != NULL, return 0);
 
@@ -257,6 +258,7 @@ flag_traverse_dir (FatTraverseInfo* trav_info) {
 #if 0
                if (fat_dir_entry_is_system_file (this_entry)
                    && !is_movable_system_file (file_name)) {
+                        PedExceptionOption ex_status;
                        ex_status = ped_exception_throw (
                                PED_EXCEPTION_WARNING,
                                PED_EXCEPTION_IGNORE_CANCEL,
@@ -303,7 +305,6 @@ _mark_bad_clusters (PedFileSystem* fs)
 {
        FatSpecific*    fs_info = FAT_SPECIFIC (fs);
        FatCluster      cluster;
-       FatFragment     frag;
 
        for (cluster = 2; cluster < fs_info->cluster_count + 2; cluster++) {
                if (fat_table_is_bad (fs_info->fat, cluster))
index ee06f1a..b5d6d96 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
@@ -190,7 +190,6 @@ static int
 _init_fats (PedFileSystem* fs)
 {
        FatSpecific*    fs_info = FAT_SPECIFIC (fs);
-       int             i;
        FatCluster      table_size;
 
        table_size = fs_info->fat_sectors * 512
index 681aa48..0facf3f 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
 
     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
@@ -342,6 +342,10 @@ fat_construct_dir_tree (FatOpContext* ctx)
 
        if (new_fs_info->fat_type == old_fs_info->fat_type) {
                switch (old_fs_info->fat_type) {
+                        case FAT_TYPE_FAT12:
+                        PED_ASSERT (0, (void) 0);
+                        break;
+
                        case FAT_TYPE_FAT16:
                        return fat_construct_legacy_root (ctx);
 
@@ -530,6 +534,10 @@ ask_type (PedFileSystem* fs, int fat16_ok, int fat32_ok, FatType* out_fat_type)
 
                case PED_EXCEPTION_CANCEL:
                        return 0;
+
+                default:
+                        PED_ASSERT (0, (void) 0);
+                        break;
                }
        }
 
@@ -583,7 +591,6 @@ get_fat_type (PedFileSystem* fs, const PedGeometry* new_geom,
              FatType* out_fat_type)
 {
        FatSpecific*            fs_info = FAT_SPECIFIC (fs);
-       PedExceptionOption      status;
        PedSector               fat16_cluster_sectors;
        PedSector               fat32_cluster_sectors;
        FatCluster              dummy_cluster_count;
index 6f4e809..d67e42c 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
 
     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
@@ -207,6 +207,10 @@ static int
 _test_code_bad (const FatTable* ft, FatCluster code)
 {
        switch (ft->fat_type) {
+                case FAT_TYPE_FAT12:
+                if (code == 0xff7) return 1;
+                break;
+
                case FAT_TYPE_FAT16:
                if (code == 0xfff7) return 1;
                break;
@@ -219,15 +223,13 @@ _test_code_bad (const FatTable* ft, FatCluster code)
 }
 
 static int
-_test_code_active (const FatTable* ft, FatCluster code)
-{
-       return code && !_test_code_bad (ft, code);
-}
-
-static int
 _test_code_eof (const FatTable* ft, FatCluster code)
 {
        switch (ft->fat_type) {
+                case FAT_TYPE_FAT12:
+                if (code >= 0xff7) return 1;
+                break;
+
                case FAT_TYPE_FAT16:
                if (code >= 0xfff7) return 1;
                break;
@@ -272,6 +274,10 @@ fat_table_set (FatTable* ft, FatCluster cluster, FatCluster value)
        _update_stats (ft, cluster, value);
 
        switch (ft->fat_type) {
+                case FAT_TYPE_FAT12:
+                PED_ASSERT (0, (void) 0);
+                break;
+
                case FAT_TYPE_FAT16:
                ((unsigned short *) ft->table) [cluster]
                        = PED_CPU_TO_LE16 (value);
@@ -298,6 +304,10 @@ fat_table_get (const FatTable* ft, FatCluster cluster)
        }
 
        switch (ft->fat_type) {
+                case FAT_TYPE_FAT12:
+                PED_ASSERT (0, (void) 0);
+                break;
+
                case FAT_TYPE_FAT16:
                return PED_LE16_TO_CPU
                        (((unsigned short *) ft->table) [cluster]);
@@ -404,6 +414,10 @@ fat_table_set_eof (FatTable* ft, FatCluster cluster)
 {
 
        switch (ft->fat_type) {
+                case FAT_TYPE_FAT12:
+                PED_ASSERT (0, (void) 0);
+                break;
+
                case FAT_TYPE_FAT16:
                return fat_table_set (ft, cluster, 0xfff8);
         
@@ -424,6 +438,9 @@ fat_table_set_bad (FatTable* ft, FatCluster cluster)
                ft->bad_cluster_count++;
 
        switch (ft->fat_type) {
+                case FAT_TYPE_FAT12:
+               return fat_table_set (ft, cluster, 0xff7);
+
                case FAT_TYPE_FAT16:
                return fat_table_set (ft, cluster, 0xfff7);
         
index 8c3e530..aadb83d 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2005 Free Software Foundation, Inc.
+    Copyright (C) 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -259,6 +259,10 @@ fat_dir_entry_set_first_cluster (FatDirEntry* dir_entry, PedFileSystem* fs,
        FatSpecific*            fs_info = FAT_SPECIFIC (fs);
 
        switch (fs_info->fat_type) {
+                case FAT_TYPE_FAT12:
+                PED_ASSERT (0, (void) 0);
+                break;
+
                case FAT_TYPE_FAT16:
                dir_entry->first_cluster = PED_CPU_TO_LE16 (cluster);
                break;
index c208f59..f884778 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+    Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -192,6 +192,7 @@ hfsplus_file_read(HfsPPrivateFile* file, void *buf, PedSector sector,
        HfsPPrivateExtent phy_area;
        HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*)
                                        file->fs->type_specific;
+        char *b = buf;
 
        if (sector+nb < sector /* detect overflow */
            || sector+nb > file->sect_nb) /* out of file */ {
@@ -214,14 +215,14 @@ hfsplus_file_read(HfsPPrivateFile* file, void *buf, PedSector sector,
                                sector, PED_BE32_TO_CPU(file->CNID));
                        return 0;
                }
-               if (!ped_geometry_read(priv_data->plus_geom, buf,
+                if (!ped_geometry_read(priv_data->plus_geom, b,
                                       phy_area.start_sector,
                                       phy_area.sector_count))
                        return 0;
 
                nb -= phy_area.sector_count; /* < nb anyway ... */
                sector += phy_area.sector_count;
-               buf += phy_area.sector_count * PED_SECTOR_SIZE_DEFAULT;
+                b += phy_area.sector_count * PED_SECTOR_SIZE_DEFAULT;
        }
 
        return 1;
@@ -234,6 +235,7 @@ hfsplus_file_write(HfsPPrivateFile* file, void *buf, PedSector sector,
        HfsPPrivateExtent phy_area;
        HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*)
                                        file->fs->type_specific;
+        char *b = buf;
 
        if (sector+nb < sector /* detect overflow */
            || sector+nb > file->sect_nb) /* out of file */ {
@@ -256,14 +258,14 @@ hfsplus_file_write(HfsPPrivateFile* file, void *buf, PedSector sector,
                                sector, PED_BE32_TO_CPU(file->CNID));
                        return 0;
                }
-               if (!ped_geometry_write(priv_data->plus_geom, buf,
+                if (!ped_geometry_write(priv_data->plus_geom, b,
                                       phy_area.start_sector,
                                       phy_area.sector_count))
                        return 0;
 
                nb -= phy_area.sector_count; /* < nb anyway ... */
                sector += phy_area.sector_count;
-               buf += phy_area.sector_count * PED_SECTOR_SIZE_DEFAULT;
+                b += phy_area.sector_count * PED_SECTOR_SIZE_DEFAULT;
        }
 
        return 1;
index 908566d..324abba 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -53,6 +53,9 @@ unsigned hfsp_block_count;
 #include "reloc.h"
 #include "advfs.h"
 
+static PedFileSystemType hfs_type;
+static PedFileSystemType hfsplus_type;
+
 
 /* ----- HFS ----- */
 
@@ -569,8 +572,6 @@ hpo:        return NULL;
 static PedConstraint* 
 hfsplus_get_resize_constraint (const PedFileSystem *fs)
 {
-       HfsPPrivateFSData*      priv_data = (HfsPPrivateFSData*)
-                                               fs->type_specific;
        PedDevice*      dev = fs->geom->dev;
        PedAlignment    start_align;
        PedGeometry     start_sector;
@@ -771,7 +772,7 @@ hfsplus_wrapper_update (PedFileSystem* fs)
        HfsNodeDescriptor*      node_desc = (HfsNodeDescriptor*) node;
        HfsExtentKey*           ret_key;
        HfsExtDescriptor*       ret_data;
-       unsigned int            i, j;
+       unsigned int            i;
        HfsPPrivateFSData*      priv_data = (HfsPPrivateFSData*)
                                                fs->type_specific;
        HfsPrivateFSData*       hfs_priv_data = (HfsPrivateFSData*)
index 490c8f2..1fe6393 100644 (file)
 
 #endif /* HFS_EXTRACT_FS */
 
-static PedFileSystemType hfs_type;
-static PedFileSystemType hfsplus_type;
-
 
 
 /* ----------------------------------- */
index 82ea203..62001ba 100644 (file)
@@ -1,6 +1,6 @@
 /*
     reiserfs.c -- libparted / libreiserfs glue
-    Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+    Copyright (C) 2001, 2002, 2007  Free Software Foundation, Inc.
 
     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
@@ -101,7 +101,9 @@ FCLASS reiserfs_fs_t* (FPTR reiserfs_fs_create) (dal_t *, dal_t *,
                                          reiserfs_gauge_t *);
 
 FCLASS int (FPTR reiserfs_fs_resize) (reiserfs_fs_t *, blk_t, reiserfs_gauge_t *);
+#ifdef HAVE_REISERFS_FS_CHECK
 FCLASS int (FPTR reiserfs_fs_check) (reiserfs_fs_t *, reiserfs_gauge_t *);
+#endif
 
 FCLASS reiserfs_fs_t *(FPTR reiserfs_fs_copy) (reiserfs_fs_t *, dal_t *,
                                        reiserfs_gauge_t *);
@@ -349,7 +351,6 @@ error_free_dal:
        geom_dal_free(dal);
 error_fs_geom_free:
        ped_geometry_destroy(fs_geom);
-error:
        return NULL;
 }
 
@@ -387,7 +388,9 @@ static PedConstraint *reiserfs_get_create_constraint(const PedDevice *dev)
 static int reiserfs_check(PedFileSystem *fs, PedTimer *timer)
 {
        reiserfs_fs_t *fs_info;
+#ifdef HAVE_REISERFS_FS_CHECK
        reiserfs_gauge_t *gauge = NULL;
+#endif
 
        PED_ASSERT(fs != NULL, return 0);
 
@@ -531,7 +534,6 @@ static int reiserfs_resize(PedFileSystem *fs, PedGeometry *geom,
 error_free_gauge:
        if (gauge)
                libreiserfs_gauge_free(gauge);
-error:
        ped_geometry_set_end (fs->geom, fs->geom->start + old_length - 1);
        return 0;
 }
@@ -642,7 +644,6 @@ error_free_dal:
        geom_dal_free(dal);
 error_free_fs_geom:
        ped_geometry_destroy(fs_geom);
-error:
        return NULL;
 }
 
index 8dcd721..0259a10 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
@@ -45,9 +45,7 @@ static PedDiskType aix_disk_type;
 static int
 aix_probe (const PedDevice *dev)
 {
-       PedDiskType*    disk_type;
        AixLabel        label;
-       int             i;
 
        PED_ASSERT (dev != NULL, return 0);
 
@@ -135,8 +133,6 @@ aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
                   const PedFileSystemType* fs_type,
                   PedSector start, PedSector end)
 {
-       PedPartition*           part;
-
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
                              _("Support for adding partitions to AIX disk "
@@ -147,8 +143,6 @@ aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
 static PedPartition*
 aix_partition_duplicate (const PedPartition* part)
 {
-       PedPartition*           new_part;
-
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
                              _("Support for duplicating partitions in AIX "
index 91e80fb..5f97f82 100644 (file)
@@ -1156,7 +1156,6 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type,
        }
        return part;
 
-error_free_dos_data:
        ped_free (dos_data);
 error_free_part:
        ped_free (part);
@@ -1446,7 +1445,6 @@ static PedGeometry*
 _best_solution (const PedPartition* part, const PedCHSGeometry* bios_geom,
                PedGeometry* a, PedGeometry* b)
 {
-       PedDevice*      dev = part->disk->dev;
        PedSector       cyl_size = bios_geom->heads * bios_geom->sectors;
        int             a_cylinder;
        int             b_cylinder;
@@ -1659,7 +1657,6 @@ _align_primary (PedPartition* part, const PedCHSGeometry* bios_geom,
                const PedConstraint* constraint)
 {
        PedDisk*        disk = part->disk;
-       PedDevice*      dev = disk->dev;
        PedGeometry*    min_geom = NULL;
        PedGeometry*    solution = NULL;
 
@@ -1692,7 +1689,6 @@ static int
 _logical_min_start_head (PedPartition* part, const PedCHSGeometry* bios_geom,
                         PedPartition* ext_part, int is_start_ext_part)
 {
-       PedDevice*      dev = part->disk->dev;
        PedSector       cylinder_size = bios_geom->sectors * bios_geom->heads;
        PedSector       base_head;
 
@@ -1767,7 +1763,6 @@ _align_logical (PedPartition* part, const PedCHSGeometry* bios_geom,
                const PedConstraint* constraint)
 {
        PedDisk*        disk = part->disk;
-       PedDevice*      dev = disk->dev;
        PedPartition*   ext_part = ped_disk_extended_partition (disk);
        PedSector       cyl_size = bios_geom->sectors * bios_geom->heads;
        PedSector       start_base;
@@ -1984,7 +1979,6 @@ add_logical_part_metadata (PedDisk* disk, PedPartition* log_part)
 {
        PedPartition*   ext_part = ped_disk_extended_partition (disk);
        PedPartition*   prev = log_part->prev;
-       PedDevice*      dev = disk->dev;
        PedCHSGeometry  bios_geom;
        PedSector       cyl_size;
        PedSector       metadata_start;
index 6918c55..4f6cd21 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+    Copyright (C) 2001, 2002, 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -119,7 +119,6 @@ dvh_alloc (const PedDevice* dev)
 
 error_destroy_constraint_any:
        ped_constraint_destroy (constraint_any);
-error_destroy_volume_part:
        ped_partition_destroy (volume_part);
 error_free_disk_specific:
        ped_free (disk->disk_specific);
@@ -364,6 +363,9 @@ dvh_read (PedDisk* disk)
                                return 1;
                        case PED_EXCEPTION_FIX:
                                write_back = 1;
+                               break;
+                       default:
+                               break;
                }
 #endif
        }
@@ -401,7 +403,6 @@ dvh_read (PedDisk* disk)
 
 error_delete_all:
        ped_disk_delete_all (disk);
-error:
        return 0;
 }
 
@@ -686,8 +687,6 @@ static int
 dvh_partition_is_flag_available (const PedPartition* part,
                                  PedPartitionFlag flag)
 {
-       DVHDiskData* dvh_disk_data = part->disk->disk_specific;
-
        switch (flag) {
        case PED_PARTITION_ROOT:
        case PED_PARTITION_SWAP:
@@ -849,7 +848,6 @@ dvh_alloc_metadata (PedDisk* disk)
        ped_constraint_destroy (constraint_exact);
        return 1;
 
-error_destroy_constraint:
        ped_constraint_destroy (constraint_exact);
 error_destroy_part:
        ped_partition_destroy (part);
index 8fd38e1..acdd6a0 100644 (file)
@@ -56,42 +56,6 @@ setpos (fdasd_anchor_t *anc, int dsn, int pos)
        anc->partno[dsn] = pos;
 }
 
-static void
-fdasd_check_volser (char *s, int devno)
-{
-       PDEBUG
-       int i, j;
-
-       for (i = 0; i < 6; i++) {
-               if ((s[i] < 0x20) || (s[i] > 0x7a)
-                   || ((s[i] >= 0x21) && (s[i] <= 0x22))
-                   || /* !"         */ ((s[i] >= 0x26) && (s[i] <= 0x2f))
-                   || /* &'()*+,-./ */ ((s[i] >= 0x3a) && (s[i] <= 0x3f))
-                   || /* :;<=>?     */ ((s[i] >= 0x5b) && (s[i] <= 0x60)))
-                       /* \]^_´     */ s[i] = ' ';
-               s[i] = toupper (s[i]);
-       }
-
-       s[6] = 0x00;
-
-       for (i = 0; i < 6; i++) {
-               if (s[i] == ' ')
-                       for (j = i; j < 6; j++)
-                               if (s[j] != ' ') {
-                                       s[i] = s[j];
-                                       s[j] = ' ';
-                                       break;
-                               }
-       }
-
-       if (s[0] == ' ') {
-               printf ("Usage error, switching to default.\n");
-               sprintf (s, "0X%04x", devno);
-               for (i = 0; i < 6; i++)
-                       s[i] = toupper (s[i]);
-       }
-}
-
 void
 fdasd_cleanup (fdasd_anchor_t *anchor) 
 {
@@ -203,24 +167,6 @@ cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo)
                                + p->hh * geo->sectors + p->b);
 }
 
-static char *fdasd_partition_type (char *str) 
-{
-       PDEBUG
-
-       if (strncmp("NATIVE", str, 6) == 0)
-               strcpy(str, "Linux native");
-       else if (strncmp("NEW   ", str, 6) == 0)
-               strcpy(str, "Linux native");
-       else if (strncmp("SWAP  ", str, 6) == 0)
-               strcpy(str, "Linux swap");
-       else if (strncmp("RAID  ", str, 6) == 0)
-               strcpy(str, "Linux Raid");
-       else
-               strcpy(str, "unknown");
-
-       return str;
-}
-
 /*
  * initializes the anchor structure and allocates some
  * memory for the labels
@@ -323,21 +269,6 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
 }
 
 /*
- * call IOCTL to re-read the partition table
- */
-static void
-fdasd_reread_partition_table (fdasd_anchor_t * anc, int fd)
-{
-       PDEBUG
-       char str[LINE_LENGTH];
-       int f;
-
-       if (ioctl (fd, BLKRRPART, NULL) != 0)
-               fdasd_error (anc, unable_to_ioctl, "Error while rereading "
-                               "partition table.\nPlease reboot!");
-}
-
-/*
  * writes all changes to dasd
  */
 static void
@@ -592,37 +523,6 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc)
 }
 
 /*
- * changes the volume serial
- */
-static void
-fdasd_change_volser (fdasd_anchor_t *anc, char *line_ptr) 
-{
-       PDEBUG
-       char str[10];
-
-       if (strcmp(line_ptr, "") != 0) {
-               int i;
-
-               /* fill with blanks if necessary and remove the linebreak */
-               i = strlen(line_ptr);
-               if (i <= 6)
-                       strncpy(line_ptr + i - 1, "      ", 6);
-
-               strncpy(str, line_ptr, 6);
-
-               for (i=0; i<6; i++) str[i] = toupper(str[i]);
-               str[6] = 0x00;
-
-               fdasd_check_volser (str, anc->devno);
-        vtoc_volume_label_set_volser(anc->vlabel, str);
-
-               vtoc_set_cchhb(&anc->vlabel->vtoc, 0x0000, 0x0001, 0x01);
-               anc->vlabel_changed++;
-               anc->vtoc_changed++;
-       }
-}
-
-/*
  * sets some important partition data
  * (like used, start_trk, end_trk, len_trk)
  * by calculating these values with the
@@ -935,7 +835,6 @@ fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent,
        unsigned int limit, cc, hh;
        cchh_t llimit, ulimit;
        partition_info_t *q;
-       char mesg[48];
        u_int8_t b1, b2;
        u_int16_t c, h;
        unsigned int start = *start_ptr, stop = *stop_ptr;
index 2a86352..94cafe5 100644 (file)
@@ -4,7 +4,7 @@
     original version by Matt Domsch <Matt_Domsch@dell.com>
     Disclaimed into the Public Domain
 
-    Portions Copyright (C) 2001, 2002, 2003, 2005, 2006
+    Portions Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007
         Free Software Foundation, Inc.
 
     EFI GUID Partition Table handling
@@ -363,7 +363,6 @@ pth_get_raw (const PedDevice* dev, const GuidPartitionTableHeader_t* pth)
 static void
 swap_uuid_and_efi_guid(uuid_t uuid)
 {
-       int i;
        efi_guid_t *guid = (efi_guid_t *)uuid;
 
        PED_ASSERT(uuid != NULL, return);
@@ -478,7 +477,6 @@ gpt_clobber(PedDevice * dev)
         uint8_t* zeroed_pth_raw = ped_malloc (pth_get_size (dev));
         uint8_t* pth_raw = ped_malloc (pth_get_size (dev));
        GuidPartitionTableHeader_t* gpt;
-       GuidPartitionEntry_t ptes[GPT_DEFAULT_PARTITION_ENTRIES];
 
        PED_ASSERT (dev != NULL, return 0);
 
@@ -1028,7 +1026,6 @@ gpt_write(PedDisk * disk)
        GuidPartitionTableHeader_t* gpt;
        PedPartition* part;
        int ptes_size;
-       unsigned int i;
 
        PED_ASSERT (disk != NULL, goto error);
        PED_ASSERT (disk->dev != NULL, goto error);
@@ -1102,7 +1099,6 @@ add_metadata_part(PedDisk * disk, PedSector start, PedSector length)
 
 error_destroy_constraint:
        ped_constraint_destroy (constraint_exact);
-error_destroy_part:
        ped_partition_destroy (part);
 error:
        return 0;
index c1a4658..a899457 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
 
     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
@@ -95,8 +95,6 @@ loop_clobber (PedDevice* dev)
 static PedDisk*
 loop_alloc (const PedDevice* dev)
 {
-       PedDisk*                disk;
-
        PED_ASSERT (dev != NULL, return 0);
 
        if (dev->length < 256)
index 5e4bc0c..9ccce69 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
 
     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
@@ -327,7 +327,6 @@ mac_duplicate (const PedDisk* disk)
        memcpy (new_mac_data, old_mac_data, sizeof (MacDiskData));
        return new_disk;
 
-error_free_new_disk:
        _ped_disk_free (new_disk);
 error:
        return NULL;
@@ -1143,7 +1142,6 @@ mac_partition_new (
        }
        return part;
 
-error_free_mac_data:
        ped_free (mac_data);
 error_free_part:
        ped_free (part);
@@ -1217,7 +1215,6 @@ mac_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
 static int
 mac_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
 {
-       PedFileSystemType*      hfs = ped_file_system_type_get ("hfs");
        MacPartitionData*       mac_data;
 
        PED_ASSERT (part != NULL, return 0);
index 5149b10..df3ed20 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+    Copyright (C) 2000, 2001, 2007 Free Software Foundation, Inc.
 
     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
@@ -244,8 +244,6 @@ pc98_clobber (PedDevice* dev)
 static PedDisk*
 pc98_alloc (const PedDevice* dev)
 {
-       PedDisk*        disk;
-
        PED_ASSERT (dev != NULL, return 0);
 
        return _ped_disk_alloc (dev, &pc98_disk_type);
@@ -562,7 +560,6 @@ pc98_partition_new (
        }
        return part;
 
-error_free_pc98_data:
        ped_free (pc98_data);
 error_free_part:
        ped_free (part);
@@ -639,7 +636,6 @@ pc98_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
 static int
 pc98_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
 {
-       PedDisk*                        disk;
        PC98PartitionData*              pc98_data;
 
        PED_ASSERT (part != NULL, return 0);
index b6383fe..586b07f 100644 (file)
@@ -123,9 +123,7 @@ sun_verify_checksum (SunRawLabel *label)
 static int
 sun_probe (const PedDevice *dev)
 {
-       PedDiskType*    disk_type;
        SunRawLabel     label;
-       int             i;
 
        PED_ASSERT (dev != NULL, return 0);
 
@@ -488,7 +486,6 @@ sun_partition_new (const PedDisk* disk, PedPartitionType part_type,
 
        return part;
 
-error_free_sun_data:
        ped_free (sun_data);
 error_free_part:
        ped_free (part);
index 7e48e0a..13641a6 100644 (file)
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2005 Free Software Foundation, Inc.
+    Copyright (C) 2005, 2007 Free Software Foundation, Inc.
 
     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
@@ -421,7 +421,6 @@ parse_chs (const char* str, PedDevice* dev, PedSector* sector,
 
 error_free_copy:
        ped_free (copy);
-error:
        *sector = 0;
        if (range)
                *range = NULL;
index 069f665..4a55e27 100644 (file)
@@ -1,6 +1,6 @@
 /*
     parted - a frontend to libparted
-    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006
+    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
     Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
@@ -105,7 +105,6 @@ static char* name_msg =         N_("NAME is any word you want\n");
 static char* resize_msg_start = N_("The partition must have one of the "
                                    "following FS-TYPEs: ");
 
-static char* version_msg = N_("GNU Parted Version information:\n");
 static char* copyright_msg = N_(
 "Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
 "This program is free software, covered by the GNU General Public License.\n"
@@ -124,7 +123,7 @@ static char* mkpart_fs_type_msg;
 static char* resize_fs_type_msg;
 
 static Command* commands [256] = {NULL};
-static PedTimer* timer;
+static PedTimer* g_timer;
 static TimerContext timer_context;
 
 static int _print_list (int cli);
@@ -155,8 +154,8 @@ _timer_handler (PedTimer* timer, void* context)
                         printf ("%s... ", timer->state_name);
                 printf (_("%0.f%%\t(time left %.2d:%.2d)"),
                         100.0 * timer->frac,
-                        tcontext->predicted_time_left / 60,
-                        tcontext->predicted_time_left % 60);
+                        (int) (tcontext->predicted_time_left / 60),
+                        (int) (tcontext->predicted_time_left % 60));
 
                 fflush (stdout);
         }
@@ -430,7 +429,6 @@ do_check (PedDevice** dev)
         PedDisk*        disk;
         PedFileSystem*  fs;
         PedPartition*   part = NULL;
-        int             part_num;
 
         disk = ped_disk_new (*dev);
         if (!disk)
@@ -447,7 +445,7 @@ do_check (PedDevice** dev)
         fs = ped_file_system_open (&part->geom);
         if (!fs)
                 goto error_destroy_disk;
-        if (!ped_file_system_check (fs, timer))
+        if (!ped_file_system_check (fs, g_timer))
                 goto error_close_fs;
         ped_file_system_close (fs);
         ped_disk_destroy (disk);
@@ -466,7 +464,6 @@ do_cp (PedDevice** dev)
 {
         PedDisk*                src_disk;
         PedDisk*                dst_disk;
-        PedDevice*              src_device;
         PedPartition*           src = NULL;
         PedPartition*           dst = NULL;
         PedFileSystem*          src_fs;
@@ -504,7 +501,7 @@ do_cp (PedDevice** dev)
         src_fs = ped_file_system_open (&src->geom);
         if (!src_fs)
                 goto error_destroy_disk;
-        dst_fs = ped_file_system_copy (src_fs, &dst->geom, timer);
+        dst_fs = ped_file_system_copy (src_fs, &dst->geom, g_timer);
         if (!dst_fs)
                 goto error_close_src_fs;
         dst_fs_type = dst_fs->type;     /* may be different to src_fs->type */
@@ -629,7 +626,7 @@ do_mkfs (PedDevice** dev)
         if (!command_line_get_fs_type (_("File system?"), &type))
                 goto error_destroy_disk;
 
-        fs = ped_file_system_create (&part->geom, type, timer);
+        fs = ped_file_system_create (&part->geom, type, g_timer);
         if (!fs)
                 goto error_destroy_disk;
         ped_file_system_close (fs);
@@ -792,12 +789,10 @@ do_mkpart (PedDevice** dev)
 
 error_remove_part:
         ped_disk_remove_partition (disk, part);
-error_destroy_all_constraints:
         ped_constraint_destroy (final_constraint);
 error_destroy_simple_constraints:
         ped_constraint_destroy (user_constraint);
         ped_constraint_destroy (dev_constraint);
-error_destroy_part:
         ped_partition_destroy (part);
 error_destroy_disk:
         ped_disk_destroy (disk);
@@ -928,7 +923,7 @@ do_mkpartfs (PedDevice** dev)
                 ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
 
         /* fs creation */
-        fs = ped_file_system_create (&part->geom, fs_type, timer);
+        fs = ped_file_system_create (&part->geom, fs_type, g_timer);
         if (!fs) 
                 goto error_destroy_disk;
         ped_file_system_close (fs);
@@ -964,12 +959,10 @@ do_mkpartfs (PedDevice** dev)
 
 error_remove_part:
         ped_disk_remove_partition (disk, part);
-error_destroy_all_constraints:
         ped_constraint_destroy (final_constraint);
 error_destroy_simple_constraints:
         ped_constraint_destroy (user_constraint);
         ped_constraint_destroy (dev_constraint);
-error_destroy_part:
         ped_partition_destroy (part);
 error_destroy_disk:
         ped_disk_destroy (disk);
@@ -1048,7 +1041,7 @@ do_move (PedDevice** dev)
         }
 
         /* do the move */
-        fs_copy = ped_file_system_copy (fs, &part->geom, timer);
+        fs_copy = ped_file_system_copy (fs, &part->geom, g_timer);
         if (!fs_copy)
                 goto error_close_fs;
         ped_file_system_close (fs_copy);
@@ -1215,7 +1208,6 @@ static int
 do_print (PedDevice** dev)
 {
         PedDisk*        disk;
-        PedPartition*   part;
         Table*          table;
         StrList*        row;
         int             has_extended;
@@ -1359,6 +1351,7 @@ do_print (PedDevice** dev)
                                          PED_DISK_TYPE_PARTITION_NAME);
 
         
+        PedPartition* part;
         if (!opt_machine_mode) {
 
             if (ped_unit_get_default() == PED_UNIT_CHS) {
@@ -1501,7 +1494,6 @@ do_print (PedDevice** dev)
 
         return 1;
 
-error_destroy_disk:
         ped_disk_destroy (disk);
 error:
         return 0;
@@ -1596,6 +1588,7 @@ _rescue_add_partition (PedPartition* part)
         switch (ex_opt) {
                 case PED_EXCEPTION_CANCEL: return -1;
                 case PED_EXCEPTION_NO: return 0;
+                default: break;
         }
 
         ped_partition_set_system (part, fs_type);
@@ -1622,10 +1615,10 @@ _rescue_pass (PedDisk* disk, PedGeometry* start_range, PedGeometry* end_range)
 
         ped_geometry_init (&entire_dev, disk->dev, 0, disk->dev->length);
 
-        ped_timer_reset (timer);
-        ped_timer_set_state_name (timer, _("searching for file systems"));
+        ped_timer_reset (g_timer);
+        ped_timer_set_state_name (g_timer, _("searching for file systems"));
         for (start = start_range->start; start <= start_range->end; start++) {
-                ped_timer_update (timer, 1.0 * (start - start_range->start)
+                ped_timer_update (g_timer, 1.0 * (start - start_range->start)
                                          / start_range->length);
 
                 ped_geometry_init (&start_geom_exact, disk->dev, start, 1);
@@ -1661,17 +1654,14 @@ _rescue_pass (PedDisk* disk, PedGeometry* start_range, PedGeometry* end_range)
                 ped_partition_destroy (part);
                 ped_constraint_done (&constraint);
         }
-        ped_timer_update (timer, 1.0);
+        ped_timer_update (g_timer, 1.0);
 
         return 1;
 
 error_remove_partition:
         ped_disk_remove_partition (disk, part);
-error_partition_destroy:
         ped_partition_destroy (part);
-error_constraint_done:
         ped_constraint_done (&constraint);
-error:
         return 0;
 }
 
@@ -1767,7 +1757,7 @@ do_resize (PedDevice** dev)
                 if (!ped_disk_set_partition_geom (disk, part, constraint,
                                                   new_geom.start, new_geom.end))
                         goto error_close_fs;
-                if (!ped_file_system_resize (fs, &part->geom, timer))
+                if (!ped_file_system_resize (fs, &part->geom, g_timer))
                         goto error_close_fs;
                 /* may have changed... eg fat16 -> fat32 */
                 ped_partition_set_system (part, fs->type);
@@ -2281,9 +2271,6 @@ while (1)
 *argc_ptr -= optind;
 *argv_ptr += optind;
 return 1;
-
-error:
-return 0;
 }
 
 static PedDevice*
@@ -2347,8 +2334,8 @@ dev = _choose_device (argc_ptr, argv_ptr);
 if (!dev)
         goto error_done_commands;
 
-timer = ped_timer_new (_timer_handler, &timer_context);
-if (!timer)
+g_timer = ped_timer_new (_timer_handler, &timer_context);
+if (!g_timer)
         goto error_done_commands;
 timer_context.last_update = 0;
 
@@ -2357,7 +2344,6 @@ return dev;
 error_done_commands:
 _done_commands ();
 _done_messages ();
-error_done_ui:
 done_ui ();
 error:
 return NULL;
@@ -2383,7 +2369,7 @@ if (dev->type != PED_DEVICE_FILE && !opt_script_mode && !opt_machine_mode) {
 
 ped_device_close (dev);
 
-ped_timer_destroy (timer);
+ped_timer_destroy (g_timer);
 _done_commands ();
 _done_messages ();
 done_ui();
index fd101fa..447fb56 100644 (file)
@@ -109,8 +109,6 @@ static struct {
        sigjmp_buf      jmp_state;
 } readline_state;
 
-static PedExceptionOption      current_exception_opt = 0;
-
 static struct sigaction sig_segv;
 static struct sigaction sig_int;
 static struct sigaction sig_fpe;
@@ -412,7 +410,6 @@ static char*
 _readline (const char* prompt, const StrList* possibilities)
 {
        char*   line;
-        int     val;
 
        readline_state.possibilities = possibilities;
        readline_state.cur_pos = NULL;
@@ -931,7 +928,6 @@ int
 command_line_get_disk_type (const char* prompt, const PedDiskType*(* value))
 {
        char*           disk_type_name;
-       PedDiskType*    disk_type;
 
        disk_type_name = command_line_get_word (prompt,
                                                *value ? (*value)->name : NULL,
@@ -1303,7 +1299,6 @@ print_using_dev (PedDevice* dev)
 int
 interactive_mode (PedDevice** dev, Command* cmd_list[])
 {
-       char*           line;
        StrList*        list;
        StrList*        command_names = command_get_names (cmd_list);