summaryrefslogtreecommitdiff
path: root/daemon/gvfsdaemonutils.c
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2014-10-19 09:26:02 +0100
committerRoss Lagerwall <rosslagerwall@gmail.com>2015-02-09 23:14:17 +0000
commit2fc159a7886a6696ca8caa218897b14150485db3 (patch)
tree4bf3f68a836916fe2487f9c5e5efb087770d6ca2 /daemon/gvfsdaemonutils.c
parentfcd88e9ee0c68c5f0e15fb402c22b26dc4415299 (diff)
downloadgvfs-2fc159a7886a6696ca8caa218897b14150485db3.tar.gz
daemon: Move seek type conversion to shared library
Since converting a GSeekType into an lseek type is repeated in a few places, move it into shared code. https://bugzilla.gnome.org/show_bug.cgi?id=738967
Diffstat (limited to 'daemon/gvfsdaemonutils.c')
-rw-r--r--daemon/gvfsdaemonutils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/daemon/gvfsdaemonutils.c b/daemon/gvfsdaemonutils.c
index 3c331271..2be975ce 100644
--- a/daemon/gvfsdaemonutils.c
+++ b/daemon/gvfsdaemonutils.c
@@ -215,3 +215,25 @@ gvfs_file_info_populate_content_types (GFileInfo *info,
g_free (free_mimetype);
}
+
+/**
+ * gvfs_seek_type_to_lseek:
+ * @type: the seek type
+ *
+ * Takes a GSeekType and converts it to an lseek type.
+ **/
+int
+gvfs_seek_type_to_lseek (GSeekType type)
+{
+ switch (type)
+ {
+ case G_SEEK_CUR:
+ return SEEK_CUR;
+ case G_SEEK_SET:
+ return SEEK_SET;
+ case G_SEEK_END:
+ return SEEK_END;
+ default:
+ return -1;
+ }
+}