Dnia czwartek 08 kwiecień 2010 o 23:55:28 Szymon Janc napisał(a):
> Hello,
>
> New version with various fixes, most noticable : seek support, respect not
> easly seekable flag, BCJ support.
Attached is a small fix for xzio read to act in grub way, not posix like.
--
Szymon K. Janc
[email protected] // GG: 1383435
=== modified file 'io/xzio.c'
--- io/xzio.c 2010-04-08 21:44:23 +0000
+++ io/xzio.c 2010-04-10 22:46:52 +0000
@@ -245,8 +245,6 @@
int offset_lock;
grub_uint8_t current_offset;
- xzio->buf.out_size = len >= XZBUFSIZ ? XZBUFSIZ : len;
-
/* If seek backward need to reset decoder and start from beginning of file.
TODO Possible improvement by jumping blocks. */
if (file->offset < xzio->saved_offset)
@@ -259,18 +257,19 @@
grub_file_seek (xzio->file, 0);
}
- offset_lock = (file->offset == xzio->saved_offset) ? 1 : 0;
- current_offset = xzio->saved_offset;
-
- while (len >= xzio->buf.out_size)
+ 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)
{
readret = grub_file_read (xzio->file, xzio->inbuf, XZBUFSIZ);
if (readret < 0)
return -1;
-
xzio->buf.in_size = readret;
xzio->buf.in_pos = 0;
}
@@ -317,7 +316,7 @@
}
xzio->buf.out_pos = 0;
- if (xzret == XZ_STREAM_END) /* Stream end, EOF. */
+ if (xzret == XZ_STREAM_END) /* Stream end, EOF. */
break;
}
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel