[gvfs] http: Fix the SEEK_END offset calculation



commit 7e0f96133ca897640be51c3f4039dd90188357da
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 a6ef3e0..322d343 100644
--- a/daemon/gvfshttpinputstream.c
+++ b/daemon/gvfshttpinputstream.c
@@ -43,6 +43,7 @@ typedef struct {
   GInputStream *stream;
 
   char *range;
+  goffset request_offset;
   goffset offset;
 
 } GVfsHttpInputStreamPrivate;
@@ -474,7 +475,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;
        }
     }
 
@@ -510,6 +511,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]