OSDN Git Service

should define MIN() when it was not defined
[lha/lha.git] / src / crcio.c
index a972b88..e96a723 100644 (file)
@@ -35,7 +35,7 @@ make_crctable( /* void */ )
 unsigned int
 calccrc(crc, p, n)
     unsigned int crc;
-    unsigned char  *p;
+    char  *p;
     unsigned int    n;
 {
     while (n-- > 0)
@@ -47,9 +47,9 @@ calccrc(crc, p, n)
 int
 fread_crc(crcp, p, n, fp)
     unsigned int *crcp;
-    unsigned char  *p;
-    int             n;
-    FILE           *fp;
+    void *p;
+    int  n;
+    FILE *fp;
 {
     if (text_mode)
         n = fread_txt(p, n, fp);
@@ -67,9 +67,9 @@ fread_crc(crcp, p, n, fp)
 void
 fwrite_crc(crcp, p, n, fp)
     unsigned int *crcp;
-    unsigned char  *p;
-    int             n;
-    FILE           *fp;
+    void *p;
+    int  n;
+    FILE *fp;
 {
     *crcp = calccrc(*crcp, p, n);
 #ifdef NEED_INCREMENTAL_INDICATOR
@@ -141,11 +141,13 @@ putc_euc(c, fd)
 
 /* ------------------------------------------------------------------------ */
 int
-fwrite_txt(p, n, fp)
-    unsigned char  *p;
-    int             n;
-    FILE           *fp;
+fwrite_txt(vp, n, fp)
+    void *vp;
+    int  n;
+    FILE *fp;
 {
+    unsigned char *p = vp;
+
     while (--n >= 0) {
         if (*p != '\015' && *p != '\032') {
 #ifdef EUC
@@ -156,21 +158,23 @@ fwrite_txt(p, n, fp)
                 break;
 #endif
         }
-
-        prev_char = *p++;
+        p++;
     }
     return (ferror(fp));
 }
 
 /* ------------------------------------------------------------------------ */
 int
-fread_txt(p, n, fp)
-    unsigned char  *p;
-    int             n;
-    FILE           *fp;
+fread_txt(vp, n, fp)
+    void *vp;
+    int  n;
+    FILE *fp;
 {
     int             c;
     int             cnt = 0;
+    unsigned char *p;
+
+    p = vp;
 
     while (cnt < n) {
         if (getc_euc_cache != EOF) {