_lseeki64

Stefan Leichter Stefan.Leichter at camLine.com
Sun Nov 24 03:59:04 CST 2002


ChangeLog
-------------
	converted implementation of _lseek to _lseeki64
	implemented _lseek by calling _lseeki64
	fixed compiler warning in _stati64

--- dlls/msvcrt/msvcrt.1.spec	Sat Nov 23 22:06:48 2002
+++ dlls/msvcrt/msvcrt.spec	Sat Nov 23 22:18:16 2002
@@ -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 _lseeki64 (long long long) _lseeki64
 @ forward _ltoa ntdll._ltoa
 @ cdecl _ltow(long ptr long) _ltow
 @ cdecl _makepath(str str str str str) _makepath
--- dlls/msvcrt/file.1.c	Sat Nov 23 21:23:09 2002
+++ dlls/msvcrt/file.c	Sun Nov 24 10:49:32 2002
@@ -481,9 +481,10 @@
 /*********************************************************************
  *		_lseek (MSVCRT.@)
  */
-LONG _lseek(int fd, LONG offset, int whence)
+__int64 _lseeki64(int fd, __int64 offset, int whence)
 {
-  DWORD ret;
+  __int64 ret;
+  DWORD  hoffset = (DWORD) (offset >> 32);
   HANDLE hand = msvcrt_fdtoh(fd);
 
   TRACE(":fd (%d) handle (%p)\n",fd,hand);
@@ -496,16 +497,21 @@
     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 & 0xffffffff),
+        (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 & 0xffffffff), 
+                            &hoffset, whence)) != 0xffffffff)
   {
     if (MSVCRT_files[fd])
       MSVCRT_files[fd]->_flag &= ~MSVCRT__IOEOF;
     /* FIXME: What if we seek _to_ EOF - is EOF set? */
+
+    if (offset & 0xffffffff00000000 )
+        FIXME("return value of function is incorrect\n");
     return ret;
   }
   TRACE(":error-last error (%ld)\n",GetLastError());
@@ -524,6 +530,14 @@
 }
 
 /*********************************************************************
+ *		_lseek (MSVCRT.@)
+ */
+LONG _lseek(int fd, LONG offset, int whence)
+{
+    return _lseeki64(fd, offset, whence);
+}
+
+/*********************************************************************
  *		_locking (MSVCRT.@)
  *
  * This is untested; the underlying LockFile doesn't work yet.
@@ -1194,7 +1208,9 @@
   buf->st_atime = dw;
   RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw);
   buf->st_mtime = buf->st_ctime = dw;
-  TRACE("\n%d %d %ld %ld %ld %ld\n", buf->st_mode,buf->st_nlink,buf->st_size,
+  TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", 
+    buf->st_mode,buf->st_nlink,
+    (long)(buf->st_size >> 32),(long)(buf->st_size & 0xffffffff),
     buf->st_atime,buf->st_mtime, buf->st_ctime);
   return 0;
 }



More information about the wine-patches mailing list