[gvfs/gnome-3-10] http: Fix the SEEK_END offset calculation



commit 81a5cbafb95435ab73611be61a01672d6a0580de
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun Dec 8 13:01:40 2013 +0200

    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 files changed, 3 insertions(+), 1 deletions(-)
---
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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]