From 264675a1af451647f967dcb2692bba7cc61e65ca Mon Sep 17 00:00:00 2001
From: Koen Holtman <koen.holtman@ieee.org>
Date: Mon, 24 Sep 2012 20:59:50 +0200
Subject: [PATCH 2/5] fix type errors

---
 HISTORY |  4 ++++
 afio.c  | 22 +++++++++++-----------
 afio.h  |  6 +++---
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/HISTORY b/HISTORY
index cee3916..92b3c2d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -988,3 +988,7 @@ reported by Ian Campbell.  Closes Debian bug #686613.
 
 Added d letter for the -1 option.
 
+Fixed two compiler errors (as reported by recent gcc) due to
+discrepancies between function declarations in afio.h and afio.c.
+Problem reported by Jari Aalto.  Added some more size_t and ssize_t.
+
diff --git a/afio.c b/afio.c
index 1841a83..3cadb82 100644
--- a/afio.c
+++ b/afio.c
@@ -924,8 +924,8 @@ void mail(char *who,int vol,char *archive)
 STATIC VOIDFN
 copyin (char **av)
 {
-  reg int got;
-  reg uint have;
+  reg ssize_t got;
+  reg ssize_t have;
 
   if (*av)
     fatal (*av, "Extraneous argument");
@@ -1080,7 +1080,7 @@ fatal (char *what, char *why)
  * about write() elsewhere.
  */
 STATIC
-int writeall(int fd, const char *buf, size_t count)
+ssize_t writeall(int fd, const char *buf, size_t count)
 {
  ssize_t put;
  size_t totalput;
@@ -1553,12 +1553,12 @@ indata (fd, size, name)
      reg off_t size;
      char *name;
 {
-  reg uint chunk;
+  reg size_t chunk;
   reg char *oops;
-  reg int sparse;
+  reg ssize_t sparse;
   reg int corrupt;
   auto char *buf;
-  auto uint avail;
+  auto size_t avail;
 
   corrupt = sparse = 0;
   oops = NULL;
@@ -4247,8 +4247,8 @@ passdata (from, ifd, to, ofd)
      char *to;
      reg int ofd;
 {
-  reg int got;
-  reg int sparse;
+  reg ssize_t got;
+  reg ssize_t sparse;
   auto char block[FSBUF];
 
   if (ifd)
@@ -4262,7 +4262,7 @@ passdata (from, ifd, to, ofd)
 	VOID warn (got < 0 ? from : to, syserr ());
       else if (sparse > 0
 	       && (lseek (ofd, (off_t) - sparse, 1) < 0
-		   || writeall (ofd, block, (uint) sparse) != sparse))
+		   || writeall (ofd, block, sparse) != sparse))
 	VOID warn (to, syserr ());
     }
   VOID close (ofd);
@@ -4523,11 +4523,11 @@ rmdir (name)
  * 0 if the block was written, the given length for a sparse
  * block or -1 if unsuccessful.
  */
-STATIC int
+STATIC ssize_t
 fswrite (fd, buf, len)
      int fd;
      char *buf;
-     uint len;
+     size_t len;
 {
   reg char *bidx;
   reg char *bend;
diff --git a/afio.h b/afio.h
index 79ed760..e676d68 100644
--- a/afio.h
+++ b/afio.h
@@ -446,7 +446,7 @@ int openotty (char *, Stat *, Link *, int, int);
 int openqtty (void);
 int options (int, char **, char *);
 VOIDFN out (char **);
-void outalloc (uint);
+void outalloc (size_t);
 size_t outavail (char **);
 int outdata (int, char*, off_t);
 
@@ -481,7 +481,7 @@ int rmdir (char *);
 #if !defined (linux) && !defined(__FreeBSD__) && !defined(sun) && !defined(__CYGWIN32__)
 VOIDFN (*signal ())();
 #endif
-     int fswrite (int, char*, uint);
+     ssize_t fswrite (int, char*, size_t);
      char *syserr (void);
      VOIDFN toc (char **);
      void tocentry (char *, Stat *);
@@ -497,7 +497,7 @@ VOIDFN (*signal ())();
      int xwait (int, char *, int);
      void mail(char *who,int vol,char *archive);
 
-int writeall(int, const char*, unsigned int);
+ssize_t writeall(int, const char*, size_t);
 int incheckentry(char *, Stat *);
 int incheckdata (int fd, off_t size, char *name, Stat *asb, int comp);
 Link * linkinode16 (dev_t dev, ino_t ino);
-- 
2.3.4

