renamed Z_ to ZIP_ST_ --HG-- branch : HEAD
diff --git a/lib/zip.h b/lib/zip.h index f8db283..7e1cb12 100644 --- a/lib/zip.h +++ b/lib/zip.h
@@ -5,7 +5,9 @@ #include <stdio.h> #include <zlib.h> -enum zip_state { Z_UNCHANGED, Z_DELETED, Z_REPLACED, Z_ADDED, Z_RENAMED }; +enum zip_state { ZIP_ST_UNCHANGED, ZIP_ST_DELETED, ZIP_ST_REPLACED, + ZIP_ST_ADDED, ZIP_ST_RENAMED }; +enum zip_cmd { ZIP_CMD_INIT, ZIP_CMD_READ, ZIP_CMD_CRC, ZIP_CMD_CLOSE }; /* flags for zip_open */ #define ZIP_CREATE 1 @@ -37,6 +39,9 @@ /* zip file */ +typedef unsigned long (*zip_read_func)(void *state, char *buf, + int len, enum zip_cmd cmd); + struct zip { char *zn; FILE *zp; @@ -79,6 +84,9 @@ enum zip_state state; char *fn, *ef, *fcom; char *fn_old; + + + /* only use one of the following three for supplying new data listed in order of priority, if more than one is set */ struct zip *ch_data_zf;
diff --git a/lib/zip_close.c b/lib/zip_close.c index 6d42588..c46df9d 100644 --- a/lib/zip_close.c +++ b/lib/zip_close.c
@@ -40,7 +40,7 @@ /* look if there really are any changes */ count = 0; for (i=0; i<zf->nentry; i++) { - if (zf->entry[i].state != Z_UNCHANGED) { + if (zf->entry[i].state != ZIP_ST_UNCHANGED) { count = 1; break; } @@ -91,7 +91,7 @@ if (zf->entry) { for (i=0; i<zf->nentry; i++) { switch (zf->entry[i].state) { - case Z_UNCHANGED: + case ZIP_ST_UNCHANGED: if (_zip_entry_copy(tzf, zf, i, NULL)) { /* zip_err set by _zip_entry_copy */ remove(tzf->zn); @@ -99,11 +99,11 @@ return -1; } break; - case Z_DELETED: + case ZIP_ST_DELETED: break; - case Z_REPLACED: + case ZIP_ST_REPLACED: /* fallthrough */ - case Z_ADDED: + case ZIP_ST_ADDED: if (zf->entry[i].ch_data_zf) { if (_zip_entry_copy(tzf, zf->entry[i].ch_data_zf, zf->entry[i].ch_data_zf_fileno, @@ -133,7 +133,7 @@ #endif /* 0 */ } break; - case Z_RENAMED: + case ZIP_ST_RENAMED: if (_zip_entry_copy(tzf, zf, i, NULL)) { /* zip_err set by _zip_entry_copy */ remove(tzf->zn);
diff --git a/lib/zip_fopen_index.c b/lib/zip_fopen_index.c index e41f67b..e4dad13 100644 --- a/lib/zip_fopen_index.c +++ b/lib/zip_fopen_index.c
@@ -20,8 +20,8 @@ return NULL; } - if (zf->entry[fileno].state != Z_UNCHANGED - && zf->entry[fileno].state != Z_RENAMED) { + if (zf->entry[fileno].state != ZIP_ST_UNCHANGED + && zf->entry[fileno].state != ZIP_ST_RENAMED) { zip_err = ZERR_CHANGED; return NULL; }