Rename BUFSIZE to CDBUFSIZE, define BUFSIZE to 8192 and use it.

--HG--
branch : HEAD
diff --git a/lib/zip_close.c b/lib/zip_close.c
index c7a39a8..485f060 100644
--- a/lib/zip_close.c
+++ b/lib/zip_close.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_close.c,v 1.39 2004/04/15 12:54:20 dillo Exp $
+  $NiH: zip_close.c,v 1.40 2004/04/16 09:40:27 dillo Exp $
 
   zip_close.c -- close zip archive and update changes
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -296,7 +296,7 @@
 add_data_comp(zip_read_func rf, void *ud, struct zip_dirent *de, FILE *ft,
 	      struct zip_error *error)
 {
-    char buf[8192];
+    char buf[BUFSIZE];
     ssize_t n;
     struct zip_stat st;
 
@@ -333,7 +333,7 @@
 add_data_uncomp(zip_read_func rf, void *ud, struct zip_dirent *de, FILE *ft,
 		struct zip_error *error)
 {
-    char b1[8192], b2[8192];
+    char b1[BUFSIZE], b2[BUFSIZE];
     int end, flush, ret;
     ssize_t n;
     z_stream zstr;
@@ -410,7 +410,7 @@
 static int
 copy_data(FILE *fs, off_t len, FILE *ft, struct zip_error *error)
 {
-    char buf[8192];
+    char buf[BUFSIZE];
     int n, nn;
 
     if (len == 0)
diff --git a/lib/zip_fopen_index.c b/lib/zip_fopen_index.c
index 502b551..0af082b 100644
--- a/lib/zip_fopen_index.c
+++ b/lib/zip_fopen_index.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_fopen_index.c,v 1.17 2004/04/15 23:48:10 dillo Exp $
+  $NiH: zip_fopen_index.c,v 1.18 2004/04/16 09:40:28 dillo Exp $
 
   zip_fopen_index.c -- open file in zip archive for reading by index
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -97,7 +97,6 @@
     if (zff->flags & ZIP_ZF_COMP)
 	zff->bytes_left = zff->cbytes_left;
     else {
-	/* XXX: don't use BUFSIZE */
 	if ((zff->buffer=(char *)malloc(BUFSIZE)) == NULL) {
 	    _zip_error_set(&zf->error, ZERR_MEMORY, 0);
 	    zip_fclose(zff);
diff --git a/lib/zip_open.c b/lib/zip_open.c
index 1905264..b68375d 100644
--- a/lib/zip_open.c
+++ b/lib/zip_open.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_open.c,v 1.20 2004/04/14 14:01:26 dillo Exp $
+  $NiH: zip_open.c,v 1.21 2004/04/16 09:40:29 dillo Exp $
 
   zip_open.c -- open zip archive
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -109,7 +109,7 @@
     clearerr(fp);
     fseek(fp, 0, SEEK_END);
     len = ftell(fp);
-    i = fseek(fp, -(len < BUFSIZE ? len : BUFSIZE), SEEK_END);
+    i = fseek(fp, -(len < CDBUFSIZE ? len : CDBUFSIZE), SEEK_END);
     if (i == -1 && errno != EFBIG) {
 	/* seek before start of file on my machine */
 	set_error(zep, NULL, ZERR_SEEK);
@@ -118,14 +118,14 @@
     }
 
     /* 64k is too much for stack */
-    if ((buf=(unsigned char *)malloc(BUFSIZE)) == NULL) {
+    if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) {
 	set_error(zep, NULL, ZERR_MEMORY);
 	fclose(fp);
 	return NULL;
     }
 
     clearerr(fp);
-    buflen = fread(buf, 1, BUFSIZE, fp);
+    buflen = fread(buf, 1, CDBUFSIZE, fp);
 
     if (ferror(fp)) {
 	set_error(zep, NULL, ZERR_READ);
diff --git a/lib/zipint.h b/lib/zipint.h
index e95c540..88a8f6a 100644
--- a/lib/zipint.h
+++ b/lib/zipint.h
@@ -3,7 +3,7 @@
 #define _HAD_ZIPINT_H
 
 /*
-  $NiH: zipint.h,v 1.23 2004/04/14 14:01:28 dillo Exp $
+  $NiH: zipint.h,v 1.24 2004/04/16 09:40:31 dillo Exp $
 
   zipint.h -- internal declarations.
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -39,15 +39,16 @@
 
 
 
-#define MAXCOMLEN        65536
-#define EOCDLEN             22
-#define BUFSIZE       (MAXCOMLEN+EOCDLEN)
-#define LOCAL_MAGIC   "PK\3\4"
 #define CENTRAL_MAGIC "PK\1\2"
+#define LOCAL_MAGIC   "PK\3\4"
 #define EOCD_MAGIC    "PK\5\6"
 #define DATADES_MAGIC "PK\7\8"
 #define CDENTRYSIZE         46
 #define LENTRYSIZE          30
+#define MAXCOMLEN        65536
+#define EOCDLEN             22
+#define CDBUFSIZE       (MAXCOMLEN+EOCDLEN)
+#define BUFSIZE		8192