From: Tsuda Kageyu Date: Sun, 6 Nov 2016 15:42:12 +0000 (+0900) Subject: Values of FILE_* macros are guaranteed in Win32. X-Git-Tag: v1.12-beta-1~125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da9df1b2a8c18b1e61f6846aa68b4682e4dc1067;p=taglib Values of FILE_* macros are guaranteed in Win32. --- 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."); }