Lines Matching refs:cd
54 _zip_cdir_free(struct zip_cdir *cd) in _zip_cdir_free() argument
58 if (!cd) in _zip_cdir_free()
61 for (i=0; i<cd->nentry; i++) in _zip_cdir_free()
62 _zip_dirent_finalize(cd->entry+i); in _zip_cdir_free()
63 free(cd->comment); in _zip_cdir_free()
64 free(cd->entry); in _zip_cdir_free()
65 free(cd); in _zip_cdir_free()
71 _zip_cdir_grow(struct zip_cdir *cd, int nentry, struct zip_error *error) in _zip_cdir_grow() argument
75 if (nentry < cd->nentry) { in _zip_cdir_grow()
81 realloc(cd->entry, sizeof(*(cd->entry))*nentry))) == NULL) { in _zip_cdir_grow()
86 cd->nentry = nentry; in _zip_cdir_grow()
87 cd->entry = entry; in _zip_cdir_grow()
97 struct zip_cdir *cd; in _zip_cdir_new() local
99 if ((cd=(struct zip_cdir *)malloc(sizeof(*cd))) == NULL) { in _zip_cdir_new()
104 …if ( nentry > ((size_t)-1)/sizeof(*(cd->entry)) || (cd->entry=(struct zip_dirent *)malloc(sizeof(*… in _zip_cdir_new()
107 free(cd); in _zip_cdir_new()
113 cd->nentry = nentry; in _zip_cdir_new()
114 cd->size = cd->offset = 0; in _zip_cdir_new()
115 cd->comment = NULL; in _zip_cdir_new()
116 cd->comment_len = 0; in _zip_cdir_new()
118 return cd; in _zip_cdir_new()
124 _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) in _zip_cdir_write() argument
128 cd->offset = ftello(fp); in _zip_cdir_write()
130 for (i=0; i<cd->nentry; i++) { in _zip_cdir_write()
131 if (_zip_dirent_write(cd->entry+i, fp, 0, error) != 0) in _zip_cdir_write()
135 cd->size = ftello(fp) - cd->offset; in _zip_cdir_write()
140 _zip_write2((unsigned short)cd->nentry, fp); in _zip_cdir_write()
141 _zip_write2((unsigned short)cd->nentry, fp); in _zip_cdir_write()
142 _zip_write4(cd->size, fp); in _zip_cdir_write()
143 _zip_write4(cd->offset, fp); in _zip_cdir_write()
144 _zip_write2(cd->comment_len, fp); in _zip_cdir_write()
145 fwrite(cd->comment, 1, cd->comment_len, fp); in _zip_cdir_write()