Values of FILE_* macros are guaranteed in Win32.

This commit is contained in:
Tsuda Kageyu
2016-11-07 00:42:12 +09:00
parent 70334edd19
commit da9df1b2a8

View 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.");
}