Subject: bug#16053: [PATCH 1/2] "-Wall -Wextra -Werror" compilation patches - part 1/2

From: Doron Tsur <[email-masked]>
Date: Wed, 4 Dec 2013 16:32:27 +0200

Tests: Ubuntu 13.10 compilation
.../configure --prefix=/usr --without-readline CFLAGS="-Wall -Wextra -Werror" && make

Signed-off-by: Doron Tsur <[email-masked]>
---
 libparted/arch/linux.c          |   10 +++++-----
 libparted/fs/amiga/apfs.c       |    2 +-
 libparted/fs/r/fat/fat.c        |    4 ++--
 libparted/fs/r/fat/table.c      |    2 +-
 libparted/fs/r/hfs/hfs.c        |    4 ++++
 libparted/fs/r/hfs/journal.c    |    2 +-
 libparted/fs/r/hfs/reloc.c      |    6 +++---
 libparted/fs/r/hfs/reloc_plus.c |    8 ++++----
 libparted/labels/aix.c          |   30 +++++++++++++++---------------
 libparted/labels/bsd.c          |    6 +++---
 libparted/labels/dos.c          |   10 +++++-----
 libparted/labels/dvh.c          |    6 +++---
 libparted/labels/gpt.c          |   10 +++++-----
 libparted/labels/loop.c         |   14 +++++++-------
 libparted/labels/mac.c          |    6 +++---
 libparted/labels/pc98.c         |    6 +++---
 libparted/labels/pt-tools.c     |    4 ++--
 libparted/labels/rdb.c          |    6 +++---
 libparted/labels/sun.c          |    6 +++---
 parted/parted.c                 |    6 +++---
 parted/table.c                  |    3 ++-
 parted/ui.c                     |    8 ++++----
 22 files changed, 82 insertions(+), 77 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index f43eae1..4ce75cd 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1643,7 +1643,7 @@ retry:
 }
 
 static int
-linux_refresh_open (PedDevice* dev)
+linux_refresh_open (PedDevice* dev __attribute__((unused)))
 {
         return 1;
 }
@@ -1958,7 +1958,7 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
         diobuf_start = diobuf;
         while (1) {
                 ssize_t status = write (arch_specific->fd, diobuf, write_length);
-                if (status == write_length) break;
+                if ((size_t)status == write_length) break;
                 if (status > 0) {
                         write_length -= status;
                         diobuf = (char *) diobuf + status;
@@ -2506,7 +2506,7 @@ _sysfs_int_entry_from_dev(PedDevice const* dev, const char *entry, int *val)
         char        path[128];
         int r = snprintf(path, sizeof(path), "/sys/block/%s/%s",
 			 last_component(dev->path), entry);
-        if (r < 0 || r >= sizeof(path))
+        if (r < 0 || ((size_t)r) >= sizeof(path))
                 return false;
 
         FILE *fp = fopen(path, "r");
@@ -2536,7 +2536,7 @@ _sysfs_ull_entry_from_part(PedPartition const* part, const char *entry,
                 last_component(part->disk->dev->path),
                 last_component(part_name), entry);
         free(part_name);
-        if (r < 0 || r >= sizeof(path))
+        if (r < 0 || ((size_t)r) >= sizeof(path))
                 return false;
 
         FILE *fp = fopen(path, "r");
@@ -2794,7 +2794,7 @@ _disk_sync_part_table (PedDisk* disk)
 
         /* lpn = largest partition number. */
         if (ped_disk_get_max_supported_partition_count(disk, &lpn))
-                lpn = PED_MIN(lpn, part_range);
+                lpn = (int)PED_MIN(((unsigned int)lpn), part_range);
         else
                 lpn = part_range;
 
diff --git a/libparted/fs/amiga/apfs.c b/libparted/fs/amiga/apfs.c
index 9f9e6e0..99467db 100644
--- a/libparted/fs/amiga/apfs.c
+++ b/libparted/fs/amiga/apfs.c
@@ -33,7 +33,7 @@
 #endif /* ENABLE_NLS */
 
 static int
-_apfs_probe_root (uint32_t *block, uint32_t blocksize, uint32_t kind) {
+_apfs_probe_root (uint32_t *block, uint32_t blocksize __attribute__((unused)), uint32_t kind) {
 	if (PED_BE32_TO_CPU (block[0]) != kind) return 0;
 	return 1;
 }
diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c
index c8e4552..b6bebd9 100644
--- a/libparted/fs/r/fat/fat.c
+++ b/libparted/fs/r/fat/fat.c
@@ -203,7 +203,7 @@ fat_root_dir_clear (PedFileSystem* fs)
 }
 
 PedFileSystem*
-fat_create (PedGeometry* geom, FatType fat_type, PedTimer* timer)
+fat_create (PedGeometry* geom, FatType fat_type, PedTimer* timer __attribute__((unused)))
 {
 	PedFileSystem*		fs;
 	FatSpecific*		fs_info;
@@ -418,7 +418,7 @@ error:
 }
 
 int
-fat_check (PedFileSystem* fs, PedTimer* timer)
+fat_check (PedFileSystem* fs, PedTimer* timer __attribute__((unused)))
 {
 	FatSpecific*	fs_info = FAT_SPECIFIC (fs);
 	PedSector	cluster_sectors;
diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c
index 974dea8..4c9b042 100644
--- a/libparted/fs/r/fat/table.c
+++ b/libparted/fs/r/fat/table.c
@@ -198,7 +198,7 @@ fat_table_compare (const FatTable* a, const FatTable* b)
 }
 
 static int
-_test_code_available (const FatTable* ft, FatCluster code)
+_test_code_available (const FatTable* ft __attribute__((unused)), FatCluster code)
 {
 	return code == 0;
 }
diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c
index 26c789a..b032781 100644
--- a/libparted/fs/r/hfs/hfs.c
+++ b/libparted/fs/r/hfs/hfs.c
@@ -63,6 +63,7 @@ static PedFileSystemType hfsplus_type;
 /* Maybe I shouldn't touch the alternate MDB ? */
 /* Anyway clobber is call before other fs creation */
 /* So this is a non-issue */
+#if 0
 static int
 hfs_clobber (PedGeometry* geom)
 {
@@ -78,6 +79,7 @@ hfs_clobber (PedGeometry* geom)
 		(!!ped_geometry_write (geom, buf, geom->length - 1, 1)) &
 		(!!ped_geometry_sync  (geom));
 }
+#endif
 
 PedFileSystem *
 hfs_open (PedGeometry* geom)
@@ -339,6 +341,7 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
 #include "reloc_plus.h"
 #include "journal.h"
 
+#if 0
 static int
 hfsplus_clobber (PedGeometry* geom)
 {
@@ -374,6 +377,7 @@ hfsplus_clobber (PedGeometry* geom)
 	/* non-embedded or envelop destroy as hfs */
 	return ( hfs_clobber (geom) && i );
 }
+#endif
 
 int
 hfsplus_close (PedFileSystem *fs)
diff --git a/libparted/fs/r/hfs/journal.c b/libparted/fs/r/hfs/journal.c
index 54a065d..83a6372 100644
--- a/libparted/fs/r/hfs/journal.c
+++ b/libparted/fs/r/hfs/journal.c
@@ -99,7 +99,7 @@ hfsj_update_jl(PedFileSystem* fs, uint32_t block)
 /* Return the sector in the journal that is after the area read */
 /* or 0 on error */
 static PedSector
-hfsj_journal_read(PedGeometry* geom, HfsJJournalHeader* jh,
+hfsj_journal_read(PedGeometry* geom, HfsJJournalHeader* jh __attribute__((unused)),
 		  PedSector journ_sect, PedSector journ_length,
 		  PedSector read_sect, unsigned int nb_sect,
 		  void* buf)
diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c
index abc6b1b..0e1e833 100644
--- a/libparted/fs/r/hfs/reloc.c
+++ b/libparted/fs/r/hfs/reloc.c
@@ -315,7 +315,7 @@ hfs_move_extent_starting_at (PedFileSystem *fs, unsigned int *ptr_fblock,
 
 static int
 hfs_cache_from_mdb(HfsCPrivateCache* cache, PedFileSystem* fs,
-		   PedTimer* timer)
+		   PedTimer* timer __attribute__((unused)))
 {
 	HfsPrivateFSData* 	priv_data = (HfsPrivateFSData*)
 						fs->type_specific;
@@ -359,7 +359,7 @@ hfs_cache_from_mdb(HfsCPrivateCache* cache, PedFileSystem* fs,
 
 static int
 hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
-		   PedTimer* timer)
+		   PedTimer* timer __attribute__((unused)))
 {
 	HfsPrivateFSData* 	priv_data = (HfsPrivateFSData*)
 						fs->type_specific;
@@ -454,7 +454,7 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
 
 static int
 hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
-		   PedTimer* timer)
+		   PedTimer* timer __attribute__((unused)))
 {
 	HfsPrivateFSData* 	priv_data = (HfsPrivateFSData*)
 						fs->type_specific;
diff --git a/libparted/fs/r/hfs/reloc_plus.c b/libparted/fs/r/hfs/reloc_plus.c
index 6c2408c..fd2c2c1 100644
--- a/libparted/fs/r/hfs/reloc_plus.c
+++ b/libparted/fs/r/hfs/reloc_plus.c
@@ -379,7 +379,7 @@ hfsplus_move_extent_starting_at (PedFileSystem *fs, unsigned int *ptr_fblock,
 
 static int
 hfsplus_cache_from_vh(HfsCPrivateCache* cache, PedFileSystem* fs,
-		      PedTimer* timer)
+		      PedTimer* timer __attribute__((unused)))
 {
 	HfsPPrivateFSData* 	priv_data = (HfsPPrivateFSData*)
 						fs->type_specific;
@@ -471,7 +471,7 @@ hfsplus_cache_from_vh(HfsCPrivateCache* cache, PedFileSystem* fs,
 
 static int
 hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
-			   PedTimer* timer)
+			   PedTimer* timer __attribute__((unused)))
 {
 	HfsPPrivateFSData* 	priv_data = (HfsPPrivateFSData*)
 						fs->type_specific;
@@ -597,7 +597,7 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
 
 static int
 hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
-			  PedTimer* timer)
+			  PedTimer* timer __attribute__((unused)))
 {
 	HfsPPrivateFSData* 	priv_data = (HfsPPrivateFSData*)
 						fs->type_specific;
@@ -711,7 +711,7 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
 
 static int
 hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs,
-			      PedTimer* timer)
+			      PedTimer* timer __attribute__((unused)))
 {
 	HfsPPrivateFSData* 	priv_data = (HfsPPrivateFSData*)
 						fs->type_specific;
diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c
index 98de112..f76829d 100644
--- a/libparted/labels/aix.c
+++ b/libparted/labels/aix.c
@@ -107,7 +107,7 @@ aix_read (PedDisk* disk)
 
 #ifndef DISCOVER_ONLY
 static int
-aix_write (const PedDisk* disk)
+aix_write (const PedDisk* disk __attribute__((unused)))
 {
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
@@ -118,9 +118,9 @@ aix_write (const PedDisk* disk)
 #endif /* !DISCOVER_ONLY */
 
 static PedPartition*
-aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
-		   const PedFileSystemType* fs_type,
-		   PedSector start, PedSector end)
+aix_partition_new (const PedDisk* disk __attribute__((unused)), PedPartitionType part_type __attribute__((unused)),
+		   const PedFileSystemType* fs_type __attribute__((unused)),
+		   PedSector start __attribute__((unused)), PedSector end __attribute__((unused)))
 {
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
@@ -130,7 +130,7 @@ aix_partition_new (const PedDisk* disk, PedPartitionType part_type,
 }
 
 static PedPartition*
-aix_partition_duplicate (const PedPartition* part)
+aix_partition_duplicate (const PedPartition* part __attribute__((unused)))
 {
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
@@ -148,7 +148,7 @@ aix_partition_destroy (PedPartition* part)
 }
 
 static int
-aix_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
+aix_partition_set_system (PedPartition* part __attribute__((unused)), const PedFileSystemType* fs_type __attribute__((unused)))
 {
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
@@ -158,7 +158,7 @@ aix_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
 }
 
 static int
-aix_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
+aix_partition_set_flag (PedPartition* part __attribute__((unused)), PedPartitionFlag flag __attribute__((unused)), int state __attribute__((unused)))
 {
         ped_exception_throw (PED_EXCEPTION_NO_FEATURE,
                              PED_EXCEPTION_CANCEL,
@@ -168,35 +168,35 @@ aix_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
 }
 
 static int _GL_ATTRIBUTE_CONST
-aix_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
+aix_partition_get_flag (const PedPartition* part __attribute__((unused)), PedPartitionFlag flag __attribute__((unused)))
 {
         return 0;
 }

 static int
-aix_partition_is_flag_available (const PedPartition* part,
-				 PedPartitionFlag flag)
+aix_partition_is_flag_available (const PedPartition* part __attribute__((unused)),
+				 PedPartitionFlag flag __attribute__((unused)))
 {
         return 0;
 }

 static int
-aix_get_max_primary_partition_count (const PedDisk* disk)
+aix_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return 4;
 }
 
 static bool
-aix_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+aix_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = MAX_TOTAL_PART;
 	return true;
 }
 
 static int _GL_ATTRIBUTE_PURE
-aix_partition_align (PedPartition* part, const PedConstraint* constraint)
+aix_partition_align (PedPartition* part, const PedConstraint* constraint __attribute__((unused)))
 {
         PED_ASSERT (part != NULL);
 
@@ -204,13 +204,13 @@ aix_partition_align (PedPartition* part, const PedConstraint* constraint)
 }
 
 static int _GL_ATTRIBUTE_PURE
-aix_partition_enumerate (PedPartition* part)
+aix_partition_enumerate (PedPartition* part __attribute__((unused)))
 {
 	return 1;
 }
 
 static int _GL_ATTRIBUTE_PURE
-aix_alloc_metadata (PedDisk* disk)
+aix_alloc_metadata (PedDisk* disk __attribute__((unused)))
 {
 	return 1;
 }
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
index 79332ab..9c76d4d 100644
--- a/libparted/labels/bsd.c
+++ b/libparted/labels/bsd.c
@@ -520,7 +520,7 @@ bsd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
 }
 
 static int
-bsd_partition_is_flag_available (const PedPartition* part,
+bsd_partition_is_flag_available (const PedPartition* part __attribute__((unused)),
 				 PedPartitionFlag flag)
 {
 	switch (flag) {
@@ -536,13 +536,13 @@ bsd_partition_is_flag_available (const PedPartition* part,

 static int
-bsd_get_max_primary_partition_count (const PedDisk* disk)
+bsd_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return BSD_MAXPARTITIONS;
 }
 
 static bool
-bsd_get_max_supported_partition_count(const PedDisk* disk, int *max_n)
+bsd_get_max_supported_partition_count(const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = BSD_MAXPARTITIONS;
 	return true;
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index 6bddd79..68d31e7 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -240,7 +240,7 @@ msdos_probe (const PedDevice *dev)
 
 	PED_ASSERT (dev != NULL);
 
-        if (dev->sector_size < sizeof *part_table)
+        if (((size_t)(dev->sector_size)) < sizeof *part_table)
                 return 0;
 
 	void *label;
@@ -374,7 +374,7 @@ msdos_disk_get_flag (const PedDisk *disk, PedDiskFlag flag)
 }
 
 static int
-msdos_disk_is_flag_available (const PedDisk *disk, PedDiskFlag flag)
+msdos_disk_is_flag_available (const PedDisk *disk __attribute__((unused)), PedDiskFlag flag)
 {
         switch (flag) {
         case PED_DISK_CYLINDER_ALIGNMENT:
@@ -404,7 +404,7 @@ chs_get_sector (const RawCHS* chs)
 }
 
 static PedSector _GL_ATTRIBUTE_PURE
-chs_to_sector (const PedDevice* dev, const PedCHSGeometry *bios_geom,
+chs_to_sector (const PedDevice* dev __attribute__((unused)), const PedCHSGeometry *bios_geom,
 	       const RawCHS* chs)
 {
 	PedSector	c;		/* not measured in sectors, but need */
@@ -2428,13 +2428,13 @@ msdos_partition_enumerate (PedPartition* part)
 }
 
 static int
-msdos_get_max_primary_partition_count (const PedDisk* disk)
+msdos_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return DOS_N_PRI_PARTITIONS;
 }
 
 static bool
-msdos_get_max_supported_partition_count(const PedDisk* disk, int *max_n)
+msdos_get_max_supported_partition_count(const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = MAX_TOTAL_PART;
 	return true;
diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
index 91b9080..72a3e53 100644
--- a/libparted/labels/dvh.c
+++ b/libparted/labels/dvh.c
@@ -682,7 +682,7 @@ dvh_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
 }
 
 static int
-dvh_partition_is_flag_available (const PedPartition* part,
+dvh_partition_is_flag_available (const PedPartition* part __attribute__((unused)),
 				  PedPartitionFlag flag)
 {
 	switch (flag) {
@@ -815,13 +815,13 @@ dvh_partition_enumerate (PedPartition* part)
 }
 
 static int
-dvh_get_max_primary_partition_count (const PedDisk* disk)
+dvh_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return NPARTAB;
 }
 
 static bool
-dvh_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+dvh_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = NPARTAB;
 	return true;
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 66c96e6..d7af6df 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -305,7 +305,7 @@ pth_get_size (const PedDevice *dev)
 }
 
 static inline uint32_t
-pth_get_size_static (const PedDevice *dev)
+pth_get_size_static (const PedDevice *dev __attribute__((unused)))
 {
   return sizeof (GuidPartitionTableHeader_t) - sizeof (uint8_t *);
 }
@@ -651,7 +651,7 @@ _header_is_valid (PedDisk const *disk, GuidPartitionTableHeader_t *gpt,
             && pe_size <= (UINT32_MAX >> 4)))
     return 0;
 
-  if (PED_LE64_TO_CPU (gpt->MyLBA) != my_lba)
+  if (((PedSector)PED_LE64_TO_CPU (gpt->MyLBA)) != my_lba)
     return 0;
 
   PedSector alt_lba = PED_LE64_TO_CPU (gpt->AlternateLBA);
@@ -886,7 +886,7 @@ gpt_read_headers (PedDisk const *disk,
 
   gpt_disk_data->AlternateLBA =
     (valid_primary
-     ? PED_LE64_TO_CPU (pri->AlternateLBA)
+     ? (PedSector)PED_LE64_TO_CPU (pri->AlternateLBA)
      : dev->length - 1);
 
   void *s_bak;
@@ -1562,7 +1562,7 @@ gpt_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state)
 }
 
 static int
-gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
+gpt_disk_is_flag_available(const PedDisk *disk __attribute__((unused)), PedDiskFlag flag)
 {
   switch (flag)
     {
@@ -1788,7 +1788,7 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
 }
 
 static int
-gpt_partition_is_flag_available (const PedPartition *part,
+gpt_partition_is_flag_available (const PedPartition *part __attribute__((unused)),
                                  PedPartitionFlag flag)
 {
   switch (flag)
diff --git a/libparted/labels/loop.c b/libparted/labels/loop.c
index ea8f007..aa97bbd 100644
--- a/libparted/labels/loop.c
+++ b/libparted/labels/loop.c
@@ -223,13 +223,13 @@ loop_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type)
 }
 
 static int
-loop_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
+loop_partition_set_flag (PedPartition* part __attribute__((unused)), PedPartitionFlag flag __attribute__((unused)), int state __attribute__((unused)))
 {
 	return 0;
 }
 
 static int
-loop_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
+loop_partition_get_flag (const PedPartition* part __attribute__((unused)), PedPartitionFlag flag __attribute__((unused)))
 {
 	return 0;
 }
@@ -254,8 +254,8 @@ loop_partition_align (PedPartition* part, const PedConstraint* constraint)
 }
 
 static int
-loop_partition_is_flag_available (const PedPartition* part,
-	       			  PedPartitionFlag flag)
+loop_partition_is_flag_available (const PedPartition* part __attribute__((unused)),
+				  PedPartitionFlag flag __attribute__((unused)))
 {
 	return 0;
 }
@@ -268,19 +268,19 @@ loop_partition_enumerate (PedPartition* part)
 }
 
 static int
-loop_alloc_metadata (PedDisk* disk)
+loop_alloc_metadata (PedDisk* disk __attribute__((unused)))
 {
 	return 1;
 }
 
 static int
-loop_get_max_primary_partition_count (const PedDisk* disk)
+loop_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return 1;
 }
 
 static bool
-loop_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+loop_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = 1;
 	return true;
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index f26f8e5..003b9c3 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -202,7 +202,7 @@ mac_probe (const PedDevice * dev)
 {
 	PED_ASSERT (dev != NULL);
 
-        if (dev->sector_size < sizeof (MacRawDisk))
+        if (((size_t)dev->sector_size) < sizeof (MacRawDisk))
                 return 0;
 
 	void *label;
@@ -1335,7 +1335,7 @@ mac_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
 
 static int
 mac_partition_is_flag_available (
-	const PedPartition* part, PedPartitionFlag flag)
+	const PedPartition* part __attribute__((unused)), PedPartitionFlag flag)
 {
 	switch (flag) {
 	case PED_PARTITION_BOOT:
@@ -1586,7 +1586,7 @@ mac_get_max_primary_partition_count (const PedDisk* disk)
 }
 
 static bool
-mac_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+mac_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = 65536;
 	return true;
diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c
index ad13c0d..dad84d9 100644
--- a/libparted/labels/pc98.c
+++ b/libparted/labels/pc98.c
@@ -613,7 +613,7 @@ pc98_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
 
 static int
 pc98_partition_is_flag_available (
-	const PedPartition* part, PedPartitionFlag flag)
+	const PedPartition* part __attribute__((unused)), PedPartitionFlag flag)
 {
 	switch (flag) {
 	case PED_PARTITION_HIDDEN:
@@ -769,13 +769,13 @@ error:
 }
 
 static int
-pc98_get_max_primary_partition_count (const PedDisk* disk)
+pc98_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return MAX_PART_COUNT;
 }
 
 static bool
-pc98_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+pc98_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = MAX_PART_COUNT;
 	return true;
diff --git a/libparted/labels/pt-tools.c b/libparted/labels/pt-tools.c
index 547b27c..fc698a4 100644
--- a/libparted/labels/pt-tools.c
+++ b/libparted/labels/pt-tools.c
@@ -40,7 +40,7 @@ static char zero[16 * 1024];
 int
 ptt_write_sector (PedDisk const *disk, void const *buf, size_t buflen)
 {
-  PED_ASSERT (buflen <= disk->dev->sector_size);
+  PED_ASSERT (buflen <= ((size_t) disk->dev->sector_size));
   /* Allocate a big enough buffer for ped_device_write.  */
   char *s0 = ped_malloc (disk->dev->sector_size);
   if (s0 == NULL)
@@ -88,7 +88,7 @@ ptt_read_sector (PedDevice const *dev, PedSector sector_num, void **buf)
 int
 ptt_clear_sectors (PedDevice *dev, PedSector start, PedSector n)
 {
-  PED_ASSERT (dev->sector_size <= sizeof zero);
+  PED_ASSERT (((size_t)dev->sector_size) <= sizeof zero);
   PedSector n_z_sectors = sizeof zero / dev->sector_size;
   PedSector n_full = n / n_z_sectors;
   PedSector i;
diff --git a/libparted/labels/rdb.c b/libparted/labels/rdb.c
index 4cf1463..5089595 100644
--- a/libparted/labels/rdb.c
+++ b/libparted/labels/rdb.c
@@ -970,7 +970,7 @@ amiga_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
 }
 
 static int
-amiga_partition_is_flag_available (const PedPartition* part,
+amiga_partition_is_flag_available (const PedPartition* part __attribute__((unused)),
 				 PedPartitionFlag flag)
 {
 	switch (flag) {
@@ -1112,13 +1112,13 @@ error:
 }
 
 static int
-amiga_get_max_primary_partition_count (const PedDisk* disk)
+amiga_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return AMIGA_MAX_PARTITIONS;
 }
 
 static bool
-amiga_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+amiga_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = AMIGA_MAX_PARTITIONS;
 	return true;
diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c
index 245208e..b76c46e 100644
--- a/libparted/labels/sun.c
+++ b/libparted/labels/sun.c
@@ -677,7 +677,7 @@ sun_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)

 static int
-sun_partition_is_flag_available (const PedPartition* part,
+sun_partition_is_flag_available (const PedPartition* part __attribute__((unused)),
 				 PedPartitionFlag flag)
 {
 	switch (flag) {
@@ -693,14 +693,14 @@ sun_partition_is_flag_available (const PedPartition* part,
 }
 
 static bool
-sun_get_max_supported_partition_count (const PedDisk* disk, int *max_n)
+sun_get_max_supported_partition_count (const PedDisk* disk __attribute__((unused)), int *max_n)
 {
 	*max_n = SUN_DISK_MAXPARTITIONS;
 	return true;
 }
 
 static int
-sun_get_max_primary_partition_count (const PedDisk* disk)
+sun_get_max_primary_partition_count (const PedDisk* disk __attribute__((unused)))
 {
 	return SUN_DISK_MAXPARTITIONS;
 }
diff --git a/parted/parted.c b/parted/parted.c
index b20d432..d01329f 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -469,7 +469,7 @@ print_options_help ()
 }
 
 int
-do_help (PedDevice** dev)
+do_help (PedDevice** dev __attribute__((unused)))
 {
         if (command_line_get_word_count ()) {
                 char*   word = command_line_pop_word ();
@@ -887,7 +887,7 @@ partition_print_flags (PedPartition const *part)
 }
 
 static int
-partition_print (PedPartition* part)
+partition_print (PedPartition* part __attribute__((unused)))
 {
         return 1;
 }
@@ -1683,7 +1683,7 @@ do_toggle (PedDevice **dev)
 }
 
 static int
-do_unit (PedDevice** dev)
+do_unit (PedDevice** dev __attribute__((unused)))
 {
         PedUnit unit = ped_unit_get_default ();
         if (!command_line_get_unit (_("Unit?"), &unit))
diff --git a/parted/table.c b/parted/table.c
index 6c08fd1..4a31c4e 100644
--- a/parted/table.c
+++ b/parted/table.c
@@ -169,8 +169,9 @@ void table_add_row_from_strlist (Table* t, StrList* list)
 static void table_render_row (Table* t, int rownum, int ncols, wchar_t** s)
 {
         wchar_t** row = t->rows[rownum];
-        size_t len = 1, i;
+        size_t len = 1;
         size_t newsize;
+	int i;
 
         assert(t);
         assert(s != NULL);
diff --git a/parted/ui.c b/parted/ui.c
index 786deed..be93ea9 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -327,7 +327,7 @@ reset_env (int quit)
 
 /* Signal handler for SIGINT using 'sigaction'. */
 static void
-sa_sigint_handler (int signum, siginfo_t* info, void *ucontext)
+sa_sigint_handler (int signum __attribute__((unused)), siginfo_t* info, void *ucontext __attribute__((unused)))
 {
         if (info)
                 sigaction (SIGINT, &sig_int, NULL);
@@ -338,7 +338,7 @@ sa_sigint_handler (int signum, siginfo_t* info, void *ucontext)
 
 /* Signal handler for SIGSEGV using 'sigaction'. */
 static void
-sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
+sa_sigsegv_handler (int signum __attribute__((unused)), siginfo_t* info, void* ucontext __attribute__((unused)))
 {
         fprintf (stderr, bug_msg, VERSION);
         _dump_history ();
@@ -373,7 +373,7 @@ sa_sigsegv_handler (int signum, siginfo_t* info, void* ucontext)
 
 /* Signal handler for SIGFPE using 'sigaction'. */
 static void
-sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
+sa_sigfpe_handler (int signum __attribute__((unused)), siginfo_t* info, void* ucontext __attribute__((unused)))
 {
         fprintf (stderr, bug_msg, VERSION);
         _dump_history ();
@@ -437,7 +437,7 @@ sa_sigfpe_handler (int signum, siginfo_t* info, void* ucontext)
 
 /* Signal handler for SIGILL using 'sigaction'. */
 static void
-sa_sigill_handler (int signum, siginfo_t* info, void* ucontext)
+sa_sigill_handler (int signum __attribute__((unused)), siginfo_t* info, void* ucontext __attribute__((unused)))
 {
         fprintf (stderr, bug_msg, VERSION);
         _dump_history ();
-- 
1.7.8.2