ntdll: use off_t instead of long

André Hentschel nerv at dawncrow.de
Tue Dec 14 14:36:33 CST 2010


This is more correct and prevents a crash on sparc (at least what Austin and me acutally reached)
---
 dlls/ntdll/directory.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 865c2fa..86d1032 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -1414,7 +1414,7 @@ struct darwin_legacy_dirent {
  * getdirentries call starts over at the beginning again, causing an
  * infinite loop.
  */
-static inline int wine_getdirentries(int fd, char *buf, int nbytes, long *basep)
+static inline int wine_getdirentries(int fd, char *buf, int nbytes, off_t *basep)
 {
     int res = getdirentries(fd, buf, nbytes, basep);
 #ifdef __APPLE__
@@ -1433,7 +1433,7 @@ static int read_directory_getdirentries( int fd, IO_STATUS_BLOCK *io, void *buff
                                          BOOLEAN single_entry, const UNICODE_STRING *mask,
                                          BOOLEAN restart_scan, FILE_INFORMATION_CLASS class )
 {
-    long restart_pos;
+    off_t restart_pos;
     ULONG_PTR restart_info_pos = 0;
     size_t size, initial_size = length;
     int res, fake_dot_dot = 1;
@@ -1515,7 +1515,7 @@ static int read_directory_getdirentries( int fd, IO_STATUS_BLOCK *io, void *buff
             last_info = info;
             if (io->u.Status == STATUS_BUFFER_OVERFLOW)
             {
-                lseek( fd, (unsigned long)restart_pos, SEEK_SET );
+                lseek( fd, restart_pos, SEEK_SET );
                 if (restart_info_pos)  /* if we have a complete read already, return it */
                 {
                     io->u.Status = STATUS_SUCCESS;
@@ -1533,7 +1533,7 @@ static int read_directory_getdirentries( int fd, IO_STATUS_BLOCK *io, void *buff
             /* if we have to return but the buffer contains more data, restart with a smaller size */
             if (res > 0 && (single_entry || io->Information + max_dir_info_size(class) > length))
             {
-                lseek( fd, (unsigned long)restart_pos, SEEK_SET );
+                lseek( fd, restart_pos, SEEK_SET );
                 size = (char *)de - data;
                 io->Information = restart_info_pos;
                 last_info = restart_last_info;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list