New prototype for test_ISO()

This commit is contained in:
Christophe Grenier 2016-01-23 10:14:22 +01:00
parent 100811e8e4
commit 1f85a5da9a

View file

@ -37,14 +37,13 @@
#include "log.h"
#include "guid_cpy.h"
static int set_ISO_info(const struct iso_primary_descriptor *iso, partition_t *partition);
static void set_ISO_info(const struct iso_primary_descriptor *iso, partition_t *partition);
static int test_ISO(const struct iso_primary_descriptor *iso, partition_t *partition)
static int test_ISO(const struct iso_primary_descriptor *iso)
{
static const unsigned char iso_header[6]= { 0x01, 'C', 'D', '0', '0', '1'};
if(memcmp(iso, iso_header, sizeof(iso_header))!=0)
return 1;
partition->upart_type=UP_ISO;
return 0;
}
@ -56,7 +55,7 @@ int check_ISO(disk_t *disk_car, partition_t *partition)
free(buffer);
return 1;
}
if(test_ISO((struct iso_primary_descriptor*)buffer, partition)!=0)
if(test_ISO((struct iso_primary_descriptor*)buffer)!=0)
{
free(buffer);
return 1;
@ -66,12 +65,13 @@ int check_ISO(disk_t *disk_car, partition_t *partition)
return 0;
}
static int set_ISO_info(const struct iso_primary_descriptor *iso, partition_t *partition)
static void set_ISO_info(const struct iso_primary_descriptor *iso, partition_t *partition)
{
const unsigned int volume_space_size=iso->volume_space_size[0] | (iso->volume_space_size[1]<<8) | (iso->volume_space_size[2]<<16) | (iso->volume_space_size[3]<<24);
const unsigned int volume_space_size2=iso->volume_space_size[7] | (iso->volume_space_size[6]<<8) | (iso->volume_space_size[5]<<16) | (iso->volume_space_size[4]<<24);
const unsigned int logical_block_size=iso->logical_block_size[0] | (iso->logical_block_size[1]<<8);
const unsigned int logical_block_size2=iso->logical_block_size[3] | (iso->logical_block_size[2]<<8);
partition->upart_type=UP_ISO;
set_part_name_chomp(partition, (const unsigned char*)iso->volume_id, 32);
if(volume_space_size==volume_space_size2 && logical_block_size==logical_block_size2)
{
@ -81,12 +81,11 @@ static int set_ISO_info(const struct iso_primary_descriptor *iso, partition_t *p
}
else
snprintf(partition->info, sizeof(partition->info), "ISO");
return 0;
}
int recover_ISO(const struct iso_primary_descriptor *iso, partition_t *partition)
{
if(test_ISO(iso, partition)!=0)
if(test_ISO(iso)!=0)
return 1;
set_ISO_info(iso, partition);
{