Converted implementation of _lseek to _lseeki64, implemented _lseek by

calling _lseeki64.
This commit is contained in:
Stefan Leichter 2002-11-25 20:50:01 +00:00 committed by Alexandre Julliard
parent 11f4b44451
commit a5d7fbfb10
2 changed files with 18 additions and 7 deletions

View File

@ -495,9 +495,9 @@ int _fcloseall(void)
/*********************************************************************
* _lseek (MSVCRT.@)
*/
LONG _lseek(int fd, LONG offset, int whence)
__int64 _lseeki64(int fd, __int64 offset, int whence)
{
DWORD ret;
DWORD ret, hoffset = (DWORD) (offset >> 32);
HANDLE hand = msvcrt_fdtoh(fd);
TRACE(":fd (%d) handle (%p)\n",fd,hand);
@ -510,17 +510,20 @@ LONG _lseek(int fd, LONG offset, int whence)
return -1;
}
TRACE(":fd (%d) to 0x%08lx pos %s\n",
fd,offset,(whence==SEEK_SET)?"SEEK_SET":
TRACE(":fd (%d) to 0x%08lx%08lx pos %s\n",
fd,hoffset,(long)offset,
(whence==SEEK_SET)?"SEEK_SET":
(whence==SEEK_CUR)?"SEEK_CUR":
(whence==SEEK_END)?"SEEK_END":"UNKNOWN");
if ((ret = SetFilePointer(hand, offset, NULL, whence)) != 0xffffffff)
if (((ret = SetFilePointer(hand, (long)offset, &hoffset,
whence)) != INVALID_SET_FILE_POINTER) || !GetLastError())
{
if (MSVCRT_files[fd])
MSVCRT_files[fd]->_flag &= ~MSVCRT__IOEOF;
/* FIXME: What if we seek _to_ EOF - is EOF set? */
return ret;
return ((__int64)hoffset << 32) | ret;
}
TRACE(":error-last error (%ld)\n",GetLastError());
if (MSVCRT_files[fd])
@ -537,6 +540,14 @@ LONG _lseek(int fd, LONG offset, int whence)
return -1;
}
/*********************************************************************
* _lseek (MSVCRT.@)
*/
LONG _lseek(int fd, LONG offset, int whence)
{
return _lseeki64(fd, offset, whence);
}
/*********************************************************************
* _locking (MSVCRT.@)
*

View File

@ -327,7 +327,7 @@
@ cdecl _lrotr(long long) _lrotr
@ cdecl _lsearch(ptr ptr long long ptr) _lsearch
@ cdecl _lseek(long long long) _lseek
@ stub _lseeki64 #(long long long)
@ cdecl -ret64 _lseeki64(long long long) _lseeki64
@ forward _ltoa ntdll._ltoa
@ cdecl _ltow(long ptr long) _ltow
@ cdecl _makepath(str str str str str) _makepath