From edafebffa42b9bc57408cc9540a7c15e4e4cab63 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 5 Jan 2014 18:06:12 +0000 Subject: Use _fseeki64 on Windows when handling content files. --- src/lib/cross.cc | 10 ++++++++++ src/lib/cross.h | 1 + src/lib/file_group.cc | 2 +- src/lib/writer.cc | 6 +----- 4 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 746b4f509..57b3f93b2 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -288,3 +288,13 @@ fopen_boost (boost::filesystem::path p, string t) return fopen (p.c_str(), t.c_str ()); #endif } + +int +dcpomatic_fseek (FILE* stream, int64_t offset, int whence) +{ +#ifdef DCPOMATIC_WINDOWS + return _fseeki64 (stream, offset, whence); +#else + return fseek (stream, offset, whence); +#endif +} diff --git a/src/lib/cross.h b/src/lib/cross.h index 931e7d890..7e032e5a1 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -34,3 +34,4 @@ extern boost::filesystem::path openssl_path (); extern boost::filesystem::path app_contents (); #endif extern FILE * fopen_boost (boost::filesystem::path, std::string); +extern int dcpomatic_fseek (FILE *, int64_t, int); diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index dfe336b8f..807695451 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -125,7 +125,7 @@ FileGroup::seek (int64_t pos, int whence) const } ensure_open_path (i); - fseek (_current_file, sub_pos, SEEK_SET); + dcpomatic_fseek (_current_file, sub_pos, SEEK_SET); return full_pos; } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 414ea72eb..15732b131 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -448,11 +448,7 @@ Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes) } /* Read the data from the MXF and hash it */ -#ifdef DCPOMATIC_WINDOWS - _fseeki64 (mxf, info.offset, SEEK_SET); -#else - fseek (mxf, info.offset, SEEK_SET); -#endif + dcpomatic_fseek (mxf, info.offset, SEEK_SET); EncodedData data (info.size); size_t const read = fread (data.data(), 1, data.size(), mxf); if (read != static_cast (data.size ())) { -- cgit v1.2.3