• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/zlib-1.2.8/examples/

Lines Matching refs:index

14    its entirety, and an index built with access points about every SPAN bytes
29 To use the index, an offset in the uncompressed data is provided, for which
30 the latest accees point at or preceding that offset is located in the index.
31 The input file is positioned to the specified location in the index, and if
38 Another approach would be to generate the index on demand. In that case,
40 the index, but if a read far enough past the end of the index is required,
41 then further index entries would be generated and added.
48 Another way to build an index would be to use inflateCopy(). That would
52 index in a file.
81 /* Deallocate an index built by build_index() */
82 local void free_index(struct access *index)
84 if (index != NULL) {
85 free(index->list);
86 free(index);
92 local struct access *addpoint(struct access *index, int bits,
98 if (index == NULL) {
99 index = malloc(sizeof(struct access));
100 if (index == NULL) return NULL;
101 index->list = malloc(sizeof(struct point) << 3);
102 if (index->list == NULL) {
103 free(index);
106 index->size = 8;
107 index->have = 0;
111 else if (index->have == index->size) {
112 index->size <<= 1;
113 next = realloc(index->list, sizeof(struct point) * index->size);
115 free_index(index);
118 index->list = next;
122 next = index->list + index->have;
130 index->have++;
133 return index;
136 /* Make one entire pass through the compressed stream and build an index, with
143 file read error. On success, *built points to the resulting index. */
149 struct access *index; /* access points being generated */
164 /* inflate the input, maintain a sliding window, and build an index -- this
168 index = NULL; /* will be allocated by first addpoint() */
205 /* if at end of block, consider adding an index entry (note that if
211 index always has at least one access point; we avoid creating an
216 index = addpoint(index, strm.data_type & 7, totin,
218 if (index == NULL) {
227 /* clean up and return index (release unused entries in list) */
229 index->list = realloc(index->list, sizeof(struct point) * index->have);
230 index->size = index->have;
231 *built = index;
232 return index->size;
237 if (index != NULL)
238 free_index(index);
242 /* Use the index to read len bytes from offset into buf, return bytes read or
246 should not return a data error unless the file was modified since the index
249 local int extract(FILE *in, struct access *index, off_t offset,
263 here = index->list;
264 ret = index->have;
359 struct access *index = NULL;
373 /* build index */
374 len = build_index(in, SPAN, &index);
388 fprintf(stderr, "zran: error %d while building index\n", len);
392 fprintf(stderr, "zran: built index with %d access points\n", len);
394 /* use index by reading some bytes from an arbitrary offset */
395 offset = (index->list[index->have - 1].out << 1) / 3;
396 len = extract(in, index, offset, buf, CHUNK);
406 free_index(index);