Lines Matching refs:z
126 struct read_file *z; in read_file() local
131 z = (struct read_file *)state; in read_file()
136 if (z->fname) { in read_file()
137 if ((z->f=fopen(z->fname, "rb")) == NULL) { in read_file()
138 z->e[0] = ZIP_ER_OPEN; in read_file()
139 z->e[1] = errno; in read_file()
144 if (z->closep && z->off > 0) { in read_file()
145 if (fseeko(z->f, (off_t)z->off, SEEK_SET) < 0) { in read_file()
146 z->e[0] = ZIP_ER_SEEK; in read_file()
147 z->e[1] = errno; in read_file()
151 z->remain = z->len; in read_file()
155 if (z->remain != -1) in read_file()
156 n = len > (zip_uint64_t)z->remain ? (zip_uint64_t)z->remain : len; in read_file()
163 if (!z->closep) { in read_file()
165 if (fseeko(z->f, (off_t)(z->off + (zip_uint64_t)(z->len-z->remain)), SEEK_SET) < 0) { in read_file()
166 z->e[0] = ZIP_ER_SEEK; in read_file()
167 z->e[1] = errno; in read_file()
172 if ((i=fread(buf, 1, (size_t)n, z->f)) == 0) { in read_file()
173 if (ferror(z->f)) { in read_file()
174 z->e[0] = ZIP_ER_READ; in read_file()
175 z->e[1] = errno; in read_file()
180 if (z->remain != -1) in read_file()
181 z->remain -= i; in read_file()
186 if (z->fname) { in read_file()
187 fclose(z->f); in read_file()
188 z->f = NULL; in read_file()
194 if (len < sizeof(z->st)) in read_file()
197 if (z->st.valid != 0) in read_file()
198 memcpy(data, &z->st, sizeof(z->st)); in read_file()
204 if (z->f) in read_file()
205 err = fstat(fileno(z->f), &fst); in read_file()
207 err = stat(z->fname, &fst); in read_file()
210 z->e[0] = ZIP_ER_READ; /* best match */ in read_file()
211 z->e[1] = errno; in read_file()
220 if (z->len != -1) { in read_file()
221 st->size = (zip_uint64_t)z->len; in read_file()
229 return sizeof(z->st); in read_file()
236 memcpy(data, z->e, sizeof(int)*2); in read_file()
240 free(z->fname); in read_file()
241 if (z->closep && z->f) in read_file()
242 fclose(z->f); in read_file()
243 free(z); in read_file()