[parted-devel] FAT_TYPE_FAT12 not handled in many switches
Jim Meyering
jim at meyering.net
Thu Feb 15 17:52:55 CET 2007
There are several warnings about this:
table.c: In function '_test_code_bad':
table.c:209: warning: enumeration value 'FAT_TYPE_FAT12' not handled in switch
However, there are a few switch stmts that *do* handle that enum value.
Do any of you know how best to avoid those warnings?
- handle FAT_TYPE_FAT12 like FAT_TYPE_FAT16, as is done
at least once in each of table.c and traverse.c.
or
- fall through (e.g., default: break, or FAT_TYPE_FAT12: break),
which is equivalent to what the current code does, yet will
avoid the warning.
Two examples:
==========================================
static int
_test_code_bad (const FatTable* ft, FatCluster code)
{
switch (ft->fat_type) {
case FAT_TYPE_FAT16:
if (code == 0xfff7) return 1;
break;
case FAT_TYPE_FAT32:
if (code == 0x0ffffff7) return 1;
break;
}
return 0;
}
static int
_test_code_eof (const FatTable* ft, FatCluster code)
{
switch (ft->fat_type) {
case FAT_TYPE_FAT16:
if (code >= 0xfff7) return 1;
break;
case FAT_TYPE_FAT32:
if (code >= 0x0ffffff7) return 1;
break;
}
return 0;
}
More information about the parted-devel
mailing list