#endif
}
-unsigned File::seek(int off, SeekType st)
+SeekOffset File::seek(SeekOffset off, SeekType type)
{
check_access(M_NONE);
signal_flush_required.emit();
-
- int type = sys_seek_type(st);
-#ifdef WIN32
- DWORD ret = SetFilePointer(*handle, off, 0, type);
- if(ret==INVALID_SET_FILE_POINTER)
- throw system_error("SetFilePointer");
-#else
- off_t ret = lseek(*handle, off, type);
- if(ret==(off_t)-1)
- throw system_error("lseek");
-#endif
-
+ off = sys_seek(handle, off, type);
eof_flag = false;
- return ret;
+ return off;
}
-unsigned File::tell() const
+SeekOffset File::tell() const
{
check_access(M_NONE);
-#ifdef WIN32
- DWORD ret = SetFilePointer(*handle, 0, 0, FILE_CURRENT);
- if(ret==INVALID_SET_FILE_POINTER)
- throw system_error("SetFilePointer");
-#else
- off_t ret = lseek(*handle, 0, SEEK_CUR);
- if(ret==(off_t)-1)
- throw system_error("lseek");
-#endif
-
- return ret;
+ return sys_seek(const_cast<Handle &>(handle), 0, S_CUR);
}
void File::check_access(Mode m) const