]> granicus.if.org Git - taglib/commitdiff
Values of FILE_* macros are guaranteed in Win32.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 6 Nov 2016 15:42:12 +0000 (00:42 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 6 Nov 2016 15:42:12 +0000 (00:42 +0900)
taglib/toolkit/tfilestream.cpp

index 4f522a6253dfe2de14c9f001fedac653833bb10c..219913af304ff9eda09fba85a2c45a856b1e46b4 100644 (file)
@@ -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<DWORD>(p))) {
     debug("FileStream::seek() -- Failed to set the file pointer.");
   }