[gcab] extract: learn to rewind if needed
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcab] extract: learn to rewind if needed
- Date: Wed, 9 Mar 2016 17:06:24 +0000 (UTC)
commit 616e77a54964aee8754acefbea4e76a15529dfa7
Author: Marc-André Lureau <marcandre lureau gmail com>
Date: Wed Mar 9 18:05:06 2016 +0100
extract: learn to rewind if needed
In some cases, files my point to previously treated offset. Let's rewind
in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=763377
libgcab/gcab-folder.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libgcab/gcab-folder.c b/libgcab/gcab-folder.c
index da14044..e724097 100644
--- a/libgcab/gcab-folder.c
+++ b/libgcab/gcab-folder.c
@@ -404,6 +404,16 @@ gcab_folder_extract (GCabFolder *self,
u4 usize = file->cfile.usize;
u4 uoffset = file->cfile.uoffset;
+
+ /* let's rewind if need be */
+ if (uoffset < nubytes) {
+ if (!g_seekable_seek (G_SEEKABLE (data), self->cfolder.offsetdata,
+ G_SEEK_SET, cancellable, error))
+ goto end;
+ bzero(&cdata, sizeof(cdata));
+ nubytes = 0;
+ }
+
while (usize > 0) {
if ((nubytes + cdata.nubytes) <= uoffset) {
nubytes += cdata.nubytes;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]