Commit 145520fa authored by Clownacy's avatar Clownacy

Use fallback when SetFilePointerEX unavailable

VC6 doesn't appear to have SetFilePointerEX, so fallback on
SetFilePointer instead. This matches-up with VC6 not supporting
64-bit fseek.

Visual Studio .NET 2003 supports it, however.
parent 9f4efc25
...@@ -42125,7 +42125,16 @@ static ma_result ma_default_vfs_seek__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i ...@@ -42125,7 +42125,16 @@ static ma_result ma_default_vfs_seek__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i
dwMoveMethod = FILE_BEGIN; dwMoveMethod = FILE_BEGIN;
} }
#if defined(_MSC_VER) && _MSC_VER <= 1200
/* No SetFilePointerEx() so restrict to 31 bits. */
if (origin > 0x7FFFFFFF) {
return MA_OUT_OF_RANGE;
}
result = SetFilePointer((HANDLE)file, (LONG)liDistanceToMove.QuadPart, NULL, dwMoveMethod);
#else
result = SetFilePointerEx((HANDLE)file, liDistanceToMove, NULL, dwMoveMethod); result = SetFilePointerEx((HANDLE)file, liDistanceToMove, NULL, dwMoveMethod);
#endif
if (result == 0) { if (result == 0) {
return ma_result_from_GetLastError(GetLastError()); return ma_result_from_GetLastError(GetLastError());
} }
...@@ -42138,12 +42147,20 @@ static ma_result ma_default_vfs_tell__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i ...@@ -42138,12 +42147,20 @@ static ma_result ma_default_vfs_tell__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i
LARGE_INTEGER liZero; LARGE_INTEGER liZero;
LARGE_INTEGER liTell; LARGE_INTEGER liTell;
BOOL result; BOOL result;
#if defined(_MSC_VER) && _MSC_VER <= 1200
LONG tell;
#endif
(void)pVFS; (void)pVFS;
liZero.QuadPart = 0; liZero.QuadPart = 0;
#if defined(_MSC_VER) && _MSC_VER <= 1200
result = SetFilePointer((HANDLE)file, (LONG)liZero.QuadPart, &tell, FILE_CURRENT);
liTell.QuadPart = tell;
#else
result = SetFilePointerEx((HANDLE)file, liZero, &liTell, FILE_CURRENT); result = SetFilePointerEx((HANDLE)file, liZero, &liTell, FILE_CURRENT);
#endif
if (result == 0) { if (result == 0) {
return ma_result_from_GetLastError(GetLastError()); return ma_result_from_GetLastError(GetLastError());
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment