Lines Matching refs:buffer
100 zip_buffer_t *buffer; in _zip_cdir_write() local
133 if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) { in _zip_cdir_write()
139 _zip_buffer_put(buffer, EOCD64_MAGIC, 4); in _zip_cdir_write()
140 _zip_buffer_put_64(buffer, EOCD64LEN-12); in _zip_cdir_write()
141 _zip_buffer_put_16(buffer, 45); in _zip_cdir_write()
142 _zip_buffer_put_16(buffer, 45); in _zip_cdir_write()
143 _zip_buffer_put_32(buffer, 0); in _zip_cdir_write()
144 _zip_buffer_put_32(buffer, 0); in _zip_cdir_write()
145 _zip_buffer_put_64(buffer, survivors); in _zip_cdir_write()
146 _zip_buffer_put_64(buffer, survivors); in _zip_cdir_write()
147 _zip_buffer_put_64(buffer, size); in _zip_cdir_write()
148 _zip_buffer_put_64(buffer, offset); in _zip_cdir_write()
149 _zip_buffer_put(buffer, EOCD64LOC_MAGIC, 4); in _zip_cdir_write()
150 _zip_buffer_put_32(buffer, 0); in _zip_cdir_write()
151 _zip_buffer_put_64(buffer, offset+size); in _zip_cdir_write()
152 _zip_buffer_put_32(buffer, 1); in _zip_cdir_write()
155 _zip_buffer_put(buffer, EOCD_MAGIC, 4); in _zip_cdir_write()
156 _zip_buffer_put_32(buffer, 0); in _zip_cdir_write()
157 …_zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors… in _zip_cdir_write()
158 …_zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors… in _zip_cdir_write()
159 _zip_buffer_put_32(buffer, size >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)size); in _zip_cdir_write()
160 _zip_buffer_put_32(buffer, offset >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)offset); in _zip_cdir_write()
164 _zip_buffer_put_16(buffer, (zip_uint16_t)(comment ? comment->length : 0)); in _zip_cdir_write()
166 if (!_zip_buffer_ok(buffer)) { in _zip_cdir_write()
168 _zip_buffer_free(buffer); in _zip_cdir_write()
172 if (_zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer)) < 0) { in _zip_cdir_write()
173 _zip_buffer_free(buffer); in _zip_cdir_write()
177 _zip_buffer_free(buffer); in _zip_cdir_write()
298 _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_… in _zip_dirent_read() argument
305 bool from_buffer = (buffer != NULL); in _zip_dirent_read()
309 if (buffer) { in _zip_dirent_read()
310 if (_zip_buffer_left(buffer) < size) { in _zip_dirent_read()
316 if ((buffer = _zip_buffer_new_from_source(src, size, buf, error)) == NULL) { in _zip_dirent_read()
321 if (memcmp(_zip_buffer_get(buffer, 4), (local ? LOCAL_MAGIC : CENTRAL_MAGIC), 4) != 0) { in _zip_dirent_read()
324 _zip_buffer_free(buffer); in _zip_dirent_read()
333 zde->version_madeby = _zip_buffer_get_16(buffer); in _zip_dirent_read()
336 zde->version_needed = _zip_buffer_get_16(buffer); in _zip_dirent_read()
337 zde->bitflags = _zip_buffer_get_16(buffer); in _zip_dirent_read()
338 zde->comp_method = _zip_buffer_get_16(buffer); in _zip_dirent_read()
341 dostime = _zip_buffer_get_16(buffer); in _zip_dirent_read()
342 dosdate = _zip_buffer_get_16(buffer); in _zip_dirent_read()
345 zde->crc = _zip_buffer_get_32(buffer); in _zip_dirent_read()
346 zde->comp_size = _zip_buffer_get_32(buffer); in _zip_dirent_read()
347 zde->uncomp_size = _zip_buffer_get_32(buffer); in _zip_dirent_read()
349 filename_len = _zip_buffer_get_16(buffer); in _zip_dirent_read()
350 ef_len = _zip_buffer_get_16(buffer); in _zip_dirent_read()
359 comment_len = _zip_buffer_get_16(buffer); in _zip_dirent_read()
360 zde->disk_number = _zip_buffer_get_16(buffer); in _zip_dirent_read()
361 zde->int_attrib = _zip_buffer_get_16(buffer); in _zip_dirent_read()
362 zde->ext_attrib = _zip_buffer_get_32(buffer); in _zip_dirent_read()
363 zde->offset = _zip_buffer_get_32(buffer); in _zip_dirent_read()
366 if (!_zip_buffer_ok(buffer)) { in _zip_dirent_read()
369 _zip_buffer_free(buffer); in _zip_dirent_read()
381 if (_zip_buffer_left(buffer) < variable_size) { in _zip_dirent_read()
387 _zip_buffer_free(buffer); in _zip_dirent_read()
389 if ((buffer = _zip_buffer_new_from_source(src, variable_size, NULL, error)) == NULL) { in _zip_dirent_read()
395 zde->filename = _zip_read_string(buffer, src, filename_len, 1, error); in _zip_dirent_read()
401 _zip_buffer_free(buffer); in _zip_dirent_read()
410 _zip_buffer_free(buffer); in _zip_dirent_read()
418 zip_uint8_t *ef = _zip_read_data(buffer, src, ef_len, 0, error); in _zip_dirent_read()
422 _zip_buffer_free(buffer); in _zip_dirent_read()
429 _zip_buffer_free(buffer); in _zip_dirent_read()
439 zde->comment = _zip_read_string(buffer, src, comment_len, 0, error); in _zip_dirent_read()
442 _zip_buffer_free(buffer); in _zip_dirent_read()
450 _zip_buffer_free(buffer); in _zip_dirent_read()
469 _zip_buffer_free(buffer); in _zip_dirent_read()
477 _zip_buffer_free(buffer); in _zip_dirent_read()
495 zde->disk_number = _zip_buffer_get_32(buffer); in _zip_dirent_read()
502 _zip_buffer_free(buffer); in _zip_dirent_read()
509 if (!_zip_buffer_ok(buffer)) { in _zip_dirent_read()
512 _zip_buffer_free(buffer); in _zip_dirent_read()
517 _zip_buffer_free(buffer); in _zip_dirent_read()
537 zip_buffer_t *buffer; in _zip_dirent_process_ef_utf_8() local
545 if ((buffer = _zip_buffer_new((zip_uint8_t *)ef, ef_len)) == NULL) { in _zip_dirent_process_ef_utf_8()
549 _zip_buffer_get_8(buffer); in _zip_dirent_process_ef_utf_8()
550 ef_crc = _zip_buffer_get_32(buffer); in _zip_dirent_process_ef_utf_8()
553 zip_uint16_t len = (zip_uint16_t)_zip_buffer_left(buffer); in _zip_dirent_process_ef_utf_8()
554 … zip_string_t *ef_str = _zip_string_new(_zip_buffer_get(buffer, len), len, ZIP_FL_ENC_UTF_8, NULL); in _zip_dirent_process_ef_utf_8()
562 _zip_buffer_free(buffer); in _zip_dirent_process_ef_utf_8()
575 zip_buffer_t *buffer; in _zip_dirent_size() local
584 if ((buffer = _zip_buffer_new_from_source(src, local ? 4 : 6, b, error)) == NULL) { in _zip_dirent_size()
589 size += _zip_buffer_get_16(buffer); in _zip_dirent_size()
592 if (!_zip_buffer_eof(buffer)) { in _zip_dirent_size()
594 _zip_buffer_free(buffer); in _zip_dirent_size()
598 _zip_buffer_free(buffer); in _zip_dirent_size()
624 zip_buffer_t *buffer; in _zip_dirent_write() local
698 if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) { in _zip_dirent_write()
704 _zip_buffer_put(buffer, (flags & ZIP_FL_LOCAL) ? LOCAL_MAGIC : CENTRAL_MAGIC, 4); in _zip_dirent_write()
707 _zip_buffer_put_16(buffer, (zip_uint16_t)(is_really_zip64 ? 45 : de->version_madeby)); in _zip_dirent_write()
709 _zip_buffer_put_16(buffer, (zip_uint16_t)(is_really_zip64 ? 45 : de->version_needed)); in _zip_dirent_write()
710 _zip_buffer_put_16(buffer, de->bitflags&0xfff9); /* clear compression method specific flags */ in _zip_dirent_write()
711 _zip_buffer_put_16(buffer, (zip_uint16_t)de->comp_method); in _zip_dirent_write()
714 _zip_buffer_put_16(buffer, dostime); in _zip_dirent_write()
715 _zip_buffer_put_16(buffer, dosdate); in _zip_dirent_write()
717 _zip_buffer_put_32(buffer, de->crc); in _zip_dirent_write()
725 _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); in _zip_dirent_write()
726 _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); in _zip_dirent_write()
730 _zip_buffer_put_32(buffer, (zip_uint32_t)de->comp_size); in _zip_dirent_write()
733 _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); in _zip_dirent_write()
736 _zip_buffer_put_32(buffer, (zip_uint32_t)de->uncomp_size); in _zip_dirent_write()
739 _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); in _zip_dirent_write()
743 _zip_buffer_put_16(buffer, _zip_string_length(de->filename)); in _zip_dirent_write()
746 _zip_buffer_put_16(buffer, (zip_uint16_t)ef_total_size); in _zip_dirent_write()
749 _zip_buffer_put_16(buffer, _zip_string_length(de->comment)); in _zip_dirent_write()
750 _zip_buffer_put_16(buffer, (zip_uint16_t)de->disk_number); in _zip_dirent_write()
751 _zip_buffer_put_16(buffer, de->int_attrib); in _zip_dirent_write()
752 _zip_buffer_put_32(buffer, de->ext_attrib); in _zip_dirent_write()
754 _zip_buffer_put_32(buffer, (zip_uint32_t)de->offset); in _zip_dirent_write()
756 _zip_buffer_put_32(buffer, ZIP_UINT32_MAX); in _zip_dirent_write()
759 if (!_zip_buffer_ok(buffer)) { in _zip_dirent_write()
761 _zip_buffer_free(buffer); in _zip_dirent_write()
766 if (_zip_write(za, buf, _zip_buffer_offset(buffer)) < 0) { in _zip_dirent_write()
767 _zip_buffer_free(buffer); in _zip_dirent_write()
772 _zip_buffer_free(buffer); in _zip_dirent_write()
834 zip_buffer_t *buffer; in _zip_ef_utf8() local
847 if ((buffer = _zip_buffer_new(NULL, len+5)) == NULL) { in _zip_ef_utf8()
852 _zip_buffer_put_8(buffer, 1); in _zip_ef_utf8()
853 _zip_buffer_put_32(buffer, _zip_string_crc32(str)); in _zip_ef_utf8()
854 _zip_buffer_put(buffer, raw, len); in _zip_ef_utf8()
856 if (!_zip_buffer_ok(buffer)) { in _zip_ef_utf8()
858 _zip_buffer_free(buffer); in _zip_ef_utf8()
862 …ef = _zip_ef_new(id, (zip_uint16_t)(_zip_buffer_offset(buffer)), _zip_buffer_data(buffer), ZIP_EF_… in _zip_ef_utf8()
863 _zip_buffer_free(buffer); in _zip_ef_utf8()