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
|
@ -1,5 +1,8 @@
|
|||
2009-06-10 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* kern/file.c (grub_file_read): Use void pointer for the buffer.
|
||||
Adjust all callers.
|
||||
|
||||
* kern/ieee1275/openfw.c: Remove libc includes.
|
||||
* kern/ieee1275/cmain.c: Likewise.
|
||||
* include/grub/ieee1275/ieee1275.h: Likewise.
|
||||
|
|
|
@ -169,7 +169,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (file->size != 4)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid int10 dump size");
|
||||
else
|
||||
grub_file_read (file, (char *) 0x40, 4);
|
||||
grub_file_read (file, (void *) 0x40, 4);
|
||||
|
||||
grub_file_close (file);
|
||||
if (grub_errno)
|
||||
|
@ -185,7 +185,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid bios dump size");
|
||||
else if (enable_rom_area ())
|
||||
{
|
||||
grub_file_read (file, (char *) VBIOS_ADDR, size);
|
||||
grub_file_read (file, (void *) VBIOS_ADDR, size);
|
||||
fake_bios_data (size <= 0x40000);
|
||||
lock_rom_area ();
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (! file)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||
|
||||
if (grub_file_read (file, (void *) &tempo, sizeof(tempo)) != sizeof(tempo))
|
||||
if (grub_file_read (file, &tempo, sizeof(tempo)) != sizeof(tempo))
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_error (GRUB_ERR_FILE_READ_ERROR,
|
||||
|
@ -167,7 +167,7 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
||||
|
||||
while (grub_file_read (file, (void *) &buf,
|
||||
while (grub_file_read (file, &buf,
|
||||
sizeof (struct note)) == sizeof (struct note)
|
||||
&& buf.pitch != T_FINE && grub_checkkey () < 0)
|
||||
{
|
||||
|
|
14
font/font.c
14
font/font.c
|
@ -215,7 +215,7 @@ open_section (grub_file_t file, struct font_file_section *section)
|
|||
}
|
||||
|
||||
/* Read the big-endian 32-bit section length. */
|
||||
retval = grub_file_read (file, (char *) &raw_length, 4);
|
||||
retval = grub_file_read (file, &raw_length, 4);
|
||||
if (retval >= 0 && retval < 4)
|
||||
{
|
||||
/* EOF encountered. */
|
||||
|
@ -286,7 +286,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
struct char_index_entry *entry = &font->char_index[i];
|
||||
|
||||
/* Read code point value; convert to native byte order. */
|
||||
if (grub_file_read (file, (char *) &entry->code, 4) != 4)
|
||||
if (grub_file_read (file, &entry->code, 4) != 4)
|
||||
return 1;
|
||||
entry->code = grub_be_to_cpu32 (entry->code);
|
||||
|
||||
|
@ -302,11 +302,11 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
last_code = entry->code;
|
||||
|
||||
/* Read storage flags byte. */
|
||||
if (grub_file_read (file, (char *) &entry->storage_flags, 1) != 1)
|
||||
if (grub_file_read (file, &entry->storage_flags, 1) != 1)
|
||||
return 1;
|
||||
|
||||
/* Read glyph data offset; convert to native byte order. */
|
||||
if (grub_file_read (file, (char *) &entry->offset, 4) != 4)
|
||||
if (grub_file_read (file, &entry->offset, 4) != 4)
|
||||
return 1;
|
||||
entry->offset = grub_be_to_cpu32 (entry->offset);
|
||||
|
||||
|
@ -364,7 +364,7 @@ read_section_as_short (struct font_file_section *section, grub_int16_t *value)
|
|||
section->length);
|
||||
return 1;
|
||||
}
|
||||
if (grub_file_read (section->file, (char *) &raw_value, 2) != 2)
|
||||
if (grub_file_read (section->file, &raw_value, 2) != 2)
|
||||
return 1;
|
||||
|
||||
*value = grub_be_to_cpu16 (raw_value);
|
||||
|
@ -579,7 +579,7 @@ fail:
|
|||
static int
|
||||
read_be_uint16 (grub_file_t file, grub_uint16_t * value)
|
||||
{
|
||||
if (grub_file_read (file, (char *) value, 2) != 2)
|
||||
if (grub_file_read (file, value, 2) != 2)
|
||||
return 1;
|
||||
*value = grub_be_to_cpu16 (*value);
|
||||
return 0;
|
||||
|
@ -683,7 +683,7 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|||
/* Don't try to read empty bitmaps (e.g., space characters). */
|
||||
if (len != 0)
|
||||
{
|
||||
if (grub_file_read (font->file, (char *) glyph->bitmap, len) != len)
|
||||
if (grub_file_read (font->file, glyph->bitmap, len) != len)
|
||||
{
|
||||
remove_font (font);
|
||||
return 0;
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct grub_file *grub_file_t;
|
|||
char *EXPORT_FUNC(grub_file_get_device_name) (const char *name);
|
||||
|
||||
grub_file_t EXPORT_FUNC(grub_file_open) (const char *name);
|
||||
grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, char *buf,
|
||||
grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf,
|
||||
grub_size_t len);
|
||||
grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset);
|
||||
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
|
||||
|
|
|
@ -175,7 +175,7 @@ test_header (grub_file_t file)
|
|||
* (other than a real error with the disk) then we don't think it
|
||||
* is a compressed file, and simply mark it as such.
|
||||
*/
|
||||
if (grub_file_read (gzio->file, (char *) buf, 10) != 10
|
||||
if (grub_file_read (gzio->file, buf, 10) != 10
|
||||
|| ((*((grub_uint16_t *) buf) != GZIP_MAGIC)
|
||||
&& (*((grub_uint16_t *) buf) != OLD_GZIP_MAGIC)))
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ test_header (grub_file_t file)
|
|||
if (buf[2] != DEFLATED
|
||||
|| (buf[3] & UNSUPPORTED_FLAGS)
|
||||
|| ((buf[3] & EXTRA_FIELD)
|
||||
&& (grub_file_read (gzio->file, (char *) buf, 2) != 2
|
||||
&& (grub_file_read (gzio->file, buf, 2) != 2
|
||||
|| eat_field (gzio->file,
|
||||
grub_le_to_cpu16 (*((grub_uint16_t *) buf)))))
|
||||
|| ((buf[3] & ORIG_NAME) && eat_field (gzio->file, -1))
|
||||
|
@ -205,7 +205,7 @@ test_header (grub_file_t file)
|
|||
|
||||
grub_file_seek (gzio->file, grub_file_size (gzio->file) - 8);
|
||||
|
||||
if (grub_file_read (gzio->file, (char *) buf, 8) != 8)
|
||||
if (grub_file_read (gzio->file, buf, 8) != 8)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "unsupported gzip format");
|
||||
return 0;
|
||||
|
@ -367,7 +367,7 @@ get_byte (grub_file_t file)
|
|||
|| gzio->inbuf_d == INBUFSIZ)
|
||||
{
|
||||
gzio->inbuf_d = 0;
|
||||
grub_file_read (gzio->file, (char *) gzio->inbuf, INBUFSIZ);
|
||||
grub_file_read (gzio->file, gzio->inbuf, INBUFSIZ);
|
||||
}
|
||||
|
||||
return gzio->inbuf[gzio->inbuf_d++];
|
||||
|
|
|
@ -71,7 +71,7 @@ grub_elf_file (grub_file_t file)
|
|||
if (grub_file_seek (elf->file, 0) == (grub_off_t) -1)
|
||||
goto fail;
|
||||
|
||||
if (grub_file_read (elf->file, (char *) &elf->ehdr, sizeof (elf->ehdr))
|
||||
if (grub_file_read (elf->file, &elf->ehdr, sizeof (elf->ehdr))
|
||||
!= sizeof (elf->ehdr))
|
||||
{
|
||||
grub_error_push ();
|
||||
|
|
|
@ -111,7 +111,7 @@ grub_file_open (const char *name)
|
|||
}
|
||||
|
||||
grub_ssize_t
|
||||
grub_file_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
||||
{
|
||||
grub_ssize_t res;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -88,7 +88,7 @@ grub_jpeg_get_byte (struct grub_jpeg_data *data)
|
|||
grub_uint8_t r;
|
||||
|
||||
r = 0;
|
||||
grub_file_read (data->file, (char *) &r, 1);
|
||||
grub_file_read (data->file, &r, 1);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ grub_jpeg_get_word (struct grub_jpeg_data *data)
|
|||
grub_uint16_t r;
|
||||
|
||||
r = 0;
|
||||
grub_file_read (data->file, (char *) &r, sizeof (grub_uint16_t));
|
||||
grub_file_read (data->file, &r, sizeof (grub_uint16_t));
|
||||
|
||||
return grub_be_to_cpu16 (r);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
|
|||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"jpeg: too many huffman tables");
|
||||
|
||||
if (grub_file_read (data->file, (char *) &count, sizeof (count)) !=
|
||||
if (grub_file_read (data->file, &count, sizeof (count)) !=
|
||||
sizeof (count))
|
||||
return grub_errno;
|
||||
|
||||
|
@ -194,7 +194,7 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data)
|
|||
if (grub_errno)
|
||||
return grub_errno;
|
||||
|
||||
if (grub_file_read (data->file, (char *) data->huff_value[id], n) != n)
|
||||
if (grub_file_read (data->file, data->huff_value[id], n) != n)
|
||||
return grub_errno;
|
||||
|
||||
base = 0;
|
||||
|
@ -234,7 +234,7 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data)
|
|||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"jpeg: too many quantization tables");
|
||||
|
||||
if (grub_file_read (data->file, (char *) &data->quan_table[id], 64) != 64)
|
||||
if (grub_file_read (data->file, &data->quan_table[id], 64) != 64)
|
||||
return grub_errno;
|
||||
|
||||
if (data->file->offset != next_marker)
|
||||
|
|
|
@ -118,7 +118,7 @@ grub_png_get_dword (struct grub_png_data *data)
|
|||
grub_uint32_t r;
|
||||
|
||||
r = 0;
|
||||
grub_file_read (data->file, (char *) &r, sizeof (grub_uint32_t));
|
||||
grub_file_read (data->file, &r, sizeof (grub_uint32_t));
|
||||
|
||||
return grub_be_to_cpu32 (r);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ grub_png_get_byte (struct grub_png_data *data)
|
|||
}
|
||||
|
||||
r = 0;
|
||||
grub_file_read (data->file, (char *) &r, 1);
|
||||
grub_file_read (data->file, &r, 1);
|
||||
|
||||
if (data->inside_idat)
|
||||
data->idat_remain--;
|
||||
|
@ -781,7 +781,7 @@ grub_png_decode_png (struct grub_png_data *data)
|
|||
{
|
||||
grub_uint8_t magic[8];
|
||||
|
||||
if (grub_file_read (data->file, (char *) &magic[0], 8) != 8)
|
||||
if (grub_file_read (data->file, &magic[0], 8) != 8)
|
||||
return grub_errno;
|
||||
|
||||
if (grub_memcmp (magic, png_magic, sizeof (png_magic)))
|
||||
|
|
|
@ -98,7 +98,7 @@ tga_load_truecolor_rle_R8G8B8 (struct grub_video_bitmap *bitmap,
|
|||
|
||||
for (x = 0; x < header->image_width;)
|
||||
{
|
||||
if (grub_file_read (file, (char *)&type, sizeof (type)) != sizeof(type))
|
||||
if (grub_file_read (file, &type, sizeof (type)) != sizeof(type))
|
||||
return grub_errno;
|
||||
|
||||
if (type & 0x80)
|
||||
|
@ -107,7 +107,7 @@ tga_load_truecolor_rle_R8G8B8 (struct grub_video_bitmap *bitmap,
|
|||
type &= 0x7f;
|
||||
type++;
|
||||
|
||||
if (grub_file_read (file, (char *)&tmp[0], bytes_per_pixel)
|
||||
if (grub_file_read (file, &tmp[0], bytes_per_pixel)
|
||||
!= bytes_per_pixel)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -132,7 +132,7 @@ tga_load_truecolor_rle_R8G8B8 (struct grub_video_bitmap *bitmap,
|
|||
|
||||
while (type)
|
||||
{
|
||||
if (grub_file_read (file, (char *)&tmp[0], bytes_per_pixel)
|
||||
if (grub_file_read (file, &tmp[0], bytes_per_pixel)
|
||||
!= bytes_per_pixel)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -177,7 +177,7 @@ tga_load_truecolor_rle_R8G8B8A8 (struct grub_video_bitmap *bitmap,
|
|||
|
||||
for (x = 0; x < header->image_width;)
|
||||
{
|
||||
if (grub_file_read (file, (char *)&type, sizeof (type)) != sizeof(type))
|
||||
if (grub_file_read (file, &type, sizeof (type)) != sizeof(type))
|
||||
return grub_errno;
|
||||
|
||||
if (type & 0x80)
|
||||
|
@ -186,7 +186,7 @@ tga_load_truecolor_rle_R8G8B8A8 (struct grub_video_bitmap *bitmap,
|
|||
type &= 0x7f;
|
||||
type++;
|
||||
|
||||
if (grub_file_read (file, (char *)&tmp[0], bytes_per_pixel)
|
||||
if (grub_file_read (file, &tmp[0], bytes_per_pixel)
|
||||
!= bytes_per_pixel)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -212,7 +212,7 @@ tga_load_truecolor_rle_R8G8B8A8 (struct grub_video_bitmap *bitmap,
|
|||
|
||||
while (type)
|
||||
{
|
||||
if (grub_file_read (file, (char *)&tmp[0], bytes_per_pixel)
|
||||
if (grub_file_read (file, &tmp[0], bytes_per_pixel)
|
||||
!= bytes_per_pixel)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -257,7 +257,7 @@ tga_load_truecolor_R8G8B8 (struct grub_video_bitmap *bitmap,
|
|||
|
||||
for (x = 0; x < header->image_width; x++)
|
||||
{
|
||||
if (grub_file_read (file, (char *)&tmp[0], bytes_per_pixel)
|
||||
if (grub_file_read (file, &tmp[0], bytes_per_pixel)
|
||||
!= bytes_per_pixel)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -294,7 +294,7 @@ tga_load_truecolor_R8G8B8A8 (struct grub_video_bitmap *bitmap,
|
|||
|
||||
for (x = 0; x < header->image_width; x++)
|
||||
{
|
||||
if (grub_file_read (file, (char *)&tmp[0], bytes_per_pixel)
|
||||
if (grub_file_read (file, &tmp[0], bytes_per_pixel)
|
||||
!= bytes_per_pixel)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -327,7 +327,7 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap,
|
|||
not going to support developer area & extensions at this point. */
|
||||
|
||||
/* Read TGA header from beginning of file. */
|
||||
if (grub_file_read (file, (char*)&header, sizeof (header))
|
||||
if (grub_file_read (file, &header, sizeof (header))
|
||||
!= sizeof (header))
|
||||
{
|
||||
grub_file_close (file);
|
||||
|
|
Loading…
Reference in a new issue