hopefully better support for systems where sizeof(int)==8
[rsync/rsync.git] / io.c
diff --git a/io.c b/io.c
index 95177c4..1186740 100644 (file)
--- a/io.c
+++ b/io.c
@@ -164,7 +164,7 @@ static int readfd(int fd,char *buffer,int N)
 }
 
 
-int read_int(int f)
+int32 read_int(int f)
 {
   int ret;
   char b[4];
@@ -185,9 +185,9 @@ int64 read_longint(int f)
        char b[8];
        ret = read_int(f);
 
-       if (ret != -1) return ret;
+       if ((int32)ret != (int32)0xffffffff) return ret;
 
-#ifndef HAVE_LONGLONG
+#ifdef NO_INT64
        fprintf(FERROR,"Integer overflow - attempted 64 bit offset\n");
        exit_cleanup(1);
 #else
@@ -238,7 +238,7 @@ static int last_sparse;
 int sparse_end(int f)
 {
        if (last_sparse) {
-               lseek(f,-1,SEEK_CUR);
+               do_lseek(f,-1,SEEK_CUR);
                return (write(f,&last_byte,1) == 1 ? 0 : -1);
        }
        last_sparse = 0;
@@ -260,7 +260,7 @@ static int write_sparse(int f,char *buf,int len)
                last_sparse=1;
 
        if (l1 > 0)
-               lseek(f,l1,SEEK_CUR);  
+               do_lseek(f,l1,SEEK_CUR);  
 
        if (l1 == len) 
                return len;
@@ -271,7 +271,7 @@ static int write_sparse(int f,char *buf,int len)
        }
 
        if (l2 > 0)
-               lseek(f,l2,SEEK_CUR);
+               do_lseek(f,l2,SEEK_CUR);
        
        return len;
 }
@@ -376,7 +376,7 @@ static int writefd(int fd,char *buf,int len)
 
 
 
-void write_int(int f,int x)
+void write_int(int f,int32 x)
 {
   int ret;
   char b[4];