Otavio Salvador <[EMAIL PROTECTED]> wrote:

> Jim Meyering <[EMAIL PROTECTED]> writes:
>
>>  static int
>>  msdos_probe (const PedDevice *dev)
>>  {
>>      PedDiskType*    disk_type;
>> -    DosRawTable     part_table;
>> +    DosRawTable*    part_table;
>>      int             i;
>>
>>      PED_ASSERT (dev != NULL, return 0);
>>
>> -        if (dev->sector_size != 512)
>> +        if (dev->sector_size < sizeof *part_table)
>>                  return 0;
>
> Shouldn't it be sizeof(DosRawTable)? part_table points to a unkown
> place at this point or am I missing something?

No.  First, "*part_table" as an argument to sizeof doesn't
cause a dereference.  Rather it identifies the type that the
sizeof operator operates on.

FYI, using the variable name with sizeof is better coding
style (more maintainable) than using the type name.  And if you
did want to use a type there, it'd have to be "struct DosRawTable"
in this case.

>> -    if (!ped_device_read (dev, &part_table, 0, 1))
>> +    char *label;
>> +    if (!read_sector (dev, 0, &label))
>>              return 0;
>>
>> +        part_table = (DosRawTable *) label;
>> +
>
> Please, fix this indent to follow rest of file "standard" :(

Ok.

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

Reply via email to