Lines Matching refs:cd
172 struct zip_cdir *cd; in _zip_readcdir() local
201 if ((cd=_zip_cdir_new(nentry, error)) == NULL) in _zip_readcdir()
204 cd->size = _zip_read4(&cdp); in _zip_readcdir()
205 cd->offset = _zip_read4(&cdp); in _zip_readcdir()
206 cd->comment = NULL; in _zip_readcdir()
207 cd->comment_len = _zip_read2(&cdp); in _zip_readcdir()
209 if (((zip_uint64_t)cd->offset)+cd->size > buf_offset + (eocd-buf)) { in _zip_readcdir()
212 cd->nentry = 0; in _zip_readcdir()
213 _zip_cdir_free(cd); in _zip_readcdir()
217 if ((comlen < cd->comment_len) || (cd->nentry != i)) { in _zip_readcdir()
219 cd->nentry = 0; in _zip_readcdir()
220 _zip_cdir_free(cd); in _zip_readcdir()
223 if ((flags & ZIP_CHECKCONS) && comlen != cd->comment_len) { in _zip_readcdir()
225 cd->nentry = 0; in _zip_readcdir()
226 _zip_cdir_free(cd); in _zip_readcdir()
230 if (cd->comment_len) { in _zip_readcdir()
231 if ((cd->comment=(char *)_zip_memdup(eocd+EOCDLEN, in _zip_readcdir()
232 cd->comment_len, error)) in _zip_readcdir()
234 cd->nentry = 0; in _zip_readcdir()
235 _zip_cdir_free(cd); in _zip_readcdir()
240 if (cd->offset >= buf_offset) { in _zip_readcdir()
242 cdp = buf + (cd->offset - buf_offset); in _zip_readcdir()
249 fseeko(fp, cd->offset, SEEK_SET); in _zip_readcdir()
252 if (ferror(fp) || ((unsigned long)ftello(fp) != cd->offset)) { in _zip_readcdir()
258 cd->nentry = 0; in _zip_readcdir()
259 _zip_cdir_free(cd); in _zip_readcdir()
264 left = cd->size; in _zip_readcdir()
266 while (i<cd->nentry && left > 0) { in _zip_readcdir()
267 if ((_zip_dirent_read(cd->entry+i, fp, bufp, &left, 0, error)) < 0) { in _zip_readcdir()
268 cd->nentry = i; in _zip_readcdir()
269 _zip_cdir_free(cd); in _zip_readcdir()
274 if (i == cd->nentry && left > 0) { in _zip_readcdir()
277 if (_zip_cdir_grow(cd, cd->nentry+ZIP_UINT16_MAX, error) < 0) { in _zip_readcdir()
278 cd->nentry = i; in _zip_readcdir()
279 _zip_cdir_free(cd); in _zip_readcdir()
285 cd->nentry = i; in _zip_readcdir()
287 return cd; in _zip_readcdir()
299 _zip_checkcons(FILE *fp, struct zip_cdir *cd, struct zip_error *error) in _zip_checkcons() argument
305 if (cd->nentry) { in _zip_checkcons()
306 max = cd->entry[0].offset; in _zip_checkcons()
307 min = cd->entry[0].offset; in _zip_checkcons()
312 for (i=0; i<cd->nentry; i++) { in _zip_checkcons()
313 if (cd->entry[i].offset < min) in _zip_checkcons()
314 min = cd->entry[i].offset; in _zip_checkcons()
315 if (min > cd->offset) { in _zip_checkcons()
320 j = cd->entry[i].offset + cd->entry[i].comp_size in _zip_checkcons()
321 + cd->entry[i].filename_len + LENTRYSIZE; in _zip_checkcons()
324 if (max > cd->offset) { in _zip_checkcons()
329 if (fseeko(fp, cd->entry[i].offset, SEEK_SET) != 0) { in _zip_checkcons()
337 if (_zip_headercomp(cd->entry+i, 0, &temp, 1) != 0) { in _zip_checkcons()