GNOME Bugzilla – Bug 720062
Implement seek and truncate on output stream for webdav
Last modified: 2014-01-12 09:07:14 UTC
This shouldn't be hard since for webdav, the output stream is a wrapper around GMemoryOutputStream.
Created attachment 263776 [details] [review] dav: Implement seek for output streams
Created attachment 263777 [details] [review] dav: Implement truncate for output streams
Note that truncating larger streams fails without the glib patch in bug 720080.
(In reply to comment #3) > Note that truncating larger streams fails without the glib patch in bug 720080. This has now been fixed.
Review of attachment 263776 [details] [review]: ::: daemon/gvfsbackenddav.c @@ +2318,2 @@ g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream); + g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE); Wouldn't be better to use g_seekable_can_seek (G_SEEKABLE (stream)) there? @@ +2361,2 @@ g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream); + g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE); dtto
Review of attachment 263777 [details] [review]: ::: daemon/gvfsbackenddav.c @@ +2318,3 @@ g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream); g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE); + g_vfs_job_open_for_write_set_can_truncate (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE); dtto @@ +2362,3 @@ g_vfs_job_open_for_write_set_handle (G_VFS_JOB_OPEN_FOR_WRITE (job), stream); g_vfs_job_open_for_write_set_can_seek (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE); + g_vfs_job_open_for_write_set_can_truncate (G_VFS_JOB_OPEN_FOR_WRITE (job), TRUE); dtto @@ +2521,3 @@ + + if (g_seekable_truncate (stream, size, G_VFS_JOB (job)->cancellable, &error)) + g_vfs_job_succeeded (G_VFS_JOB (job)); Please use brackets when the else section exists...
Created attachment 265919 [details] [review] dav: Implement seek for output streams
Created attachment 265920 [details] [review] dav: Implement truncate for output streams
Thanks for the review. The updated patches should address the comments.
Review of attachment 265919 [details] [review]: Looks good, thanks!
Pushed to master as 686776f1a6f932e7751069715d9693e00f672b5c. Thanks!