diff options
| author | Martin Pitt <martin.pitt@ubuntu.com> | 2010-10-21 09:33:00 +0200 |
|---|---|---|
| committer | Martin Pitt <martin.pitt@ubuntu.com> | 2010-10-21 09:33:00 +0200 |
| commit | 5d07c97811138fa1542dd09f3178dad812b81a23 (patch) | |
| tree | bc194a3acd5cacbea0bc0902f7b7036fcdb7bba0 | |
| parent | 0b4189b6d34d9ad1318381410e0d27edd10b7c62 (diff) | |
partutil: Explicitly use PART_TYPE_UNKNOWN
Previously we were comparing PartitionScheme values against the undefined enum
value -1, which causes a warning with gcc 4.5. Define -1 explicitly as
"PART_TYPE_UNKNOWN" and only use that in the code, which is cleaner.
Thanks to Marti Raudsepp for pointing this out!
| -rw-r--r-- | src/helpers/partutil.c | 4 | ||||
| -rw-r--r-- | src/helpers/partutil.h | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/helpers/partutil.c b/src/helpers/partutil.c index 63d3422..ecec84c 100644 --- a/src/helpers/partutil.c +++ b/src/helpers/partutil.c @@ -1410,7 +1410,7 @@ part_add_change_partition (char *device_file, DEBUG ("In part_add_partition: device_file=%s, start=%lld, size=%lld, type=%s", device_file, start, size, type); } - scheme = -1; + scheme = PART_TYPE_UNKNOWN; if (is_change) { PartitionTable *p; @@ -1456,7 +1456,7 @@ part_add_change_partition (char *device_file, /* now that we know the partitoning scheme, sanity check type and flags */ switch (scheme) { - case -1: + case PART_TYPE_UNKNOWN: /* unknown partition table format; error out if any type, label or flags are given */ if ((flags != NULL && flags[0] != NULL)) { diff --git a/src/helpers/partutil.h b/src/helpers/partutil.h index cbd8c9b..ffa4a22 100644 --- a/src/helpers/partutil.h +++ b/src/helpers/partutil.h @@ -32,6 +32,7 @@ /* Partition schemes understood by this library */ typedef enum { + PART_TYPE_UNKNOWN = -1, PART_TYPE_MSDOS = 0, PART_TYPE_MSDOS_EXTENDED = 1, PART_TYPE_APPLE = 2, |
