2009-06-10 Pavel Roskin <proski@gnu.org>
* kern/file.c (grub_file_read): Use void pointer for the buffer. Adjust all callers.
This commit is contained in:
parent
27d5fef717
commit
5c5215d5e2
22 changed files with 59 additions and 56 deletions
|
@ -49,7 +49,7 @@ grub_aout_load (grub_file_t file, int offset,
|
|||
if (!load_size)
|
||||
load_size = file->size - offset;
|
||||
|
||||
grub_file_read (file, (char *) load_addr, load_size);
|
||||
grub_file_read (file, (void *) load_addr, load_size);
|
||||
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
|
|
|
@ -636,7 +636,7 @@ grub_bsd_load_aout (grub_file_t file)
|
|||
if ((grub_file_seek (file, 0)) == (grub_off_t) - 1)
|
||||
return grub_errno;
|
||||
|
||||
if (grub_file_read (file, (char *) &ah, sizeof (ah)) != sizeof (ah))
|
||||
if (grub_file_read (file, &ah, sizeof (ah)) != sizeof (ah))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "cannot read the a.out header");
|
||||
|
||||
if (grub_aout_get_type (&ah) != AOUT_TYPE_AOUT32)
|
||||
|
@ -988,7 +988,7 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
grub_file_read (file, (char *) kern_end, file->size);
|
||||
grub_file_read (file, (void *) kern_end, file->size);
|
||||
if ((!grub_errno) &&
|
||||
(!grub_freebsd_add_meta_module (0, argc, argv, kern_end, file->size)))
|
||||
kern_end = ALIGN_PAGE (kern_end + file->size);
|
||||
|
|
|
@ -616,7 +616,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! file)
|
||||
goto fail;
|
||||
|
||||
if (grub_file_read (file, (char *) &lh, sizeof (lh)) != sizeof (lh))
|
||||
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read the linux header");
|
||||
goto fail;
|
||||
|
@ -851,7 +851,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
len = prot_size;
|
||||
if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
|
||||
if (grub_file_read (file, (void *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
|
|
|
@ -163,7 +163,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! file)
|
||||
goto fail;
|
||||
|
||||
if (grub_file_read (file, (char *) &lh, sizeof (lh)) != sizeof (lh))
|
||||
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read the linux header");
|
||||
goto fail;
|
||||
|
@ -257,7 +257,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
|
||||
initrd_size = grub_file_size (file);
|
||||
if (grub_file_read (file, (char *) GRUB_OFW_LINUX_INITRD_ADDR,
|
||||
if (grub_file_read (file, (void *) GRUB_OFW_LINUX_INITRD_ADDR,
|
||||
initrd_size) != (int) initrd_size)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
||||
|
|
|
@ -602,7 +602,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! file)
|
||||
goto fail;
|
||||
|
||||
if (grub_file_read (file, (char *) &lh, sizeof (lh)) != sizeof (lh))
|
||||
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read the linux header");
|
||||
goto fail;
|
||||
|
@ -838,7 +838,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
len = prot_size;
|
||||
if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
|
||||
if (grub_file_read (file, (void *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
|
|
|
@ -68,7 +68,7 @@ grub_chainloader_cmd (const char *filename, grub_chainloader_flags_t flags)
|
|||
goto fail;
|
||||
|
||||
/* Read the first block. */
|
||||
if (grub_file_read (file, (char *) 0x7C00, GRUB_DISK_SECTOR_SIZE)
|
||||
if (grub_file_read (file, (void *) 0x7C00, GRUB_DISK_SECTOR_SIZE)
|
||||
!= GRUB_DISK_SECTOR_SIZE)
|
||||
{
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
|
|
|
@ -79,7 +79,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (grub_file_read (file, (char *) &lh, sizeof (lh)) != sizeof (lh))
|
||||
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "cannot read the linux header");
|
||||
goto fail;
|
||||
|
@ -264,7 +264,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
len = prot_size;
|
||||
if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
|
||||
if (grub_file_read (file, (void *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
|
@ -361,7 +361,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (grub_file_read (file, (void *)addr, size) != size)
|
||||
if (grub_file_read (file, (void *) addr, size) != size)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
||||
goto fail;
|
||||
|
|
|
@ -51,7 +51,7 @@ grub_macho_parse32 (grub_macho_t macho)
|
|||
|
||||
/* Read header and check magic*/
|
||||
if (grub_file_seek (macho->file, macho->offset32) == (grub_off_t) -1
|
||||
|| grub_file_read (macho->file, (char *) &head, sizeof (head))
|
||||
|| grub_file_read (macho->file, &head, sizeof (head))
|
||||
!= sizeof(head))
|
||||
{
|
||||
grub_error (GRUB_ERR_READ_ERROR, "Cannot read Mach-O header.");
|
||||
|
@ -74,7 +74,7 @@ grub_macho_parse32 (grub_macho_t macho)
|
|||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "not enough memory to read commands");
|
||||
return;
|
||||
}
|
||||
if (grub_file_read (macho->file, (char *) macho->cmds32,
|
||||
if (grub_file_read (macho->file, macho->cmds32,
|
||||
(grub_size_t) macho->cmdsize32)
|
||||
!= (grub_ssize_t) macho->cmdsize32)
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ grub_macho_file (grub_file_t file)
|
|||
if (grub_file_seek (macho->file, 0) == (grub_off_t) -1)
|
||||
goto fail;
|
||||
|
||||
if (grub_file_read (macho->file, (char *) &filestart, sizeof (filestart))
|
||||
if (grub_file_read (macho->file, &filestart, sizeof (filestart))
|
||||
!= sizeof (filestart))
|
||||
{
|
||||
grub_error_push ();
|
||||
|
@ -322,7 +322,7 @@ grub_macho_file (grub_file_t file)
|
|||
archs = grub_malloc (sizeof (struct grub_macho_fat_arch) * narchs);
|
||||
if (!archs)
|
||||
goto fail;
|
||||
if (grub_file_read (macho->file, (char *) archs,
|
||||
if (grub_file_read (macho->file, archs,
|
||||
sizeof (struct grub_macho_fat_arch) * narchs)
|
||||
!= (grub_ssize_t)sizeof(struct grub_macho_fat_arch) * narchs)
|
||||
{
|
||||
|
|
|
@ -434,7 +434,7 @@ grub_module2 (int argc, char *argv[])
|
|||
|
||||
grub_dprintf ("loader", "Loading module at 0x%x - 0x%x\n", modaddr,
|
||||
modaddr + modsize);
|
||||
if (grub_file_read (file, (char *) modaddr, modsize) != modsize)
|
||||
if (grub_file_read (file, (void *) modaddr, modsize) != modsize)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
|
||||
goto out;
|
||||
|
|
|
@ -618,7 +618,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
|
|||
"Couldn't load driver package");
|
||||
|
||||
/* Sometimes caches are fat binary. Errgh. */
|
||||
if (grub_file_read (file, (char *) &head, sizeof (head))
|
||||
if (grub_file_read (file, &head, sizeof (head))
|
||||
!= (grub_ssize_t) (sizeof (head)))
|
||||
{
|
||||
/* I don't know the internal structure of package but
|
||||
|
@ -641,7 +641,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
|
|||
"Couldn't read file %s", args[0]);
|
||||
|
||||
}
|
||||
if (grub_file_read (file, (char *) archs,
|
||||
if (grub_file_read (file, archs,
|
||||
sizeof (struct grub_macho_fat_arch) * narchs)
|
||||
!= (grub_ssize_t) sizeof(struct grub_macho_fat_arch) * narchs)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ grub_xnu_resume (char *imagename)
|
|||
return 0;
|
||||
|
||||
/* Read the header. */
|
||||
if (grub_file_read (file, (char *) &hibhead, sizeof (hibhead))
|
||||
if (grub_file_read (file, &hibhead, sizeof (hibhead))
|
||||
!=sizeof (hibhead))
|
||||
{
|
||||
grub_file_close (file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue