[vlc-commits] contrib: taglib: use SetFilePointerEx instead of SetFilePointer
Steve Lhomme
git at videolan.org
Mon May 18 16:19:01 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May 18 14:12:27 2020 +0200| [9b2a81babe92ee718dd8e0a008e1b2ed1188ab17] | committer: Steve Lhomme
contrib: taglib: use SetFilePointerEx instead of SetFilePointer
It's available on more Win10 versions with UCRT builds and provides the same
features.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b2a81babe92ee718dd8e0a008e1b2ed1188ab17
---
...etFilePointerEx-instead-of-SetFilePointer.patch | 40 ++++++++++++++++++++++
contrib/src/taglib/rules.mak | 1 +
2 files changed, 41 insertions(+)
diff --git a/contrib/src/taglib/0001-use-SetFilePointerEx-instead-of-SetFilePointer.patch b/contrib/src/taglib/0001-use-SetFilePointerEx-instead-of-SetFilePointer.patch
new file mode 100644
index 0000000000..006da0d6d3
--- /dev/null
+++ b/contrib/src/taglib/0001-use-SetFilePointerEx-instead-of-SetFilePointer.patch
@@ -0,0 +1,40 @@
+From d27cc3568c2c04e86a8ec6e29fcdf7e3814b0596 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Fri, 15 May 2020 09:25:40 +0200
+Subject: [PATCH 1/3] use SetFilePointerEx instead of SetFilePointer
+
+It's available on more Win10 versions with UCRT builds and provides the same
+features. The API is available since Windows XP.
+---
+ taglib/toolkit/tfilestream.cpp | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp
+index 5205bae0..4b448271 100644
+--- a/taglib/toolkit/tfilestream.cpp
++++ b/taglib/toolkit/tfilestream.cpp
+@@ -364,7 +364,9 @@ void FileStream::seek(long offset, Position p)
+ }
+
+ SetLastError(NO_ERROR);
+- SetFilePointer(d->file, offset, NULL, whence);
++ LARGE_INTEGER lOffset;
++ lOffset.QuadPart = offset;
++ SetFilePointerEx(d->file, lOffset, NULL, whence);
+
+ const int lastError = GetLastError();
+ if(lastError != NO_ERROR && lastError != ERROR_NEGATIVE_SEEK)
+@@ -411,7 +413,9 @@ long FileStream::tell() const
+ #ifdef _WIN32
+
+ SetLastError(NO_ERROR);
+- const DWORD position = SetFilePointer(d->file, 0, NULL, FILE_CURRENT);
++ LARGE_INTEGER lOffset;
++ lOffset.QuadPart = 0;
++ const DWORD position = SetFilePointerEx(d->file, lOffset, NULL, FILE_CURRENT);
+ if(GetLastError() == NO_ERROR) {
+ return static_cast<long>(position);
+ }
+--
+2.26.0.windows.1
+
diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak
index 2844ed4d5d..b967b7d54f 100644
--- a/contrib/src/taglib/rules.mak
+++ b/contrib/src/taglib/rules.mak
@@ -15,6 +15,7 @@ $(TARBALLS)/taglib-$(TAGLIB_VERSION).tar.gz:
taglib: taglib-$(TAGLIB_VERSION).tar.gz .sum-taglib
$(UNPACK)
+ $(APPLY) $(SRC)/taglib/0001-use-SetFilePointerEx-instead-of-SetFilePointer.patch
$(APPLY) $(SRC)/taglib/0002-use-GetFileInformationByHandleEx-on-newer-builds-of-.patch
$(APPLY) $(SRC)/taglib/0003-don-t-use-CreateFile-in-UWP-builds.patch
$(APPLY) $(SRC)/taglib/use_resolvers_on_streams.patch
More information about the vlc-commits
mailing list