Try to be consistent in calling struct zips za and struct zip_files zf. --HG-- branch : HEAD
diff --git a/lib/zip_delete.c b/lib/zip_delete.c index b526f17..a234ed2 100644 --- a/lib/zip_delete.c +++ b/lib/zip_delete.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_delete.c,v 1.13 2004/04/16 09:40:27 dillo Exp $ + $NiH: zip_delete.c,v 1.14 2004/11/17 21:55:10 wiz Exp $ zip_delete.c -- delete file from zip archive Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner @@ -41,17 +41,17 @@ int -zip_delete(struct zip *zf, int idx) +zip_delete(struct zip *za, int idx) { - if (idx < 0 || idx >= zf->nentry) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if (idx < 0 || idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - if (zip_unchange(zf, idx) != 0) + if (zip_unchange(za, idx) != 0) return -1; - zf->entry[idx].state = ZIP_ST_DELETED; + za->entry[idx].state = ZIP_ST_DELETED; return 0; }
diff --git a/lib/zip_fclose.c b/lib/zip_fclose.c index 1119192..9c6bbb5 100644 --- a/lib/zip_fclose.c +++ b/lib/zip_fclose.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_fclose.c,v 1.10 2004/04/16 09:40:28 dillo Exp $ + $NiH: zip_fclose.c,v 1.11 2004/04/17 19:15:30 dillo Exp $ zip_fclose.c -- close file in zip archive Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner @@ -43,30 +43,30 @@ int -zip_fclose(struct zip_file *zff) +zip_fclose(struct zip_file *zf) { int i, ret; - if (zff->zstr) - inflateEnd(zff->zstr); - free(zff->buffer); - free(zff->zstr); + if (zf->zstr) + inflateEnd(zf->zstr); + free(zf->buffer); + free(zf->zstr); - for (i=0; i<zff->zf->nfile; i++) { - if (zff->zf->file[i] == zff) { - zff->zf->file[i] = zff->zf->file[zff->zf->nfile-1]; - zff->zf->nfile--; + for (i=0; i<zf->za->nfile; i++) { + if (zf->za->file[i] == zf) { + zf->za->file[i] = zf->za->file[zf->za->nfile-1]; + zf->za->nfile--; break; } } /* if EOF, compare CRC */ /* XXX: also compare for stored */ - if ((zff->flags & ZIP_ZF_COMP) == 0 && (zff->flags & ZIP_ZF_EOF)) - ret = (zff->crc_orig == zff->crc); + if ((zf->flags & ZIP_ZF_COMP) == 0 && (zf->flags & ZIP_ZF_EOF)) + ret = (zf->crc_orig == zf->crc); else - ret = zff->error.zip_err; + ret = zf->error.zip_err; - free(zff); + free(zf); return ret; }
diff --git a/lib/zip_fopen_index.c b/lib/zip_fopen_index.c index 02374b3..9ff4ffd 100644 --- a/lib/zip_fopen_index.c +++ b/lib/zip_fopen_index.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_fopen_index.c,v 1.19 2004/04/19 11:49:13 dillo Exp $ + $NiH: zip_fopen_index.c,v 1.20 2004/11/17 21:55:11 wiz Exp $ zip_fopen_index.c -- open file in zip archive for reading by index Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner @@ -42,128 +42,128 @@ #include "zip.h" #include "zipint.h" -static struct zip_file *_zip_file_new(struct zip *zf); +static struct zip_file *_zip_file_new(struct zip *za); struct zip_file * -zip_fopen_index(struct zip *zf, int fileno, int flags) +zip_fopen_index(struct zip *za, int fileno, int flags) { int len, ret; int zfflags; - struct zip_file *zff; + struct zip_file *zf; - if ((fileno < 0) || (fileno >= zf->nentry)) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if ((fileno < 0) || (fileno >= za->nentry)) { + _zip_error_set(&za->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, ZIP_ER_CHANGED, 0); + && ZIP_ENTRY_DATA_CHANGED(za->entry+fileno)) { + _zip_error_set(&za->error, ZIP_ER_CHANGED, 0); return NULL; } - if (fileno >= zf->cdir->nentry) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if (fileno >= za->cdir->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } if ((flags & ZIP_FL_COMPRESSED) - || (zf->cdir->entry[fileno].comp_method == ZIP_CM_STORE)) + || (za->cdir->entry[fileno].comp_method == ZIP_CM_STORE)) zfflags = ZIP_ZF_COMP; else { - if (zf->cdir->entry[fileno].comp_method != ZIP_CM_DEFLATE) { - _zip_error_set(&zf->error, ZIP_ER_COMPNOTSUPP, 0); + if (za->cdir->entry[fileno].comp_method != ZIP_CM_DEFLATE) { + _zip_error_set(&za->error, ZIP_ER_COMPNOTSUPP, 0); return NULL; } zfflags = 0; } - zff = _zip_file_new(zf); + zf = _zip_file_new(za); - zff->flags = zfflags; - /* zff->name = zf->cdir->entry[fileno].filename; */ - zff->method = zf->cdir->entry[fileno].comp_method; - zff->bytes_left = zf->cdir->entry[fileno].uncomp_size; - zff->cbytes_left = zf->cdir->entry[fileno].comp_size; - zff->crc_orig = zf->cdir->entry[fileno].crc; + zf->flags = zfflags; + /* zf->name = za->cdir->entry[fileno].filename; */ + zf->method = za->cdir->entry[fileno].comp_method; + zf->bytes_left = za->cdir->entry[fileno].uncomp_size; + zf->cbytes_left = za->cdir->entry[fileno].comp_size; + zf->crc_orig = za->cdir->entry[fileno].crc; - if ((zff->fpos=_zip_file_get_offset(zf, fileno)) == 0) { - zip_fclose(zff); + if ((zf->fpos=_zip_file_get_offset(za, fileno)) == 0) { + zip_fclose(zf); return NULL; } - if (zff->flags & ZIP_ZF_COMP) - zff->bytes_left = zff->cbytes_left; + if (zf->flags & ZIP_ZF_COMP) + zf->bytes_left = zf->cbytes_left; else { - if ((zff->buffer=(char *)malloc(BUFSIZE)) == NULL) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); - zip_fclose(zff); + if ((zf->buffer=(char *)malloc(BUFSIZE)) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + zip_fclose(zf); return NULL; } - len = _zip_file_fillbuf(zff->buffer, BUFSIZE, zff); + len = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); if (len <= 0) { - _zip_error_copy(&zf->error, &zff->error); - zip_fclose(zff); + _zip_error_copy(&za->error, &zf->error); + zip_fclose(zf); return NULL; } - if ((zff->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); - zip_fclose(zff); + if ((zf->zstr = (z_stream *)malloc(sizeof(z_stream))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + zip_fclose(zf); return NULL; } - zff->zstr->zalloc = Z_NULL; - zff->zstr->zfree = Z_NULL; - zff->zstr->opaque = NULL; - zff->zstr->next_in = zff->buffer; - zff->zstr->avail_in = len; + zf->zstr->zalloc = Z_NULL; + zf->zstr->zfree = Z_NULL; + zf->zstr->opaque = NULL; + zf->zstr->next_in = zf->buffer; + zf->zstr->avail_in = len; /* negative value to tell zlib that there is no header */ - if ((ret=inflateInit2(zff->zstr, -MAX_WBITS)) != Z_OK) { - _zip_error_set(&zf->error, ZIP_ER_ZLIB, ret); - zip_fclose(zff); + if ((ret=inflateInit2(zf->zstr, -MAX_WBITS)) != Z_OK) { + _zip_error_set(&za->error, ZIP_ER_ZLIB, ret); + zip_fclose(zf); return NULL; } } - return zff; + return zf; } int -_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zff) +_zip_file_fillbuf(void *buf, size_t buflen, struct zip_file *zf) { int i, j; - if (zff->error.zip_err != ZIP_ER_OK) + if (zf->error.zip_err != ZIP_ER_OK) return -1; - if ((zff->flags & ZIP_ZF_EOF) || zff->cbytes_left <= 0 || buflen <= 0) + if ((zf->flags & ZIP_ZF_EOF) || zf->cbytes_left <= 0 || buflen <= 0) return 0; - if (fseek(zff->zf->zp, zff->fpos, SEEK_SET) < 0) { - _zip_error_set(&zff->error, ZIP_ER_SEEK, errno); + if (fseek(zf->za->zp, zf->fpos, SEEK_SET) < 0) { + _zip_error_set(&zf->error, ZIP_ER_SEEK, errno); return -1; } - if (buflen < zff->cbytes_left) + if (buflen < zf->cbytes_left) i = buflen; else - i = zff->cbytes_left; + i = zf->cbytes_left; - j = fread(buf, 1, i, zff->zf->zp); + j = fread(buf, 1, i, zf->za->zp); if (j == 0) { - _zip_error_set(&zff->error, ZIP_ER_EOF, 0); + _zip_error_set(&zf->error, ZIP_ER_EOF, 0); j = -1; } else if (j < 0) - _zip_error_set(&zff->error, ZIP_ER_READ, errno); + _zip_error_set(&zf->error, ZIP_ER_READ, errno); else { - zff->fpos += j; - zff->cbytes_left -= j; + zf->fpos += j; + zf->cbytes_left -= j; } return j; @@ -172,41 +172,41 @@ static struct zip_file * -_zip_file_new(struct zip *zf) +_zip_file_new(struct zip *za) { - struct zip_file *zff, **file; + struct zip_file *zf, **file; int n; - if ((zff=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); + if ((zf=(struct zip_file *)malloc(sizeof(struct zip_file))) == NULL) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } - if (zf->nfile >= zf->nfile_alloc-1) { - n = zf->nfile_alloc + 10; - file = (struct zip_file **)realloc(zf->file, + if (za->nfile >= za->nfile_alloc-1) { + n = za->nfile_alloc + 10; + file = (struct zip_file **)realloc(za->file, n*sizeof(struct zip_file *)); if (file == NULL) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); - free(zff); + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); + free(zf); return NULL; } - zf->nfile_alloc = n; - zf->file = file; + za->nfile_alloc = n; + za->file = file; } - zf->file[zf->nfile++] = zff; + za->file[za->nfile++] = zf; - zff->zf = zf; - _zip_error_init(&zff->error); - zff->flags = 0; - zff->crc = crc32(0L, Z_NULL, 0); - zff->crc_orig = 0; - zff->method = -1; - zff->bytes_left = zff->cbytes_left = 0; - zff->fpos = 0; - zff->buffer = NULL; - zff->zstr = NULL; + zf->za = za; + _zip_error_init(&zf->error); + zf->flags = 0; + zf->crc = crc32(0L, Z_NULL, 0); + zf->crc_orig = 0; + zf->method = -1; + zf->bytes_left = zf->cbytes_left = 0; + zf->fpos = 0; + zf->buffer = NULL; + zf->zstr = NULL; - return zff; + return zf; }
diff --git a/lib/zip_fread.c b/lib/zip_fread.c index c02b12e..11ad594 100644 --- a/lib/zip_fread.c +++ b/lib/zip_fread.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_fread.c,v 1.11 2004/04/17 19:15:30 dillo Exp $ + $NiH: zip_fread.c,v 1.12 2004/11/17 21:55:11 wiz Exp $ zip_fread.c -- read from file Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner @@ -41,50 +41,50 @@ ssize_t -zip_fread(struct zip_file *zff, void *outbuf, size_t toread) +zip_fread(struct zip_file *zf, void *outbuf, size_t toread) { int len, out_before, ret; - if (!zff) + if (!zf) return -1; - if (zff->error.zip_err != 0) + if (zf->error.zip_err != 0) return -1; - if ((zff->flags & ZIP_ZF_EOF) || (toread == 0)) + if ((zf->flags & ZIP_ZF_EOF) || (toread == 0)) return 0; - if (zff->bytes_left == 0) { - zff->flags |= ZIP_ZF_EOF; - if ((zff->flags & ZIP_ZF_COMP) == 0) { + if (zf->bytes_left == 0) { + zf->flags |= ZIP_ZF_EOF; + if ((zf->flags & ZIP_ZF_COMP) == 0) { /* XXX: compare for stored */ - if (zff->crc != zff->crc_orig) { - _zip_error_set(&zff->error, ZIP_ER_CRC, 0); + if (zf->crc != zf->crc_orig) { + _zip_error_set(&zf->error, ZIP_ER_CRC, 0); return -1; } } return 0; } - if (zff->flags & ZIP_ZF_COMP) { - ret = _zip_file_fillbuf(outbuf, toread, zff); + if (zf->flags & ZIP_ZF_COMP) { + ret = _zip_file_fillbuf(outbuf, toread, zf); if (ret > 0) { #if 0 /* XXX: compute for stored */ - zff->crc = crc32(zff->crc, outbuf, ret); + zf->crc = crc32(zf->crc, outbuf, ret); #endif - zff->bytes_left -= ret; + zf->bytes_left -= ret; } return ret; } - zff->zstr->next_out = outbuf; - zff->zstr->avail_out = toread; - out_before = zff->zstr->total_out; + zf->zstr->next_out = outbuf; + zf->zstr->avail_out = toread; + out_before = zf->zstr->total_out; /* endless loop until something has been accomplished */ for (;;) { - ret = inflate(zff->zstr, Z_SYNC_FLUSH); + ret = inflate(zf->zstr, Z_SYNC_FLUSH); switch (ret) { case Z_OK: @@ -92,25 +92,25 @@ /* all ok */ /* Z_STREAM_END probably won't happen, since we didn't have a header */ - len = zff->zstr->total_out - out_before; - if (len >= zff->bytes_left || len >= toread) { - zff->crc = crc32(zff->crc, outbuf, len); - zff->bytes_left -= len; + len = zf->zstr->total_out - out_before; + if (len >= zf->bytes_left || len >= toread) { + zf->crc = crc32(zf->crc, outbuf, len); + zf->bytes_left -= len; return len; } break; case Z_BUF_ERROR: - if (zff->zstr->avail_in == 0) { - len = _zip_file_fillbuf(zff->buffer, BUFSIZE, zff); + if (zf->zstr->avail_in == 0) { + len = _zip_file_fillbuf(zf->buffer, BUFSIZE, zf); if (len == 0) { - _zip_error_set(&zff->error, ZIP_ER_INCONS, 0); + _zip_error_set(&zf->error, ZIP_ER_INCONS, 0); return -1; } else if (len < 0) return -1; - zff->zstr->next_in = zff->buffer; - zff->zstr->avail_in = len; + zf->zstr->next_in = zf->buffer; + zf->zstr->avail_in = len; continue; } /* fallthrough */ @@ -118,7 +118,7 @@ case Z_DATA_ERROR: case Z_STREAM_ERROR: case Z_MEM_ERROR: - _zip_error_set(&zff->error, ZIP_ER_ZLIB, ret); + _zip_error_set(&zf->error, ZIP_ER_ZLIB, ret); return -1; } }
diff --git a/lib/zip_free.c b/lib/zip_free.c index 88c602c..b6b8ea6 100644 --- a/lib/zip_free.c +++ b/lib/zip_free.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_free.c,v 1.11 2004/11/17 21:55:11 wiz Exp $ + $NiH: zip_free.c,v 1.12 2004/11/18 15:04:04 wiz Exp $ zip_free.c -- free struct zip Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner @@ -46,36 +46,36 @@ corresponding file. */ void -_zip_free(struct zip *zf) +_zip_free(struct zip *za) { int i; - if (zf == NULL) + if (za == NULL) return; - if (zf->zn) - free(zf->zn); + if (za->zn) + free(za->zn); - if (zf->zp) - fclose(zf->zp); + if (za->zp) + fclose(za->zp); - _zip_cdir_free(zf->cdir); + _zip_cdir_free(za->cdir); - if (zf->entry) { - for (i=0; i<zf->nentry; i++) { - _zip_free_entry(zf->entry+i); + if (za->entry) { + for (i=0; i<za->nentry; i++) { + _zip_free_entry(za->entry+i); } - free(zf->entry); + free(za->entry); } - for (i=0; i<zf->nfile; i++) { - zf->file[i]->flags = ZIP_ER_ZIPCLOSED; - zf->file[i]->zf = NULL; + for (i=0; i<za->nfile; i++) { + za->file[i]->flags = ZIP_ER_ZIPCLOSED; + za->file[i]->za = NULL; } - free(zf->file); + free(za->file); - free(zf); + free(za); return; }
diff --git a/lib/zip_get_name.c b/lib/zip_get_name.c index ea64ebc..34f5f3a 100644 --- a/lib/zip_get_name.c +++ b/lib/zip_get_name.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_get_name.c,v 1.8 2004/04/16 09:40:29 dillo Exp $ + $NiH: zip_get_name.c,v 1.9 2004/11/17 21:55:11 wiz Exp $ zip_get_name.c -- get filename for a file in zip file Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner @@ -41,15 +41,15 @@ const char * -zip_get_name(struct zip *zf, int idx) +zip_get_name(struct zip *za, int idx) { - if (idx < 0 || idx >= zf->nentry) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if (idx < 0 || idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return NULL; } - if (zf->entry[idx].ch_filename) - return zf->entry[idx].ch_filename; + if (za->entry[idx].ch_filename) + return za->entry[idx].ch_filename; - return zf->cdir->entry[idx].filename; + return za->cdir->entry[idx].filename; }
diff --git a/lib/zip_new_entry.c b/lib/zip_new_entry.c index 026b277..9fa8fd5 100644 --- a/lib/zip_new_entry.c +++ b/lib/zip_new_entry.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_new_entry.c,v 1.11 2004/11/17 21:55:12 wiz Exp $ + $NiH: zip_new_entry.c,v 1.12 2004/11/18 15:04:05 wiz Exp $ zip_new_entry.c -- create and init struct zip_entry Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner @@ -43,28 +43,28 @@ struct zip_entry * -_zip_new_entry(struct zip *zf) +_zip_new_entry(struct zip *za) { struct zip_entry *ze; - if (!zf) { + if (!za) { ze = (struct zip_entry *)malloc(sizeof(struct zip_entry)); if (!ze) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } } else { - if (zf->nentry >= zf->nentry_alloc-1) { - zf->nentry_alloc += 16; - zf->entry = (struct zip_entry *)realloc(zf->entry, + if (za->nentry >= za->nentry_alloc-1) { + za->nentry_alloc += 16; + za->entry = (struct zip_entry *)realloc(za->entry, sizeof(struct zip_entry) - * zf->nentry_alloc); - if (!zf->entry) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); + * za->nentry_alloc); + if (!za->entry) { + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } } - ze = zf->entry+zf->nentry; + ze = za->entry+za->nentry; } ze->state = ZIP_ST_UNCHANGED; @@ -72,8 +72,8 @@ ze->ch_filename = NULL; ze->source = NULL; - if (zf) - zf->nentry++; + if (za) + za->nentry++; return ze; }
diff --git a/lib/zip_rename.c b/lib/zip_rename.c index 477dd5c..ab6b669 100644 --- a/lib/zip_rename.c +++ b/lib/zip_rename.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_rename.c,v 1.12 2004/04/16 09:40:29 dillo Exp $ + $NiH: zip_rename.c,v 1.13 2004/11/17 21:55:12 wiz Exp $ zip_rename.c -- rename file in zip archive Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner @@ -41,18 +41,18 @@ int -zip_rename(struct zip *zf, int idx, const char *name) +zip_rename(struct zip *za, int idx, const char *name) { - if (idx >= zf->nentry || idx < 0) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if (idx >= za->nentry || idx < 0) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } /* XXX: move this to _zip_set_name */ - if (zf->entry[idx].state == ZIP_ST_UNCHANGED) - zf->entry[idx].state = ZIP_ST_RENAMED; + if (za->entry[idx].state == ZIP_ST_UNCHANGED) + za->entry[idx].state = ZIP_ST_RENAMED; - _zip_set_name(zf, idx, name); + _zip_set_name(za, idx, name); return 0; }
diff --git a/lib/zip_set_name.c b/lib/zip_set_name.c index f1c5223..ac5f930 100644 --- a/lib/zip_set_name.c +++ b/lib/zip_set_name.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_set_name.c,v 1.12 2004/04/16 09:40:30 dillo Exp $ + $NiH: zip_set_name.c,v 1.13 2004/11/17 21:55:13 wiz Exp $ zip_set_name.c -- rename helper function Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner @@ -43,23 +43,23 @@ int -_zip_set_name(struct zip *zf, int idx, const char *name) +_zip_set_name(struct zip *za, int idx, const char *name) { char *s; - if (idx < 0 || idx >= zf->nentry) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if (idx < 0 || idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } if (name != NULL) { if ((s=strdup(name)) == NULL) { - _zip_error_set(&zf->error, ZIP_ER_MEMORY, 0); + _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return -1; } - free(zf->entry[idx].ch_filename); - zf->entry[idx].ch_filename = s; + free(za->entry[idx].ch_filename); + za->entry[idx].ch_filename = s; } return 0;
diff --git a/lib/zip_unchange.c b/lib/zip_unchange.c index 74c4040..412f431 100644 --- a/lib/zip_unchange.c +++ b/lib/zip_unchange.c
@@ -1,5 +1,5 @@ /* - $NiH: zip_unchange.c,v 1.14 2004/11/17 21:55:14 wiz Exp $ + $NiH: zip_unchange.c,v 1.15 2004/11/18 15:04:05 wiz Exp $ zip_unchange.c -- undo changes to file in zip archive Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner @@ -42,19 +42,19 @@ int -zip_unchange(struct zip *zf, int idx) +zip_unchange(struct zip *za, int idx) { - if (!zf || idx < 0 || idx >= zf->nentry) { - _zip_error_set(&zf->error, ZIP_ER_INVAL, 0); + if (!za || idx < 0 || idx >= za->nentry) { + _zip_error_set(&za->error, ZIP_ER_INVAL, 0); return -1; } - if (zf->entry[idx].ch_filename) { - free(zf->entry[idx].ch_filename); - zf->entry[idx].ch_filename = NULL; + if (za->entry[idx].ch_filename) { + free(za->entry[idx].ch_filename); + za->entry[idx].ch_filename = NULL; } - _zip_unchange_data(zf->entry+idx); + _zip_unchange_data(za->entry+idx); return 0; }
diff --git a/lib/zipint.h b/lib/zipint.h index a849c6f..946334f 100644 --- a/lib/zipint.h +++ b/lib/zipint.h
@@ -3,7 +3,7 @@ #define _HAD_ZIPINT_H /* - $NiH: zipint.h,v 1.28 2004/11/17 21:55:14 wiz Exp $ + $NiH: zipint.h,v 1.29 2004/11/18 15:04:06 wiz Exp $ zipint.h -- internal declarations. Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner @@ -89,7 +89,7 @@ /* file in zip archive, part of API */ struct zip_file { - struct zip *zf; /* zip archive containing this file */ + struct zip *za; /* zip archive containing this file */ struct zip_error error; /* error information */ int flags; /* -1: eof, >0: error */