File 0001-http-Fix-the-SEEK_END-offset-calculation.patch of Package gvfs.535

From 81a5cbafb95435ab73611be61a01672d6a0580de Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <rosslagerwall@gmail.com>
Date: Sun, 8 Dec 2013 13:01:40 +0200
Subject: [PATCH] http: Fix the SEEK_END offset calculation

Fix the SEEK_END offset calculation by reversing the sign of offset and
taking into account the offset of the previous seek.

https://bugzilla.gnome.org/show_bug.cgi?id=710534
---
 daemon/gvfshttpinputstream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/daemon/gvfshttpinputstream.c b/daemon/gvfshttpinputstream.c
index fb1929a..222688a 100644
--- a/daemon/gvfshttpinputstream.c
+++ b/daemon/gvfshttpinputstream.c
@@ -45,6 +45,7 @@ typedef struct {
   GInputStream *stream;
 
   char *range;
+  goffset request_offset;
   goffset offset;
 
 } GVfsHttpInputStreamPrivate;
@@ -476,7 +477,7 @@ g_vfs_http_input_stream_seek (GSeekable     *seekable,
       if (content_length)
 	{
 	  type = G_SEEK_SET;
-	  offset = content_length - offset;
+	  offset = priv->request_offset + content_length + offset;
 	}
     }
 
@@ -512,6 +513,7 @@ g_vfs_http_input_stream_seek (GSeekable     *seekable,
 
     case G_SEEK_SET:
       priv->range = g_strdup_printf ("bytes=%"G_GUINT64_FORMAT"-", (guint64)offset);
+      priv->request_offset = offset;
       priv->offset = offset;
       break;
 
-- 
1.8.4

openSUSE Build Service is sponsored by