Lines Matching refs:z
126 struct read_file *z; in read_file() local
130 z = (struct read_file *)state; in read_file()
135 if (z->fname) { in read_file()
136 if ((z->f=fopen(z->fname, "rb")) == NULL) { in read_file()
137 z->e[0] = ZIP_ER_OPEN; in read_file()
138 z->e[1] = errno; in read_file()
143 if (z->closep) { in read_file()
144 if (fseeko(z->f, (off_t)z->off, SEEK_SET) < 0) { in read_file()
145 z->e[0] = ZIP_ER_SEEK; in read_file()
146 z->e[1] = errno; in read_file()
150 z->remain = z->len; in read_file()
155 if (z->remain != -1) in read_file()
156 n = len > z->remain ? z->remain : len; in read_file()
160 if (!z->closep) { in read_file()
162 if (fseeko(z->f, (off_t)(z->off + z->len-z->remain), in read_file()
164 z->e[0] = ZIP_ER_SEEK; in read_file()
165 z->e[1] = errno; in read_file()
170 if ((i=fread(buf, 1, n, z->f)) < 0) { in read_file()
171 z->e[0] = ZIP_ER_READ; in read_file()
172 z->e[1] = errno; in read_file()
176 if (z->remain != -1) in read_file()
177 z->remain -= i; in read_file()
182 if (z->fname) { in read_file()
183 fclose(z->f); in read_file()
184 z->f = NULL; in read_file()
190 if (len < sizeof(z->st)) in read_file()
193 if (z->st.valid != 0) in read_file()
194 memcpy(data, &z->st, sizeof(z->st)); in read_file()
200 if (z->f) in read_file()
201 err = fstat(fileno(z->f), &fst); in read_file()
203 err = stat(z->fname, &fst); in read_file()
206 z->e[0] = ZIP_ER_READ; /* best match */ in read_file()
207 z->e[1] = errno; in read_file()
216 if (z->len != -1) { in read_file()
217 st->size = z->len; in read_file()
225 return sizeof(z->st); in read_file()
232 memcpy(data, z->e, sizeof(int)*2); in read_file()
236 free(z->fname); in read_file()
237 if (z->closep && z->f) in read_file()
238 fclose(z->f); in read_file()
239 free(z); in read_file()