Rename ZERR_* to ZIP_ER_*; rename ZIP_ET_ZIP to ZIP_ET_ZLIB;
remove ZIP_CH_ISCOMP from zip.h.

--HG--
branch : HEAD
diff --git a/lib/make_zip_err_str.sh b/lib/make_zip_err_str.sh
index b52317a..18ec5d1 100755
--- a/lib/make_zip_err_str.sh
+++ b/lib/make_zip_err_str.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-#  $NiH: zip.h,v 1.37 2004/04/16 09:40:26 dillo Exp $
+#  $NiH: make_zip_err_str.sh,v 1.7 2004/04/25 16:20:16 dillo Exp $
 #
 #  make_zip_err_str.sh: create zip_err_str.c from zip.h
 #  Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -47,7 +47,7 @@
     exit 1
 fi
 
-rcsid=`echo '$NiH$' | tr -d '$'`
+rcsid=`echo '$NiH: make_zip_err_str.sh,v 1.7 2004/04/25 16:20:16 dillo Exp $' | tr -d '$'`
 inrcsid=`sed -n 's/^  \$\([^$]*[^ ]\) *\$$/\1/p' "$1"`
 
 cat <<EOF >> "$2.$$" || exit 1
@@ -67,7 +67,7 @@
 const char * const _zip_err_str[] = {
 EOF
 
-sed -n  '/^#define ZERR_/ s/.*\/\* . \([^*]*\) \*\//    "\1",/p' "$1" \
+sed -n  '/^#define ZIP_ER_/ s/.*\/\* . \([^*]*\) \*\//    "\1",/p' "$1" \
     >> "$2.$$" || exit 1
 
 cat <<EOF >> "$2.$$" || exit 1
@@ -77,12 +77,12 @@
 
 #define N ZIP_ET_NONE
 #define S ZIP_ET_SYS
-#define Z ZIP_ET_ZIP
+#define Z ZIP_ET_ZLIB
 
 const int _zip_err_type[] = {
 EOF
 
-sed -n  '/^#define ZERR_/ s/.*\/\* \(.\) \([^*]*\) \*\//    \1,/p' "$1" \
+sed -n  '/^#define ZIP_ER_/ s/.*\/\* \(.\) \([^*]*\) \*\//    \1,/p' "$1" \
     >> "$2.$$" || exit 1
 
 echo '};' >> "$2.$$" || exit 1
diff --git a/lib/zip.h b/lib/zip.h
index 908f189..6c439de 100644
--- a/lib/zip.h
+++ b/lib/zip.h
@@ -2,7 +2,7 @@
 #define _HAD_ZIP_H
 
 /*
-  $NiH: zip.h,v 1.38 2004/06/24 15:01:57 dillo Exp $
+  $NiH: zip.h,v 1.39 2004/06/24 16:26:07 dillo Exp $
 
   zip.h -- exported declarations.
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -54,45 +54,41 @@
 
 #define ZIP_FL_NOCASE		1 /* ignore case on name lookup */
 #define ZIP_FL_NODIR		2 /* ignore directory component */
-#define ZIP_FL_COMPRESSED	4 /* read compressed data (XXX: rename) */
+#define ZIP_FL_COMPRESSED	4 /* read compressed data */
 #define ZIP_FL_UNCHANGED	8 /* use original data, ignoring changes */
 
-/* flags for zip_add and zip_replace */
-
-#define ZIP_CH_ISCOMP	1	/* data returned by ch_func is compressed */
-
 /* libzip error codes */
 
-#define ZERR_OK               0  /* N No error */
-#define ZERR_MULTIDISK        1  /* N Multi-disk zip archives not supported */
-#define ZERR_RENAME           2  /* S Renaming temporary file failed */
-#define ZERR_CLOSE            3  /* S Closing zip archive failed */
-#define ZERR_SEEK             4  /* S Seek error */
-#define ZERR_READ             5  /* S Read error */
-#define ZERR_WRITE            6  /* S Write error */
-#define ZERR_CRC              7  /* N CRC error */
-#define ZERR_ZIPCLOSED        8  /* N Containing zip archive was closed */
-#define ZERR_NOENT            9  /* N No such file */
-#define ZERR_EXISTS          10  /* N File already exists */
-#define ZERR_OPEN            11  /* S Can't open file */
-#define ZERR_TMPOPEN         12  /* S Failure to create temporary file */
-#define ZERR_ZLIB            13  /* Z Zlib error */
-#define ZERR_MEMORY          14  /* N Malloc failure */
-#define ZERR_CHANGED         15  /* N Entry has been changed */
-#define ZERR_COMPNOTSUPP     16  /* N Compression method not supported */
-#define ZERR_EOF             17  /* N Premature EOF */
-#define ZERR_INVAL           18  /* N Invalid argument */
-#define ZERR_NOZIP           19  /* N Not a zip archive */
-#define ZERR_INTERNAL        20  /* N Internal error */
-#define ZERR_INCONS	     21  /* N Zip archive inconsistent */
-#define ZERR_REMOVE	     22  /* S Can't remove file */
+#define ZIP_ER_OK             0  /* N No error */
+#define ZIP_ER_MULTIDISK      1  /* N Multi-disk zip archives not supported */
+#define ZIP_ER_RENAME         2  /* S Renaming temporary file failed */
+#define ZIP_ER_CLOSE          3  /* S Closing zip archive failed */
+#define ZIP_ER_SEEK           4  /* S Seek error */
+#define ZIP_ER_READ           5  /* S Read error */
+#define ZIP_ER_WRITE          6  /* S Write error */
+#define ZIP_ER_CRC            7  /* N CRC error */
+#define ZIP_ER_ZIPCLOSED      8  /* N Containing zip archive was closed */
+#define ZIP_ER_NOENT          9  /* N No such file */
+#define ZIP_ER_EXISTS        10  /* N File already exists */
+#define ZIP_ER_OPEN          11  /* S Can't open file */
+#define ZIP_ER_TMPOPEN       12  /* S Failure to create temporary file */
+#define ZIP_ER_ZLIB          13  /* Z Zlib error */
+#define ZIP_ER_MEMORY        14  /* N Malloc failure */
+#define ZIP_ER_CHANGED       15  /* N Entry has been changed */
+#define ZIP_ER_COMPNOTSUPP   16  /* N Compression method not supported */
+#define ZIP_ER_EOF           17  /* N Premature EOF */
+#define ZIP_ER_INVAL         18  /* N Invalid argument */
+#define ZIP_ER_NOZIP         19  /* N Not a zip archive */
+#define ZIP_ER_INTERNAL      20  /* N Internal error */
+#define ZIP_ER_INCONS        21  /* N Zip archive inconsistent */
+#define ZIP_ER_REMOVE        22  /* S Can't remove file */
 
 
 /* type of system error value */
 
 #define ZIP_ET_NONE	      0  /* sys_err unused */
 #define ZIP_ET_SYS	      1  /* sys_err is errno */
-#define ZIP_ET_ZIP	      2  /* sys_err is zlib error code */
+#define ZIP_ET_ZLIB	      2  /* sys_err is zlib error code */
 
 /* compression methods */
 
diff --git a/lib/zip_add.c b/lib/zip_add.c
index a03b79a..0ac7ed2 100644
--- a/lib/zip_add.c
+++ b/lib/zip_add.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_add.c,v 1.11 2004/04/16 09:40:26 dillo Exp $
+  $NiH: zip_add.c,v 1.12 2004/06/24 16:26:08 dillo Exp $
 
   zip_add.c -- add file via callback function
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -44,7 +44,7 @@
 zip_add(struct zip *zf, const char *name, zip_read_func fn, void *state)
 {
     if (name == NULL) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 	
diff --git a/lib/zip_add_data.c b/lib/zip_add_data.c
index 7d3f7b0..0e433aa 100644
--- a/lib/zip_add_data.c
+++ b/lib/zip_add_data.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_add_data.c,v 1.7 2004/04/14 14:01:22 dillo Exp $
+  $NiH: zip_add_data.c,v 1.8 2004/04/16 09:40:26 dillo Exp $
 
   zip_add_data.c -- add file from buffer
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -45,7 +45,7 @@
 	     const void *data, off_t len, int freep)
 {
     if (name == NULL) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_add_file.c b/lib/zip_add_file.c
index 1b1fad6..f486b0a 100644
--- a/lib/zip_add_file.c
+++ b/lib/zip_add_file.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_add_file.c,v 1.8 2004/04/14 14:01:22 dillo Exp $
+  $NiH: zip_add_file.c,v 1.9 2004/04/16 09:40:27 dillo Exp $
 
   zip_add_file.c -- add file from file system
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -45,7 +45,7 @@
 	     const char *fname, off_t start, off_t len)
 {
     if (name == NULL) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_add_filep.c b/lib/zip_add_filep.c
index a32959f..c68daec 100644
--- a/lib/zip_add_filep.c
+++ b/lib/zip_add_filep.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_add_filep.c,v 1.7 2004/04/14 14:01:22 dillo Exp $
+  $NiH: zip_add_filep.c,v 1.8 2004/04/16 09:40:27 dillo Exp $
 
   zip_add_filep.c -- add file from FILE*
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -45,7 +45,7 @@
 	      FILE *file, off_t start, off_t len)
 {
     if (name == NULL) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_add_zip.c b/lib/zip_add_zip.c
index b1f05b8..26a3746 100644
--- a/lib/zip_add_zip.c
+++ b/lib/zip_add_zip.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_add_zip.c,v 1.8 2004/04/14 14:01:22 dillo Exp $
+  $NiH: zip_add_zip.c,v 1.9 2004/04/16 09:40:27 dillo Exp $
 
   zip_add_zip.c -- add file from zip file
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -45,7 +45,7 @@
 	    struct zip *srczf, int srcidx, int flags, off_t start, off_t len)
 {
     if (name == NULL) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_close.c b/lib/zip_close.c
index 5f85f1a..9e96dc9 100644
--- a/lib/zip_close.c
+++ b/lib/zip_close.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_close.c,v 1.41 2004/04/19 11:49:12 dillo Exp $
+  $NiH: zip_close.c,v 1.42 2004/06/24 15:01:57 dillo Exp $
 
   zip_close.c -- close zip archive and update changes
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -94,7 +94,7 @@
 	return -1;
 
     if ((temp=malloc(strlen(za->zn)+8)) == NULL) {
-	_zip_error_set(&za->error, ZERR_MEMORY, 0);
+	_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
 	_zip_cdir_free(cd);
 	return -1;
     }
@@ -102,14 +102,14 @@
     sprintf(temp, "%s.XXXXXX", za->zn);
 
     if ((tfd=mkstemp(temp)) == -1) {
-	_zip_error_set(&za->error, ZERR_TMPOPEN, errno);
+	_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
 	_zip_cdir_free(cd);
 	free(temp);
 	return -1;
     }
     
     if ((tfp=fdopen(tfd, "r+b")) == NULL) {
-	_zip_error_set(&za->error, ZERR_TMPOPEN, errno);
+	_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
 	_zip_cdir_free(cd);
 	close(tfd);
 	remove(temp);
@@ -142,7 +142,7 @@
 	}
 	else {
 	    if (fseek(za->zp, za->cdir->entry[i].offset, SEEK_SET) != 0) {
-		_zip_error_set(&za->error, ZERR_SEEK, errno);
+		_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
 		error = 1;
 		break;
 	    }
@@ -216,7 +216,7 @@
     }
     
     if (rename(temp, za->zn) != 0) {
-	_zip_error_set(&za->error, ZERR_RENAME, errno);
+	_zip_error_set(&za->error, ZIP_ER_RENAME, errno);
 	remove(temp);
 	free(temp);
 	return -1;
@@ -279,7 +279,7 @@
     offend = ftell(ft);
 
     if (fseek(ft, offstart, SEEK_SET) < 0) {
-	_zip_error_set(&za->error, ZERR_SEEK, errno);
+	_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
 	return -1;
     }
     
@@ -293,7 +293,7 @@
 	return -1;
     
     if (fseek(ft, offend, SEEK_SET) < 0) {
-	_zip_error_set(&za->error, ZERR_SEEK, errno);
+	_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
 	return -1;
     }
 
@@ -312,7 +312,7 @@
     st->comp_size = 0;
     while ((n=rf(ud, buf, sizeof(buf), ZIP_CMD_READ)) > 0) {
 	if (fwrite(buf, 1, n, ft) != n) {
-	    _zip_error_set(error, ZERR_WRITE, errno);
+	    _zip_error_set(error, ZIP_ER_WRITE, errno);
 	    return -1;
 	}
 	
@@ -376,7 +376,7 @@
 
 	ret = deflate(&zstr, flush);
 	if (ret != Z_OK && ret != Z_STREAM_END) {
-	    _zip_error_set(error, ZERR_ZLIB, ret);
+	    _zip_error_set(error, ZIP_ER_ZLIB, ret);
 	    return -1;
 	}
 	
@@ -384,7 +384,7 @@
 	    n = sizeof(b2) - zstr.avail_out;
 	    
 	    if (fwrite(b2, 1, n, ft) != n) {
-		_zip_error_set(error, ZERR_WRITE, errno);
+		_zip_error_set(error, ZIP_ER_WRITE, errno);
 		return -1;
 	    }
 	
@@ -410,7 +410,7 @@
     int e[2];
 
     if ((rf(ud, e, sizeof(e), ZIP_CMD_READ)) < sizeof(e)) {
-	error->zip_err = ZERR_INTERNAL;
+	error->zip_err = ZIP_ER_INTERNAL;
 	error->sys_err = 0;
     }
     else {
@@ -433,16 +433,16 @@
     while (len > 0) {
 	nn = len > sizeof(buf) ? sizeof(buf) : len;
 	if ((n=fread(buf, 1, nn, fs)) < 0) {
-	    _zip_error_set(error, ZERR_READ, errno);
+	    _zip_error_set(error, ZIP_ER_READ, errno);
 	    return -1;
 	}
 	else if (n == 0) {
-	    _zip_error_set(error, ZERR_EOF, 0);
+	    _zip_error_set(error, ZIP_ER_EOF, 0);
 	    return -1;
 	}
 
 	if (fwrite(buf, 1, n, ft) != n) {
-	    _zip_error_set(error, ZERR_WRITE, errno);
+	    _zip_error_set(error, ZIP_ER_WRITE, errno);
 	    return -1;
 	}
 	
diff --git a/lib/zip_delete.c b/lib/zip_delete.c
index 9d6c5f0..b526f17 100644
--- a/lib/zip_delete.c
+++ b/lib/zip_delete.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_delete.c,v 1.12 2004/04/14 14:01:23 dillo Exp $
+  $NiH: zip_delete.c,v 1.13 2004/04/16 09:40:27 dillo Exp $
 
   zip_delete.c -- delete file from zip archive
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -44,7 +44,7 @@
 zip_delete(struct zip *zf, int idx)
 {
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_dirent.c b/lib/zip_dirent.c
index 6335053..7fcbe1d 100644
--- a/lib/zip_dirent.c
+++ b/lib/zip_dirent.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_dirent.c,v 1.1.2.10 2004/04/13 19:47:58 dillo Exp $
+  $NiH: zip_dirent.c,v 1.2 2004/04/14 14:01:23 dillo Exp $
 
   zip_dirent.c -- read directory entry (local or central), clean dirent
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -78,12 +78,12 @@
     struct zip_cdir *cd;
     
     if ((cd=malloc(sizeof(*cd))) == NULL) {
-	_zip_error_set(error, ZERR_MEMORY, 0);
+	_zip_error_set(error, ZIP_ER_MEMORY, 0);
 	return NULL;
     }
 
     if ((cd->entry=malloc(sizeof(*(cd->entry))*nentry)) == NULL) {
-	_zip_error_set(error, ZERR_MEMORY, 0);
+	_zip_error_set(error, ZIP_ER_MEMORY, 0);
 	free(cd);
 	return NULL;
     }
@@ -125,7 +125,7 @@
     fwrite(cd->comment, 1, cd->comment_len, fp);
 
     if (ferror(fp)) {
-	_zip_error_set(error, ZERR_WRITE, errno);
+	_zip_error_set(error, ZIP_ER_WRITE, errno);
 	return -1;
     }
 
@@ -205,14 +205,14 @@
 	/* use data from buffer */
 	cur = *bufp;
 	if (left < size) {
-	    _zip_error_set(error, ZERR_NOZIP, 0);
+	    _zip_error_set(error, ZIP_ER_NOZIP, 0);
 	    return -1;
 	}
     }
     else {
 	/* read entry from disk */
 	if ((fread(buf, 1, size, fp)<size)) {
-	    _zip_error_set(error, ZERR_READ, errno);
+	    _zip_error_set(error, ZIP_ER_READ, errno);
 	    return -1;
 	}
 	left = size;
@@ -220,7 +220,7 @@
     }
 
     if (memcmp(cur, (localp ? LOCAL_MAGIC : CENTRAL_MAGIC), 4) != 0) {
-	/* XXX: zip_err = ZERR_NOZIP; */
+	/* XXX: zip_err = ZIP_ER_NOZIP; */
 	return -1;
     }
     cur += 4;
@@ -269,7 +269,7 @@
     if (bufp) {
 	if (left < CDENTRYSIZE + (zde->filename_len+zde->extrafield_len
 				  +zde->comment_len)) {
-	    _zip_error_set(error, ZERR_NOZIP, 0);
+	    _zip_error_set(error, ZIP_ER_NOZIP, 0);
 	    return -1;
 	}
 
@@ -376,7 +376,7 @@
     }
 
     if (ferror(fp)) {
-	_zip_error_set(error, ZERR_WRITE, errno);
+	_zip_error_set(error, ZIP_ER_WRITE, errno);
 	return -1;
     }
 
@@ -440,13 +440,13 @@
 
     r = (char *)malloc(nulp?len+1:len);
     if (!r) {
-	_zip_error_set(error, ZERR_MEMORY, 0);
+	_zip_error_set(error, ZIP_ER_MEMORY, 0);
 	return NULL;
     }
 
     if (fread(r, 1, len, fp)<len) {
 	free(r);
-	_zip_error_set(error, ZERR_READ, errno);
+	_zip_error_set(error, ZIP_ER_READ, errno);
 	return NULL;
     }
 
@@ -471,7 +471,7 @@
 
     r = (char *)malloc(nulp?len+1:len);
     if (!r) {
-	_zip_error_set(error, ZERR_MEMORY, 0);
+	_zip_error_set(error, ZIP_ER_MEMORY, 0);
 	return NULL;
     }
     
diff --git a/lib/zip_error_str.c b/lib/zip_error_str.c
index 9f6560f..5fdabba 100644
--- a/lib/zip_error_str.c
+++ b/lib/zip_error_str.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_error_str.c,v 1.2 2004/04/14 14:01:23 dillo Exp $
+  $NiH: zip_error_str.c,v 1.3 2004/04/16 09:40:28 dillo Exp $
 
   zip_error_str.c -- get string representation of zip error code
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -60,7 +60,7 @@
 	ss = strerror(se);
 	break;
 	
-    case ZIP_ET_ZIP:
+    case ZIP_ET_ZLIB:
 	ss = zError(se);
 	break;
 	
diff --git a/lib/zip_error_strerror.c b/lib/zip_error_strerror.c
index fae7c1c..90c56a1 100644
--- a/lib/zip_error_strerror.c
+++ b/lib/zip_error_strerror.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_error_strerror.c,v 1.1 2003/10/05 16:05:22 dillo Exp $
+  $NiH: zip_error_strerror.c,v 1.2 2003/10/06 02:50:06 dillo Exp $
 
   zip_error_sterror.c -- get string representation of struct zip_error
   Copyright (C) 1999, 2003 Dieter Baron and Thomas Klausner
@@ -66,7 +66,7 @@
 	    ss = strerror(err->sys_err);
 	    break;
 
-	case ZIP_ET_ZIP:
+	case ZIP_ET_ZLIB:
 	    ss = zError(err->sys_err);
 	    break;
 
@@ -79,7 +79,7 @@
 	return zs;
     else {
 	if ((s=malloc(strlen(ss) + (zs ? strlen(zs)+2 : 0) + 1)) == NULL)
-	    return _zip_err_str[ZERR_MEMORY];
+	    return _zip_err_str[ZIP_ER_MEMORY];
 	
 	sprintf(s, "%s%s%s",
 		(zs ? zs : ""),
diff --git a/lib/zip_file_get_offset.c b/lib/zip_file_get_offset.c
index 2d25c3d..228138f 100644
--- a/lib/zip_file_get_offset.c
+++ b/lib/zip_file_get_offset.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_file_get_offset.c,v 1.1.2.2 2004/04/06 20:27:22 dillo Exp $
+  $NiH: zip_file_get_offset.c,v 1.2 2004/04/14 14:01:24 dillo Exp $
 
   zip_file_get_offset.c -- get offset of file data in archive.
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -63,7 +63,7 @@
     offset = za->cdir->entry[idx].offset;
 
     if (fseek(za->zp, offset, SEEK_SET) != 0) {
-	_zip_error_set(&za->error, ZERR_SEEK, errno);
+	_zip_error_set(&za->error, ZIP_ER_SEEK, errno);
 	return 0;
     }
 
diff --git a/lib/zip_fopen_index.c b/lib/zip_fopen_index.c
index 0af082b..02374b3 100644
--- a/lib/zip_fopen_index.c
+++ b/lib/zip_fopen_index.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_fopen_index.c,v 1.18 2004/04/16 09:40:28 dillo Exp $
+  $NiH: zip_fopen_index.c,v 1.19 2004/04/19 11:49:13 dillo Exp $
 
   zip_fopen_index.c -- open file in zip archive for reading by index
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -54,18 +54,18 @@
     struct zip_file *zff;
 
     if ((fileno < 0) || (fileno >= zf->nentry)) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return NULL;
     }
 
     if ((flags & ZIP_FL_UNCHANGED) == 0
 	&& ZIP_ENTRY_DATA_CHANGED(zf->entry+fileno)) {
-	_zip_error_set(&zf->error, ZERR_CHANGED, 0);
+	_zip_error_set(&zf->error, ZIP_ER_CHANGED, 0);
 	return NULL;
     }
 
     if (fileno >= zf->cdir->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return NULL;
     }
 
@@ -74,7 +74,7 @@
 	zfflags = ZIP_ZF_COMP;
     else {
 	if (zf->cdir->entry[fileno].comp_method != ZIP_CM_DEFLATE) {
-	    _zip_error_set(&zf->error, ZERR_COMPNOTSUPP, 0);
+	    _zip_error_set(&zf->error, ZIP_ER_COMPNOTSUPP, 0);
 	    return NULL;
 	}
 	zfflags = 0;
@@ -98,7 +98,7 @@
 	zff->bytes_left = zff->cbytes_left;
     else {
 	if ((zff->buffer=(char *)malloc(BUFSIZE)) == NULL) {
-	    _zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	    _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	    zip_fclose(zff);
 	    return NULL;
 	}
@@ -111,7 +111,7 @@
 	}
 
 	if ((zff->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) {
-	    _zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	    _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	    zip_fclose(zff);
 	    return NULL;
 	}
@@ -123,7 +123,7 @@
 	
 	/* negative value to tell zlib that there is no header */
 	if ((ret=inflateInit2(zff->zstr, -MAX_WBITS)) != Z_OK) {
-	    _zip_error_set(&zf->error, ZERR_ZLIB, ret);
+	    _zip_error_set(&zf->error, ZIP_ER_ZLIB, ret);
 	    zip_fclose(zff);
 	    return NULL;
 	}
@@ -139,14 +139,14 @@
 {
     int i, j;
 
-    if (zff->error.zip_err != ZERR_OK)
+    if (zff->error.zip_err != ZIP_ER_OK)
 	return -1;
 
     if ((zff->flags & ZIP_ZF_EOF) || zff->cbytes_left <= 0 || buflen <= 0)
 	return 0;
     
     if (fseek(zff->zf->zp, zff->fpos, SEEK_SET) < 0) {
-	_zip_error_set(&zff->error, ZERR_SEEK, errno);
+	_zip_error_set(&zff->error, ZIP_ER_SEEK, errno);
 	return -1;
     }
     if (buflen < zff->cbytes_left)
@@ -156,11 +156,11 @@
 
     j = fread(buf, 1, i, zff->zf->zp);
     if (j == 0) {
-	_zip_error_set(&zff->error, ZERR_EOF, 0);
+	_zip_error_set(&zff->error, ZIP_ER_EOF, 0);
 	j = -1;
     }
     else if (j < 0)
-	_zip_error_set(&zff->error, ZERR_READ, errno);
+	_zip_error_set(&zff->error, ZIP_ER_READ, errno);
     else {
 	zff->fpos += j;
 	zff->cbytes_left -= j;
@@ -178,7 +178,7 @@
     int n;
 
     if ((zff=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) {
-	_zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	_zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	return NULL;
     }
     
@@ -187,7 +187,7 @@
 	file = (struct zip_file **)realloc(zf->file,
 					   n*sizeof(struct zip_file *));
 	if (file == NULL) {
-	    _zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	    _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	    free(zff);
 	    return NULL;
 	}
diff --git a/lib/zip_fread.c b/lib/zip_fread.c
index 5c4ac30..c02b12e 100644
--- a/lib/zip_fread.c
+++ b/lib/zip_fread.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_fread.c,v 1.10 2004/04/16 09:40:28 dillo Exp $
+  $NiH: zip_fread.c,v 1.11 2004/04/17 19:15:30 dillo Exp $
 
   zip_fread.c -- read from file
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -59,7 +59,7 @@
 	if ((zff->flags & ZIP_ZF_COMP) == 0) {
 	    /* XXX: compare for stored */
 	    if (zff->crc != zff->crc_orig) {
-		_zip_error_set(&zff->error, ZERR_CRC, 0);
+		_zip_error_set(&zff->error, ZIP_ER_CRC, 0);
 		return -1;
 	    }
 	}
@@ -104,7 +104,7 @@
 	    if (zff->zstr->avail_in == 0) {
 		len = _zip_file_fillbuf(zff->buffer, BUFSIZE, zff);
 		if (len == 0) {
-		    _zip_error_set(&zff->error, ZERR_INCONS, 0);
+		    _zip_error_set(&zff->error, ZIP_ER_INCONS, 0);
 		    return -1;
 		}
 		else if (len < 0)
@@ -118,7 +118,7 @@
 	case Z_DATA_ERROR:
 	case Z_STREAM_ERROR:
 	case Z_MEM_ERROR:
-	    _zip_error_set(&zff->error, ZERR_ZLIB, ret);
+	    _zip_error_set(&zff->error, ZIP_ER_ZLIB, ret);
 	    return -1;
 	}
     }
diff --git a/lib/zip_free.c b/lib/zip_free.c
index 21378eb..59d4772 100644
--- a/lib/zip_free.c
+++ b/lib/zip_free.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_free.c,v 1.9 2004/04/14 14:01:24 dillo Exp $
+  $NiH: zip_free.c,v 1.10 2004/04/16 09:40:28 dillo Exp $
 
   zip_free.c -- free struct zip
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -69,7 +69,7 @@
     }
 
     for (i=0; i<zf->nfile; i++) {
-	zf->file[i]->flags = ZERR_ZIPCLOSED;
+	zf->file[i]->flags = ZIP_ER_ZIPCLOSED;
 	zf->file[i]->zf = NULL;
     }
 
diff --git a/lib/zip_get_name.c b/lib/zip_get_name.c
index 6b8ba22..ea64ebc 100644
--- a/lib/zip_get_name.c
+++ b/lib/zip_get_name.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_get_name.c,v 1.7 2004/04/14 14:01:25 dillo Exp $
+  $NiH: zip_get_name.c,v 1.8 2004/04/16 09:40:29 dillo Exp $
 
   zip_get_name.c -- get filename for a file in zip file
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -44,7 +44,7 @@
 zip_get_name(struct zip *zf, int idx)
 {
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return NULL;
     }
 
diff --git a/lib/zip_name_locate.c b/lib/zip_name_locate.c
index b062b2f..ad8d493 100644
--- a/lib/zip_name_locate.c
+++ b/lib/zip_name_locate.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_name_locate.c,v 1.12 2004/04/16 09:42:43 dillo Exp $
+  $NiH: zip_name_locate.c,v 1.13 2004/05/16 00:50:25 dillo Exp $
 
   zip_name_locate.c -- get index by name
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -50,7 +50,7 @@
     int i, n;
 
     if (fname == NULL) {
-	_zip_error_set(&za->error, ZERR_INVAL, 0);
+	_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
     
@@ -79,6 +79,6 @@
 	    return i;
     }
 
-    _zip_error_set(&za->error, ZERR_NOENT, 0);
+    _zip_error_set(&za->error, ZIP_ER_NOENT, 0);
     return -1;
 }
diff --git a/lib/zip_new.c b/lib/zip_new.c
index 1e6ae10..e722dd4 100644
--- a/lib/zip_new.c
+++ b/lib/zip_new.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_new.c,v 1.7 2004/04/14 14:01:26 dillo Exp $
+  $NiH: zip_new.c,v 1.8 2004/04/16 09:40:29 dillo Exp $
 
   zip_new.c -- create and init struct zip
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -52,7 +52,7 @@
 
     za = (struct zip *)malloc(sizeof(struct zip));
     if (!za) {
-	_zip_error_set(error, ZERR_MEMORY, 0);
+	_zip_error_set(error, ZIP_ER_MEMORY, 0);
 	return NULL;
     }
 
diff --git a/lib/zip_new_entry.c b/lib/zip_new_entry.c
index e35a423..7ed5caa 100644
--- a/lib/zip_new_entry.c
+++ b/lib/zip_new_entry.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_new_entry.c,v 1.9 2004/04/16 09:40:29 dillo Exp $
+  $NiH: zip_new_entry.c,v 1.10 2004/06/24 15:01:57 dillo Exp $
 
   zip_new_entry.c -- create and init struct zip_entry
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -49,7 +49,7 @@
     if (!zf) {
 	ze = (struct zip_entry *)malloc(sizeof(struct zip_entry));
 	if (!ze) {
-	    _zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	    _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	    return NULL;
 	}
     }
@@ -60,7 +60,7 @@
 						    sizeof(struct zip_entry)
 						    * zf->nentry_alloc);
 	    if (!zf->entry) {
-		_zip_error_set(&zf->error, ZERR_MEMORY, 0);
+		_zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 		return NULL;
 	    }
 	}
diff --git a/lib/zip_open.c b/lib/zip_open.c
index b68375d..dc1c7c5 100644
--- a/lib/zip_open.c
+++ b/lib/zip_open.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_open.c,v 1.21 2004/04/16 09:40:29 dillo Exp $
+  $NiH: zip_open.c,v 1.22 2004/04/19 11:49:13 dillo Exp $
 
   zip_open.c -- open zip archive
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -70,7 +70,7 @@
     struct zip_error error, err2;
 
     if (fn == NULL) {
-	set_error(zep, NULL, ZERR_INVAL);
+	set_error(zep, NULL, ZIP_ER_INVAL);
 	return NULL;
     }
     
@@ -84,25 +84,25 @@
 	    za->zn = strdup(fn);
 	    if (!za->zn) {
 		_zip_free(za);
-		set_error(zep, NULL, ZERR_MEMORY);
+		set_error(zep, NULL, ZIP_ER_MEMORY);
 		return NULL;
 	    }
 	    return za;
 	}
 	else {
-	    set_error(zep, NULL, ZERR_OPEN);
+	    set_error(zep, NULL, ZIP_ER_OPEN);
 	    return NULL;
 	}
     }
     else if ((flags & ZIP_EXCL)) {
-	set_error(zep, NULL, ZERR_EXISTS);
+	set_error(zep, NULL, ZIP_ER_EXISTS);
 	return NULL;
     }
     /* ZIP_CREATE gets ignored if file exists and not ZIP_EXCL,
        just like open() */
     
     if ((fp=fopen(fn, "rb")) == NULL) {
-	set_error(zep, NULL, ZERR_OPEN);
+	set_error(zep, NULL, ZIP_ER_OPEN);
 	return NULL;
     }
     
@@ -112,14 +112,14 @@
     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);
+	set_error(zep, NULL, ZIP_ER_SEEK);
 	fclose(fp);
 	return NULL;
     }
 
     /* 64k is too much for stack */
     if ((buf=(unsigned char *)malloc(CDBUFSIZE)) == NULL) {
-	set_error(zep, NULL, ZERR_MEMORY);
+	set_error(zep, NULL, ZIP_ER_MEMORY);
 	fclose(fp);
 	return NULL;
     }
@@ -128,7 +128,7 @@
     buflen = fread(buf, 1, CDBUFSIZE, fp);
 
     if (ferror(fp)) {
-	set_error(zep, NULL, ZERR_READ);
+	set_error(zep, NULL, ZIP_ER_READ);
 	free(buf);
 	fclose(fp);
 	return NULL;
@@ -171,7 +171,7 @@
     
     if (best < 0) {
 	/* no consistent eocd found */
-	set_error(zep, NULL, ZERR_NOZIP);
+	set_error(zep, NULL, ZIP_ER_NOZIP);
 	_zip_cdir_free(cdir);
 	fclose(fp);
 	return NULL;
@@ -188,13 +188,13 @@
     za->cdir = cdir;
     
     if ((za->zn=strdup(fn)) == NULL) {
-	set_error(zep, NULL, ZERR_MEMORY);
+	set_error(zep, NULL, ZIP_ER_MEMORY);
 	_zip_free(za);
 	return NULL;
     }
 
     if ((za->entry=malloc(sizeof(*(za->entry))*cdir->nentry)) == NULL) {
-	set_error(zep, NULL, ZERR_MEMORY);
+	set_error(zep, NULL, ZIP_ER_MEMORY);
 	_zip_free(za);
 	return NULL;
     }
@@ -240,18 +240,18 @@
     comlen = buf + buflen - eocd - EOCDLEN;
     if (comlen < 0) {
 	/* not enough bytes left for comment */
-	_zip_error_set(error, ZERR_NOZIP, 0);
+	_zip_error_set(error, ZIP_ER_NOZIP, 0);
 	return NULL;
     }
 
     /* check for end-of-central-dir magic */
     if (memcmp(eocd, EOCD_MAGIC, 4) != 0) {
-	_zip_error_set(error, ZERR_NOZIP, 0);
+	_zip_error_set(error, ZIP_ER_NOZIP, 0);
 	return NULL;
     }
 
     if (memcmp(eocd+4, "\0\0\0\0", 4) != 0) {
-	_zip_error_set(error, ZERR_MULTIDISK, 0);
+	_zip_error_set(error, ZIP_ER_MULTIDISK, 0);
 	return NULL;
     }
 
@@ -275,7 +275,7 @@
 	|| (cd->nentry != i)) {
 	/* comment size wrong -- too few or too many left after central dir */
 	/* or number of cdir-entries on this disk != number of cdir-entries */
-	_zip_error_set(error, ZERR_NOZIP, 0);
+	_zip_error_set(error, ZIP_ER_NOZIP, 0);
 	free(cd);
 	return NULL;
     }
@@ -297,9 +297,9 @@
 	if (ferror(fp) || (ftell(fp) != cd->offset)) {
 	    /* seek error or offset of cdir wrong */
 	    if (ferror(fp))
-		_zip_error_set(error, ZERR_SEEK, errno);
+		_zip_error_set(error, ZIP_ER_SEEK, errno);
 	    else
-		_zip_error_set(error, ZERR_NOZIP, 0);
+		_zip_error_set(error, ZIP_ER_NOZIP, 0);
 	    free(cd);
 	    return NULL;
 	}
@@ -342,7 +342,7 @@
 	if (cd->entry[i].offset < min)
 	    min = cd->entry[i].offset;
 	if (min < 0) {
-	    _zip_error_set(error, ZERR_NOZIP, 0);
+	    _zip_error_set(error, ZIP_ER_NOZIP, 0);
 	    return -1;
 	}
 	
@@ -351,12 +351,12 @@
 	if (j > max)
 	    max = j;
 	if (max > cd->offset) {
-	    _zip_error_set(error, ZERR_NOZIP, 0);
+	    _zip_error_set(error, ZIP_ER_NOZIP, 0);
 	    return -1;
 	}
 	
 	if (fseek(fp, cd->entry[i].offset, SEEK_SET) != 0) {
-	    _zip_error_set(error, ZERR_SEEK, 0);
+	    _zip_error_set(error, ZIP_ER_SEEK, 0);
 	    return -1;
 	}
 	
@@ -364,7 +364,7 @@
 	    return -1;
 	
 	if (_zip_headercomp(cd->entry+i, 0, &temp, 1) != 0) {
-	    _zip_error_set(error, ZERR_NOZIP, 0);
+	    _zip_error_set(error, ZIP_ER_NOZIP, 0);
 	    _zip_dirent_finalize(&temp);
 	    return -1;
 	}
@@ -453,7 +453,7 @@
 
     ret = malloc(len);
     if (!ret) {
-	/* XXX: zip_err = ZERR_MEMORY; */
+	/* XXX: zip_err = ZIP_ER_MEMORY; */
 	return NULL;
     }
 
diff --git a/lib/zip_rename.c b/lib/zip_rename.c
index 70ebedc..477dd5c 100644
--- a/lib/zip_rename.c
+++ b/lib/zip_rename.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_rename.c,v 1.11 2004/04/14 14:01:27 dillo Exp $
+  $NiH: zip_rename.c,v 1.12 2004/04/16 09:40:29 dillo Exp $
 
   zip_rename.c -- rename file in zip archive
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -44,7 +44,7 @@
 zip_rename(struct zip *zf, int idx, const char *name)
 {
     if (idx >= zf->nentry || idx < 0) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_replace.c b/lib/zip_replace.c
index 4506f73..8206aa5 100644
--- a/lib/zip_replace.c
+++ b/lib/zip_replace.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_replace.c,v 1.14 2004/06/24 15:01:58 dillo Exp $
+  $NiH: zip_replace.c,v 1.15 2004/06/24 16:26:08 dillo Exp $
 
   zip_replace.c -- replace file via callback function
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -44,7 +44,7 @@
 zip_replace(struct zip *zf, int idx, zip_read_func fn, void *state)
 {
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zip_replace_data.c b/lib/zip_replace_data.c
index 68ce5da..a0ad7c5 100644
--- a/lib/zip_replace_data.c
+++ b/lib/zip_replace_data.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_replace_data.c,v 1.15 2004/06/24 15:01:58 dillo Exp $
+  $NiH: zip_replace_data.c,v 1.16 2004/06/24 16:26:08 dillo Exp $
 
   zip_replace_data.c -- replace file from buffer
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -57,7 +57,7 @@
 		 const void *data, off_t len, int freep)
 {
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
     
@@ -73,7 +73,7 @@
     struct read_data *f;
 
     if ((f=malloc(sizeof(*f))) == NULL) {
-	_zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	_zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	return -1;
     }
 
diff --git a/lib/zip_replace_file.c b/lib/zip_replace_file.c
index 7983c34..4641b7a 100644
--- a/lib/zip_replace_file.c
+++ b/lib/zip_replace_file.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_replace_file.c,v 1.12 2004/04/14 14:01:27 dillo Exp $
+  $NiH: zip_replace_file.c,v 1.13 2004/04/16 09:40:30 dillo Exp $
 
   zip_replace_file.c -- replace file from file system
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -48,7 +48,7 @@
 		 const char *fname, off_t start, off_t len)
 {
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
@@ -64,7 +64,7 @@
     FILE *fp;
 
     if ((fp=fopen(fname, "rb")) == NULL) {
-	_zip_error_set(&zf->error, ZERR_OPEN, errno);
+	_zip_error_set(&zf->error, ZIP_ER_OPEN, errno);
 	return -1;
     }
 
diff --git a/lib/zip_replace_filep.c b/lib/zip_replace_filep.c
index b45329f..d6ac9d3 100644
--- a/lib/zip_replace_filep.c
+++ b/lib/zip_replace_filep.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_replace_filep.c,v 1.10 2004/06/24 15:01:58 dillo Exp $
+  $NiH: zip_replace_filep.c,v 1.11 2004/06/24 16:26:08 dillo Exp $
 
   zip_replace_filep.c -- replace file from FILE*
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -61,7 +61,7 @@
 		  FILE *file, off_t start, off_t len)
 {
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
     
@@ -77,7 +77,7 @@
     struct read_file *f;
 
     if ((f=(struct read_file *)malloc(sizeof(struct read_file))) == NULL) {
-	_zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	_zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	return -1;
     }
 
@@ -103,7 +103,7 @@
     switch (cmd) {
     case ZIP_CMD_OPEN:
 	if (fseeko(z->f, z->off, SEEK_SET) < 0) {
-	    z->e[0] = ZERR_SEEK;
+	    z->e[0] = ZIP_ER_SEEK;
 	    z->e[1] = errno;
 	    return -1;
 	}
@@ -117,7 +117,7 @@
 	    n = len;
 	
 	if ((i=fread(buf, 1, n, z->f)) < 0) {
-	    z->e[0] = ZERR_READ;
+	    z->e[0] = ZIP_ER_READ;
 	    z->e[1] = errno;
 	    return -1;
 	}
@@ -141,7 +141,7 @@
 	    st = (struct zip_stat *)data;
 
 	    if (fstat(fileno(z->f), &fst) != 0) {
-		z->e[0] = ZERR_READ; /* best match */
+		z->e[0] = ZIP_ER_READ; /* best match */
 		z->e[1] = errno;
 		return -1;
 	    }
diff --git a/lib/zip_replace_zip.c b/lib/zip_replace_zip.c
index 2dd2168..a785408 100644
--- a/lib/zip_replace_zip.c
+++ b/lib/zip_replace_zip.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_replace_zip.c,v 1.22 2004/06/24 15:01:58 dillo Exp $
+  $NiH: zip_replace_zip.c,v 1.23 2004/06/24 16:26:08 dillo Exp $
 
   zip_replace_zip.c -- replace file from zip file
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -57,7 +57,7 @@
 		off_t start, off_t len)
 {
     if (srcidx < 0 || srcidx >= srczf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
@@ -76,7 +76,7 @@
 
     if ((flags & ZIP_FL_UNCHANGED) == 0
 	&& ZIP_ENTRY_DATA_CHANGED(srczf->entry+srcidx)) {
-	_zip_error_set(&zf->error, ZERR_CHANGED, 0);
+	_zip_error_set(&zf->error, ZIP_ER_CHANGED, 0);
 	return -1;
     }
 
@@ -89,7 +89,7 @@
 	flags &= ~ZIP_FL_COMPRESSED;
 
     if ((p=malloc(sizeof(*p))) == NULL) {
-	_zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	_zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	return -1;
     }
 	
diff --git a/lib/zip_set_name.c b/lib/zip_set_name.c
index ba4230d..f1c5223 100644
--- a/lib/zip_set_name.c
+++ b/lib/zip_set_name.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_set_name.c,v 1.11 2004/04/14 14:01:28 dillo Exp $
+  $NiH: zip_set_name.c,v 1.12 2004/04/16 09:40:30 dillo Exp $
 
   zip_set_name.c -- rename helper function
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -48,13 +48,13 @@
     char *s;
     
     if (idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
     if (name != NULL) {
 	if ((s=strdup(name)) == NULL) {
-	    _zip_error_set(&zf->error, ZERR_MEMORY, 0);
+	    _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0);
 	    return -1;
 	}
 	
diff --git a/lib/zip_stat_index.c b/lib/zip_stat_index.c
index 8822659..4c14c73 100644
--- a/lib/zip_stat_index.c
+++ b/lib/zip_stat_index.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_stat_index.c,v 1.3 2004/04/15 23:47:42 dillo Exp $
+  $NiH: zip_stat_index.c,v 1.4 2004/04/16 09:40:30 dillo Exp $
 
   zip_stat_index.c -- get information about file by index
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -44,7 +44,7 @@
 zip_stat_index(struct zip *za, int index, int flags, struct zip_stat *st)
 {
     if (index < 0 || index >= za->nentry) {
-	_zip_error_set(&za->error, ZERR_INVAL, 0);
+	_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
@@ -52,13 +52,13 @@
 	&& ZIP_ENTRY_DATA_CHANGED(za->entry+index)) {
 	if (za->entry[index].ch_func(za->entry[index].ch_data,
 				     st, sizeof(*st), ZIP_CMD_STAT) < 0) {
-	    _zip_error_set(&za->error, ZERR_CHANGED, 0);
+	    _zip_error_set(&za->error, ZIP_ER_CHANGED, 0);
 	    return -1;
 	}
     }
     else {
 	if (index >= za->cdir->nentry) {
-	    _zip_error_set(&za->error, ZERR_INVAL, 0);
+	    _zip_error_set(&za->error, ZIP_ER_INVAL, 0);
 	    return -1;
 	}
 	
diff --git a/lib/zip_unchange.c b/lib/zip_unchange.c
index e3a76ee..a4a9c3b 100644
--- a/lib/zip_unchange.c
+++ b/lib/zip_unchange.c
@@ -1,5 +1,5 @@
 /*
-  $NiH: zip_unchange.c,v 1.12 2004/04/14 14:01:28 dillo Exp $
+  $NiH: zip_unchange.c,v 1.13 2004/04/16 09:40:31 dillo Exp $
 
   zip_unchange.c -- undo changes to file in zip archive
   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
@@ -47,7 +47,7 @@
     int ret;
     
     if (!zf || idx < 0 || idx >= zf->nentry) {
-	_zip_error_set(&zf->error, ZERR_INVAL, 0);
+	_zip_error_set(&zf->error, ZIP_ER_INVAL, 0);
 	return -1;
     }
 
diff --git a/lib/zipint.h b/lib/zipint.h
index 30626f6..61b94bc 100644
--- a/lib/zipint.h
+++ b/lib/zipint.h
@@ -3,7 +3,7 @@
 #define _HAD_ZIPINT_H
 
 /*
-  $NiH: zipint.h,v 1.26 2004/06/24 15:01:59 dillo Exp $
+  $NiH: zipint.h,v 1.27 2004/06/24 16:26:09 dillo Exp $
 
   zipint.h -- internal declarations.
   Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
@@ -65,7 +65,7 @@
 /* error information */
 
 struct zip_error {
-    int zip_err;	/* libzip error code (ZERR_*) */
+    int zip_err;	/* libzip error code (ZIP_ER_*) */
     int sys_err;	/* copy of errno (E*) or zlib error code */
     char *str;		/* string representation or NULL */
 };