summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-04-13 23:37:19 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-05 21:46:30 +0200
commit58731200a835da9ec928577d36ab5232db974734 (patch)
treec3ae8348f69f428a7702d2966f1a7af651dbbfdf /src
parent9fb1f4d59aa56c0f04a43ad83c152eaa12600e74 (diff)
Add ::seek().
Diffstat (limited to 'src')
-rw-r--r--src/file.cc12
-rw-r--r--src/file.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/file.cc b/src/file.cc
index f7c865b2..9ee91fe7 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -143,6 +143,18 @@ File::take()
}
+int
+File::seek(int64_t offset, int whence)
+{
+ DCP_ASSERT(_file);
+#ifdef LIBDCP_WINDOWS
+ return fseeki64(_file, offset, whence);
+#else
+ return fseek(_file, offset, whence);
+#endif
+}
+
+
/** Windows can't "by default" cope with paths longer than 260 characters, so if you pass such a path to
* any boost::filesystem method it will fail. There is a "fix" for this, which is to prepend
* the string \\?\ to the path. This will make it work, so long as:
diff --git a/src/file.h b/src/file.h
index 7dae44a6..1817dc9c 100644
--- a/src/file.h
+++ b/src/file.h
@@ -63,6 +63,8 @@ public:
int eof();
/** fgets() wrapper */
char *gets(char *s, int size);
+ /** fseek/fseeki64 wrapper */
+ int seek(int64_t offset, int whence);
void checked_write(void const * ptr, size_t size);
void checked_read(void* ptr, size_t size);