mirror of
https://github.com/vivier/EMILE.git
synced 2025-04-06 21:37:06 +00:00
to remove warning on signedness with gcc 4, cast some parameters
This commit is contained in:
parent
eb3cf75e0c
commit
8f419ba4b1
@ -24,11 +24,11 @@ int emile_first_get_param(int fd, int *drive_num, int *second_offset,
|
||||
if (ret != sizeof(firstBlock))
|
||||
return EEMILE_CANNOT_READ_FIRST;
|
||||
|
||||
if ( strncmp( firstBlock.boot_block_header.SysName+1,
|
||||
if ( strncmp( (char*)firstBlock.boot_block_header.SysName+1,
|
||||
"Mac Bootloader", 14) == 0 )
|
||||
{
|
||||
*drive_num = read_short(&firstBlock.second_param_block.ioVRefNum);
|
||||
*second_offset = read_long(&firstBlock.second_param_block.ioPosOffset);
|
||||
*drive_num = read_short((u_int16_t*)&firstBlock.second_param_block.ioVRefNum);
|
||||
*second_offset = read_long((u_int32_t*)&firstBlock.second_param_block.ioPosOffset);
|
||||
*second_size = read_long(&firstBlock.second_param_block.ioReqCount);
|
||||
}
|
||||
else
|
||||
|
@ -29,15 +29,15 @@ int emile_first_set_param(int fd, unsigned short tune_mask, int drive_num,
|
||||
if (ret != sizeof(firstBlock))
|
||||
return EEMILE_CANNOT_READ_FIRST;
|
||||
|
||||
if ( strncmp( firstBlock.boot_block_header.SysName+1,
|
||||
if ( strncmp( (char*)firstBlock.boot_block_header.SysName+1,
|
||||
"Mac Bootloader", 14) == 0 )
|
||||
{
|
||||
if (tune_mask & EMILE_FIRST_TUNE_DRIVE)
|
||||
write_short(&firstBlock.second_param_block.ioVRefNum,
|
||||
write_short((u_int16_t*)&firstBlock.second_param_block.ioVRefNum,
|
||||
drive_num);
|
||||
|
||||
if (tune_mask & EMILE_FIRST_TUNE_OFFSET)
|
||||
write_long(&firstBlock.second_param_block.ioPosOffset,
|
||||
write_long((u_int32_t*)&firstBlock.second_param_block.ioPosOffset,
|
||||
second_offset);
|
||||
|
||||
if (tune_mask & EMILE_FIRST_TUNE_SIZE)
|
||||
|
@ -65,18 +65,18 @@ int emile_first_set_param_scsi(int fd, char *second_name)
|
||||
for(i = 0; i < max_blocks - 1; i++)
|
||||
{
|
||||
current -= 2;
|
||||
count = (short*)(&first[current]);
|
||||
count = (unsigned short*)(&first[current]);
|
||||
*count = container->blocks[i].count;
|
||||
if (container->blocks[i].count == 0)
|
||||
break;
|
||||
current -= 4;
|
||||
offset = (long*)(&first[current]);
|
||||
offset = (unsigned long*)(&first[current]);
|
||||
*offset = container->blocks[i].offset;
|
||||
(*second_size) += container->blocks[i].count;
|
||||
}
|
||||
/* mark end of blocks list */
|
||||
current -= 2;
|
||||
count = (short*)(&first[current]);
|
||||
count = (unsigned short*)(&first[current]);
|
||||
*count = 0;
|
||||
/* set second level size */
|
||||
(*second_size) *= BLOCK_SIZE;
|
||||
|
@ -27,7 +27,7 @@ int emile_map_bootblock_read(emile_map_t* map, char* bootblock)
|
||||
fd = open(map->name, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
offset = read_long(&map->partition.PyPartStart) * 512;
|
||||
offset = read_long((u_int32_t*)&map->partition.PyPartStart) * 512;
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
|
||||
ret = read(fd, bootblock, BOOTBLOCK_SIZE);
|
||||
|
@ -14,8 +14,8 @@ int emile_map_geometry(emile_map_t *map, int *block_size, int *block_count)
|
||||
if (!emile_map_is_valid(map))
|
||||
return -1;
|
||||
|
||||
*block_size = read_short(&map->drivers.BlkSize);
|
||||
*block_count = read_long(&map->drivers.BlkCount);
|
||||
*block_size = read_short((u_int16_t*)&map->drivers.BlkSize);
|
||||
*block_count = read_long((u_int32_t*)&map->drivers.BlkCount);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,11 +18,11 @@ int emile_map_get_bootinfo(emile_map_t *map, int* bootstart, int *bootsize,
|
||||
if (!emile_map_is_valid(map))
|
||||
return -1;
|
||||
|
||||
*bootstart = read_long(&map->partition.LgBootStart);
|
||||
*bootsize = read_long(&map->partition.BootSize);
|
||||
*bootaddr = read_long(&map->partition.BootAddr);
|
||||
*bootentry = read_long(&map->partition.BootEntry);
|
||||
*checksum = read_long(&map->partition.BootCksum);
|
||||
*bootstart = read_long((u_int32_t*)&map->partition.LgBootStart);
|
||||
*bootsize = read_long((u_int32_t*)&map->partition.BootSize);
|
||||
*bootaddr = read_long((u_int32_t*)&map->partition.BootAddr);
|
||||
*bootentry = read_long((u_int32_t*)&map->partition.BootEntry);
|
||||
*checksum = read_long((u_int32_t*)&map->partition.BootCksum);
|
||||
strcpy(processor, map->partition.Processor);
|
||||
|
||||
return 0;
|
||||
|
@ -18,9 +18,9 @@ int emile_map_get_driver_info(emile_map_t *map, int number,
|
||||
if (number > emile_map_get_driver_number(map))
|
||||
return -1;
|
||||
|
||||
*block = read_long(&map->drivers.DrvInfo[number].Block);
|
||||
*size = read_short(&map->drivers.DrvInfo[number].Size);
|
||||
*type = read_short(&map->drivers.DrvInfo[number].Type);
|
||||
*block = read_long((u_int32_t*)&map->drivers.DrvInfo[number].Block);
|
||||
*size = read_short((u_int16_t*)&map->drivers.DrvInfo[number].Size);
|
||||
*type = read_short((u_int16_t*)&map->drivers.DrvInfo[number].Type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,5 +14,5 @@ int emile_map_get_driver_number(emile_map_t *map)
|
||||
if (!emile_map_is_valid(map))
|
||||
return -1;
|
||||
|
||||
return read_short(&map->drivers.DrvrCount);
|
||||
return read_short((u_int16_t*)&map->drivers.DrvrCount);
|
||||
}
|
||||
|
@ -14,5 +14,5 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
|
||||
int emile_map_get_number(emile_map_t *map)
|
||||
{
|
||||
return read_long(&map->partition.MapBlkCnt);
|
||||
return read_long((u_int32_t*)&map->partition.MapBlkCnt);
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ int emile_map_get_partition_geometry(emile_map_t *map, int *start, int *count)
|
||||
if (!emile_map_partition_is_valid(map))
|
||||
return -1;
|
||||
|
||||
*start = read_long(&map->partition.PyPartStart);
|
||||
*count = read_long(&map->partition.PartBlkCnt);
|
||||
*start = read_long((u_int32_t*)&map->partition.PyPartStart);
|
||||
*count = read_long((u_int32_t*)&map->partition.PartBlkCnt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
|
||||
int emile_map_is_valid(emile_map_t *map)
|
||||
{
|
||||
return read_short(&map->drivers.Sig) == DD_SIGNATURE;
|
||||
return read_short((u_int16_t*)&map->drivers.Sig) == DD_SIGNATURE;
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
|
||||
int emile_map_partition_get_flags(emile_map_t *map)
|
||||
{
|
||||
return read_long(&map->partition.PartStatus);
|
||||
return read_long((u_int32_t*)&map->partition.PartStatus);
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
|
||||
int emile_map_partition_is_valid(emile_map_t *map)
|
||||
{
|
||||
return read_short(&map->partition.Sig) == MAP_SIGNATURE;
|
||||
return read_short((u_int16_t*)&map->partition.Sig) == MAP_SIGNATURE;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
|
||||
|
||||
int emile_map_partition_set_flags(emile_map_t *map, int flags)
|
||||
{
|
||||
write_long(&map->partition.PartStatus, flags);
|
||||
write_long((u_int32_t*)&map->partition.PartStatus, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ int emile_map_read(emile_map_t *map, int part)
|
||||
if (map->current == part)
|
||||
return part;
|
||||
|
||||
if (part > read_long(&map->partition.MapBlkCnt))
|
||||
if (part > read_long((u_int32_t*)&map->partition.MapBlkCnt))
|
||||
return -1;
|
||||
|
||||
offset = part * sizeof(struct Partition) + sizeof(struct DriverDescriptor);
|
||||
|
@ -18,11 +18,11 @@ int emile_map_set_bootinfo(emile_map_t *map, int bootstart, int bootsize,
|
||||
if (!emile_map_is_valid(map))
|
||||
return -1;
|
||||
|
||||
write_long(&map->partition.LgBootStart, bootstart);
|
||||
write_long(&map->partition.BootSize, bootsize);
|
||||
write_long(&map->partition.BootAddr, bootaddr);
|
||||
write_long(&map->partition.BootEntry, bootentry);
|
||||
write_long(&map->partition.BootCksum, checksum);
|
||||
write_long((u_int32_t*)&map->partition.LgBootStart, bootstart);
|
||||
write_long((u_int32_t*)&map->partition.BootSize, bootsize);
|
||||
write_long((u_int32_t*)&map->partition.BootAddr, bootaddr);
|
||||
write_long((u_int32_t*)&map->partition.BootEntry, bootentry);
|
||||
write_long((u_int32_t*)&map->partition.BootCksum, checksum);
|
||||
memset(map->partition.Processor, 0, sizeof(map->partition.Processor));
|
||||
strcpy(map->partition.Processor, processor);
|
||||
|
||||
|
@ -18,9 +18,9 @@ int emile_map_set_driver_info(emile_map_t *map, int number,
|
||||
if (number >= DD_MAX_DRIVER)
|
||||
return -1;
|
||||
|
||||
write_long(&map->drivers.DrvInfo[number].Block, block);
|
||||
write_short(&map->drivers.DrvInfo[number].Size, size);
|
||||
write_short(&map->drivers.DrvInfo[number].Type, type);
|
||||
write_long((u_int32_t*)&map->drivers.DrvInfo[number].Block, block);
|
||||
write_short((u_int16_t*)&map->drivers.DrvInfo[number].Size, size);
|
||||
write_short((u_int16_t*)&map->drivers.DrvInfo[number].Type, type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ int emile_map_set_driver_number(emile_map_t *map, int number)
|
||||
if (number >= DD_MAX_DRIVER)
|
||||
return -1;
|
||||
|
||||
write_short(&map->drivers.DrvrCount, number);
|
||||
write_short((u_int16_t*)&map->drivers.DrvrCount, number);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ static int get_scsi_path(int fd, unsigned char *host, unsigned char *channel,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int get_device_info(int fd, short *id, unsigned long *first_block,
|
||||
static int get_device_info(int fd, unsigned short *id, unsigned long *first_block,
|
||||
int *block_size)
|
||||
{
|
||||
int ret;
|
||||
@ -101,7 +101,7 @@ static int get_device_info(int fd, short *id, unsigned long *first_block,
|
||||
return -1; \
|
||||
}
|
||||
|
||||
int emile_scsi_create_container(int fd, short *unit_id,
|
||||
int emile_scsi_create_container(int fd, unsigned short *unit_id,
|
||||
struct emile_container* container, int maxblocks)
|
||||
{
|
||||
int ret;
|
||||
|
@ -15,12 +15,12 @@
|
||||
|
||||
#include "libemile.h"
|
||||
|
||||
struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfile, char* kernel)
|
||||
struct emile_container *emile_second_create_mapfile(unsigned short *unit_id, char *mapfile, char* kernel)
|
||||
{
|
||||
struct emile_container *container;
|
||||
int fd;
|
||||
int ret;
|
||||
short unit_id_map;
|
||||
unsigned short unit_id_map;
|
||||
int block_size;
|
||||
|
||||
/* create container of the kernel */
|
||||
|
@ -82,12 +82,12 @@ extern int emile_first_set_param_scsi_extents(int fd,
|
||||
int drive_num, int second_offset,
|
||||
int second_size,
|
||||
int blocksize);
|
||||
struct emile_container *emile_second_create_mapfile(short *unit_id, char *mapfile, char* kernel);
|
||||
struct emile_container *emile_second_create_mapfile(unsigned short *unit_id, char *mapfile, char* kernel);
|
||||
extern int emile_is_url(char *path);
|
||||
extern int emile_floppy_create_image(char* first_level, char* second_level,
|
||||
char* kernel_image, char* ramdisk,
|
||||
char* image);
|
||||
extern int emile_scsi_create_container(int fd, short *unit_id,
|
||||
extern int emile_scsi_create_container(int fd, unsigned short *unit_id,
|
||||
struct emile_container* container, int maxbloks);
|
||||
extern emile_map_t* emile_map_open(char* dev, int flags);
|
||||
extern void emile_map_close(emile_map_t *map);
|
||||
|
Loading…
x
Reference in New Issue
Block a user