[2296] 2009-06-10 Pavel Roskin <[email protected]>

Pavel Roskin <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2296
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2296
Author:   proski
Date:     2009-06-10 23:47:49 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
2009-06-10  Pavel Roskin  <[email protected]>

	* kern/file.c (grub_file_read): Use void pointer for the buffer.
	Adjust all callers.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/commands/efi/loadbios.c
    trunk/grub2/commands/i386/pc/play.c
    trunk/grub2/font/font.c
    trunk/grub2/include/grub/file.h
    trunk/grub2/io/gzio.c
    trunk/grub2/kern/elf.c
    trunk/grub2/kern/file.c
    trunk/grub2/loader/aout.c
    trunk/grub2/loader/i386/bsd.c
    trunk/grub2/loader/i386/efi/linux.c
    trunk/grub2/loader/i386/ieee1275/linux.c
    trunk/grub2/loader/i386/linux.c
    trunk/grub2/loader/i386/pc/chainloader.c
    trunk/grub2/loader/i386/pc/linux.c
    trunk/grub2/loader/macho.c
    trunk/grub2/loader/multiboot2.c
    trunk/grub2/loader/xnu.c
    trunk/grub2/loader/xnu_resume.c
    trunk/grub2/video/readers/jpeg.c
    trunk/grub2/video/readers/png.c
    trunk/grub2/video/readers/tga.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/ChangeLog	2009-06-10 23:47:49 UTC (rev 2296)
@@ -1,5 +1,8 @@
 2009-06-10  Pavel Roskin  <[email protected]>
 
+	* 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.

Modified: trunk/grub2/commands/efi/loadbios.c
===================================================================
--- trunk/grub2/commands/efi/loadbios.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/commands/efi/loadbios.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -169,7 +169,7 @@
       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_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 ();
     }

Modified: trunk/grub2/commands/i386/pc/play.c
===================================================================
--- trunk/grub2/commands/i386/pc/play.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/commands/i386/pc/play.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -158,7 +158,7 @@
   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_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)
     {

Modified: trunk/grub2/font/font.c
===================================================================
--- trunk/grub2/font/font.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/font/font.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -215,7 +215,7 @@
     }
 
   /* 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 @@
       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 @@
       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 @@
                   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 @@
 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 @@
       /* 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;

Modified: trunk/grub2/include/grub/file.h
===================================================================
--- trunk/grub2/include/grub/file.h	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/include/grub/file.h	2009-06-10 23:47:49 UTC (rev 2296)
@@ -52,7 +52,7 @@
 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);

Modified: trunk/grub2/io/gzio.c
===================================================================
--- trunk/grub2/io/gzio.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/io/gzio.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -175,7 +175,7 @@
    *  (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 @@
   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 @@
 
   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 @@
       || 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++];

Modified: trunk/grub2/kern/elf.c
===================================================================
--- trunk/grub2/kern/elf.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/kern/elf.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -71,7 +71,7 @@
   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 ();

Modified: trunk/grub2/kern/file.c
===================================================================
--- trunk/grub2/kern/file.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/kern/file.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -111,7 +111,7 @@
 }
 
 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;
 

Modified: trunk/grub2/loader/aout.c
===================================================================
--- trunk/grub2/loader/aout.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/aout.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -49,7 +49,7 @@
   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;

Modified: trunk/grub2/loader/i386/bsd.c
===================================================================
--- trunk/grub2/loader/i386/bsd.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/i386/bsd.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -636,7 +636,7 @@
   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 @@
       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);

Modified: trunk/grub2/loader/i386/efi/linux.c
===================================================================
--- trunk/grub2/loader/i386/efi/linux.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/i386/efi/linux.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -616,7 +616,7 @@
   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 @@
     }
 
   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)

Modified: trunk/grub2/loader/i386/ieee1275/linux.c
===================================================================
--- trunk/grub2/loader/i386/ieee1275/linux.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/i386/ieee1275/linux.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -163,7 +163,7 @@
   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 @@
     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");

Modified: trunk/grub2/loader/i386/linux.c
===================================================================
--- trunk/grub2/loader/i386/linux.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/i386/linux.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -602,7 +602,7 @@
   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 @@
     }
 
   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)

Modified: trunk/grub2/loader/i386/pc/chainloader.c
===================================================================
--- trunk/grub2/loader/i386/pc/chainloader.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/i386/pc/chainloader.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -68,7 +68,7 @@
     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)

Modified: trunk/grub2/loader/i386/pc/linux.c
===================================================================
--- trunk/grub2/loader/i386/pc/linux.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/i386/pc/linux.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -79,7 +79,7 @@
       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 @@
     }
 
   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 @@
       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;

Modified: trunk/grub2/loader/macho.c
===================================================================
--- trunk/grub2/loader/macho.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/macho.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -51,7 +51,7 @@
 
   /* 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_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 @@
   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 @@
       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)
 	{

Modified: trunk/grub2/loader/multiboot2.c
===================================================================
--- trunk/grub2/loader/multiboot2.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/multiboot2.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -434,7 +434,7 @@
 
   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;

Modified: trunk/grub2/loader/xnu.c
===================================================================
--- trunk/grub2/loader/xnu.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/xnu.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -618,7 +618,7 @@
 		       "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 @@
 			     "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)
 	{

Modified: trunk/grub2/loader/xnu_resume.c
===================================================================
--- trunk/grub2/loader/xnu_resume.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/loader/xnu_resume.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -55,7 +55,7 @@
     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);

Modified: trunk/grub2/video/readers/jpeg.c
===================================================================
--- trunk/grub2/video/readers/jpeg.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/video/readers/jpeg.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -88,7 +88,7 @@
   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_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 @@
     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 @@
   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 @@
     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)

Modified: trunk/grub2/video/readers/png.c
===================================================================
--- trunk/grub2/video/readers/png.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/video/readers/png.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -118,7 +118,7 @@
   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 @@
     }
 
   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_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)))

Modified: trunk/grub2/video/readers/tga.c
===================================================================
--- trunk/grub2/video/readers/tga.c	2009-06-10 23:25:10 UTC (rev 2295)
+++ trunk/grub2/video/readers/tga.c	2009-06-10 23:47:49 UTC (rev 2296)
@@ -98,7 +98,7 @@
 
       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 @@
               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 @@
 
               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 @@
 
       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 @@
               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 @@
 
               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 @@
 
       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 @@
 
       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 @@
      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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.