From da9df1b2a8c18b1e61f6846aa68b4682e4dc1067 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Mon, 7 Nov 2016 00:42:12 +0900 Subject: [PATCH] Values of FILE_* macros are guaranteed in Win32. --- taglib/toolkit/tfilestream.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 4f522a62..219913af 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -346,18 +346,7 @@ void FileStream::seek(long offset, Position p) #ifdef _WIN32 - DWORD whence; - switch(p) { - case Beginning: - whence = FILE_BEGIN; - break; - case Current: - whence = FILE_CURRENT; - break; - case End: - whence = FILE_END; - break; - default: + if(p != Beginning && p != Current && p != End) { debug("FileStream::seek() -- Invalid Position value."); return; } @@ -365,7 +354,7 @@ void FileStream::seek(long offset, Position p) LARGE_INTEGER liOffset; liOffset.QuadPart = offset; - if(!SetFilePointerEx(d->file, liOffset, NULL, whence)) { + if(!SetFilePointerEx(d->file, liOffset, NULL, static_cast(p))) { debug("FileStream::seek() -- Failed to set the file pointer."); } -- 2.40.0