Lines Matching refs:buffer
55 static zip_cdir_t *_zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err…
56 static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags…
57 static zip_cdir_t *_zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse…
276 _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error) in _zip_read_cdir() argument
281 zip_uint64_t eocd_offset = _zip_buffer_offset(buffer); in _zip_read_cdir()
284 if (_zip_buffer_left(buffer) < EOCDLEN) { in _zip_read_cdir()
291 if (memcmp(_zip_buffer_get(buffer, 4), EOCD_MAGIC, 4) != 0) { in _zip_read_cdir()
296 …if (eocd_offset >= EOCD64LOCLEN && memcmp(_zip_buffer_data(buffer) + eocd_offset - EOCD64LOCLEN, E… in _zip_read_cdir()
297 _zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN); in _zip_read_cdir()
298 cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error); in _zip_read_cdir()
301 _zip_buffer_set_offset(buffer, eocd_offset); in _zip_read_cdir()
302 cd = _zip_read_eocd(buffer, buf_offset, za->flags, error); in _zip_read_cdir()
308 _zip_buffer_set_offset(buffer, eocd_offset + 20); in _zip_read_cdir()
309 comment_len = _zip_buffer_get_16(buffer); in _zip_read_cdir()
321 _zip_buffer_set_offset(buffer, eocd_offset + EOCDLEN); in _zip_read_cdir()
322 tail_len = _zip_buffer_left(buffer); in _zip_read_cdir()
331 …if ((cd->comment=_zip_string_new(_zip_buffer_get(buffer, comment_len), comment_len, ZIP_FL_ENC_GUE… in _zip_read_cdir()
341 _zip_buffer_set_offset(buffer, cd->offset - buf_offset); in _zip_read_cdir()
343 if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) { in _zip_read_cdir()
569 zip_buffer_t *buffer; in _zip_find_central_dir() local
590 if ((buffer = _zip_buffer_new_from_source(za->src, buflen, NULL, &za->error)) == NULL) { in _zip_find_central_dir()
598 _zip_buffer_set_offset(buffer, EOCD64LOCLEN); in _zip_find_central_dir()
602 match = _zip_buffer_get(buffer, 0); in _zip_find_central_dir()
603 …while ((match=_zip_memmem(match, _zip_buffer_left(buffer)-(EOCDLEN-4), (const unsigned char *)EOCD… in _zip_find_central_dir()
604 _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer))); in _zip_find_central_dir()
605 if ((cdirnew = _zip_read_cdir(za, buffer, (zip_uint64_t)buf_offset, &error)) != NULL) { in _zip_find_central_dir()
633 _zip_buffer_set_offset(buffer, (zip_uint64_t)(match - _zip_buffer_data(buffer))); in _zip_find_central_dir()
636 _zip_buffer_free(buffer); in _zip_find_central_dir()
667 _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *erro… in _zip_read_eocd() argument
672 if (_zip_buffer_left(buffer) < EOCDLEN) { in _zip_read_eocd()
677 eocd_offset = _zip_buffer_offset(buffer); in _zip_read_eocd()
679 _zip_buffer_get(buffer, 4); /* magic already verified */ in _zip_read_eocd()
681 if (_zip_buffer_get_32(buffer) != 0) { in _zip_read_eocd()
687 i = _zip_buffer_get_16(buffer); in _zip_read_eocd()
689 nentry = _zip_buffer_get_16(buffer); in _zip_read_eocd()
696 size = _zip_buffer_get_32(buffer); in _zip_read_eocd()
697 offset = _zip_buffer_get_32(buffer); in _zip_read_eocd()
726 _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int fla… in _zip_read_eocd64() argument
736 eocdloc_offset = _zip_buffer_offset(buffer); in _zip_read_eocd64()
738 _zip_buffer_get(buffer, 4); /* magic already verified */ in _zip_read_eocd64()
740 num_disks = _zip_buffer_get_16(buffer); in _zip_read_eocd64()
741 eocd_disk = _zip_buffer_get_16(buffer); in _zip_read_eocd64()
742 eocd_offset = _zip_buffer_get_64(buffer); in _zip_read_eocd64()
754 …f (eocd_offset >= buf_offset && eocd_offset + EOCD64LEN <= buf_offset + _zip_buffer_size(buffer)) { in _zip_read_eocd64()
755 _zip_buffer_set_offset(buffer, eocd_offset - buf_offset); in _zip_read_eocd64()
763 if ((buffer = _zip_buffer_new_from_source(src, EOCD64LEN, eocd, error)) == NULL) { in _zip_read_eocd64()
769 if (memcmp(_zip_buffer_get(buffer, 4), EOCD64_MAGIC, 4) != 0) { in _zip_read_eocd64()
772 _zip_buffer_free(buffer); in _zip_read_eocd64()
777 size = _zip_buffer_get_64(buffer); in _zip_read_eocd64()
782 _zip_buffer_free(buffer); in _zip_read_eocd64()
787 _zip_buffer_get(buffer, 4); /* skip version made by/needed */ in _zip_read_eocd64()
789 num_disks64 = _zip_buffer_get_32(buffer); in _zip_read_eocd64()
790 eocd_disk64 = _zip_buffer_get_32(buffer); in _zip_read_eocd64()
810 nentry = _zip_buffer_get_64(buffer); in _zip_read_eocd64()
811 i = _zip_buffer_get_64(buffer); in _zip_read_eocd64()
816 _zip_buffer_free(buffer); in _zip_read_eocd64()
821 size = _zip_buffer_get_64(buffer); in _zip_read_eocd64()
822 offset = _zip_buffer_get_64(buffer); in _zip_read_eocd64()
824 if (!_zip_buffer_ok(buffer)) { in _zip_read_eocd64()
827 _zip_buffer_free(buffer); in _zip_read_eocd64()
833 _zip_buffer_free(buffer); in _zip_read_eocd64()