-
-SeekOffset sys_seek(Handle &handle, SeekOffset offset, SeekType type)
-{
-#ifdef WIN32
- LONG high = offset>>32;
- DWORD ret = SetFilePointer(*handle, offset, &high, sys_seek_type(type));
- if(ret==INVALID_SET_FILE_POINTER)
- {
- DWORD err = GetLastError();
- if(err!=NO_ERROR)
- throw system_error("SetFilePointer");
- }
-
- return (SeekOffset(high)<<32) | ret;
-#else
- off64_t ret = lseek64(*handle, offset, sys_seek_type(type));
- if(ret==(off64_t)-1)
- {
- if(errno==EINVAL)
- throw bad_seek(offset, type);
- else
- throw system_error("lseek64");
- }
-
- return ret;
-#endif
-}
-