Dnia niedziela 11 kwiecień 2010 o 21:30:17 Szymon Janc napisał(a):

> Attached is a small fix for xzio read to act in grub way, not posix like.

Attached patch fix a nasty seek bug introduced by previous fix. 
If You are brave enough to test xzio don't forget to apply this fix. 


-- 
Szymon K. Janc
szy...@janc.net.pl // GG: 1383435
=== modified file 'io/xzio.c'
--- io/xzio.c	2010-04-10 22:47:20 +0000
+++ io/xzio.c	2010-04-15 18:35:28 +0000
@@ -243,7 +243,7 @@
   enum xz_ret xzret;
   grub_xzio_t xzio = file->data;
   int offset_lock;
-  grub_uint8_t current_offset;
+  grub_off_t current_offset;
 
   /* If seek backward need to reset decoder and start from beginning of file.
      TODO Possible improvement by jumping blocks.  */
@@ -257,13 +257,13 @@
       grub_file_seek (xzio->file, 0);
     }
 
+  offset_lock = (file->offset == xzio->saved_offset) ? 1 : 0;
+  current_offset = xzio->saved_offset;
+
   while (len > 0)
     {
       xzio->buf.out_size = len >= XZBUFSIZ ? XZBUFSIZ : len;
 
-      offset_lock = (file->offset == xzio->saved_offset) ? 1 : 0;
-      current_offset = xzio->saved_offset;
-
       /* Feed input.  */
       if (xzio->buf.in_pos == xzio->buf.in_size)
 	{
@@ -298,7 +298,7 @@
 	}
       else
 	{
-	  grub_uint8_t new_offset = current_offset + xzio->buf.out_pos;
+	  grub_off_t new_offset = current_offset + xzio->buf.out_pos;
 
 	  if (file->offset > new_offset)
 	    current_offset = new_offset;

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to