summaryrefslogtreecommitdiffstats
path: root/src/parti386.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-04-14 19:38:10 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2012-04-14 19:38:10 +0200
commit299e4f9a90f95779fd5b6cf256a0b01f97e06f0b (patch)
treecf0c0952c441b7e3929c62152cd753188dd68f07 /src/parti386.c
parentd0ca2dbb70ce9d166b057ba19ddaeb884d9c861a (diff)
Make set_next_status_i386() and set_prev_status_i386() C++ compatible
Diffstat (limited to 'src/parti386.c')
-rw-r--r--src/parti386.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/parti386.c b/src/parti386.c
index b63ab74..cbb04e4 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -1293,22 +1293,35 @@ list_part_t *add_partition_i386_cli(disk_t *disk_car, list_part_t *list_part, ch
static void set_next_status_i386(const disk_t *disk_car, partition_t *partition)
{
- if(partition->status==STATUS_LOG)
- partition->status=STATUS_DELETED;
- else
- partition->status++;
- if(partition->status==STATUS_LOG && parti386_can_be_ext(disk_car,partition)==0)
- partition->status=STATUS_DELETED;
+ /* STATUS_DELETED, STATUS_PRIM, STATUS_PRIM_BOOT, STATUS_LOG */
+ switch(partition->status)
+ {
+ case STATUS_PRIM_BOOT:
+ if(parti386_can_be_ext(disk_car,partition)!=0)
+ partition->status=STATUS_LOG;
+ else
+ partition->status=STATUS_DELETED;
+ break;
+ case STATUS_LOG: partition->status=STATUS_DELETED; break;
+ case STATUS_DELETED: partition->status=STATUS_PRIM; break;
+ default: partition->status=STATUS_PRIM_BOOT; break;
+ }
}
static void set_prev_status_i386(const disk_t *disk_car, partition_t *partition)
{
- if(partition->status==STATUS_DELETED)
- partition->status=STATUS_LOG;
- else
- partition->status--;
- if(partition->status==STATUS_LOG && parti386_can_be_ext(disk_car,partition)==0)
- partition->status--;
+ switch(partition->status)
+ {
+ case STATUS_DELETED:
+ if(parti386_can_be_ext(disk_car,partition)!=0)
+ partition->status=STATUS_LOG;
+ else
+ partition->status=STATUS_PRIM_BOOT;
+ break;
+ case STATUS_LOG: partition->status=STATUS_PRIM_BOOT; break;
+ case STATUS_PRIM_BOOT: partition->status=STATUS_PRIM; break;
+ default: partition->status=STATUS_DELETED; break;
+ }
}
static int set_part_type_i386(partition_t *partition, unsigned int part_type)