On Thu, 2007-02-15 at 17:52 +0100, Jim Meyering wrote:
> 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.

See doc/FAT for examples.

>   - 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.

Don't do this.

> 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;
> }

Add:

case FAT_TYPE_FAT12:
if (code == 0xff0) return 1;
break;

> 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;
> }

Add:

case FAT_TYPE_FAT12:
if (code >= 0xff7) return 1;
break;

-- 
David Cantrell <[EMAIL PROTECTED]>
Red Hat / Westford, MA

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to