X-Git-Url: http://git.droids-corp.org/?p=protos%2Fimu.git;a=blobdiff_plain;f=partition.c;h=d4eb015d6885739fe9812868211ac6ee440ea7a7;hp=6c5d982b3d88dd7bc6bdb42a3a32368ed8a8fb18;hb=de6cbbfa24c5af2030ab1a46ee94bcc8b35910b9;hpb=8d98ff2833dbd04ec343be49c416166e523ad889 diff --git a/partition.c b/partition.c index 6c5d982..d4eb015 100644 --- a/partition.c +++ b/partition.c @@ -68,36 +68,36 @@ struct partition_struct* partition_open(device_read_t device_read, device_read_i uint8_t buffer[0x10]; if(!device_read || !device_read_interval || index >= 4) - return 0; + return 0; if(index >= 0) { - /* read specified partition table index */ - if(!device_read(0x01be + index * 0x10, buffer, sizeof(buffer))) - return 0; + /* read specified partition table index */ + if(!device_read(0x01be + index * 0x10, buffer, sizeof(buffer))) + return 0; - /* abort on empty partition entry */ - if(buffer[4] == 0x00) - return 0; + /* abort on empty partition entry */ + if(buffer[4] == 0x00) + return 0; } /* allocate partition descriptor */ #if USE_DYNAMIC_MEMORY new_partition = malloc(sizeof(*new_partition)); if(!new_partition) - return 0; + return 0; #else new_partition = partition_handles; uint8_t i; for(i = 0; i < PARTITION_COUNT; ++i) { - if(new_partition->type == PARTITION_TYPE_FREE) - break; + if(new_partition->type == PARTITION_TYPE_FREE) + break; - ++new_partition; + ++new_partition; } if(i >= PARTITION_COUNT) - return 0; + return 0; #endif memset(new_partition, 0, sizeof(*new_partition)); @@ -110,13 +110,13 @@ struct partition_struct* partition_open(device_read_t device_read, device_read_i if(index >= 0) { - new_partition->type = buffer[4]; - new_partition->offset = read32(&buffer[8]); - new_partition->length = read32(&buffer[12]); + new_partition->type = buffer[4]; + new_partition->offset = read32(&buffer[8]); + new_partition->length = read32(&buffer[12]); } else { - new_partition->type = 0xff; + new_partition->type = 0xff; } return new_partition; @@ -137,7 +137,7 @@ struct partition_struct* partition_open(device_read_t device_read, device_read_i uint8_t partition_close(struct partition_struct* partition) { if(!partition) - return 0; + return 0; /* destroy partition descriptor */ #if USE_DYNAMIC_MEMORY