MCPcopy Create free account
hub / github.com/defold/defold / zip_entry_noallocread

Function zip_entry_noallocread

engine/dlib/src/zip/zip.c:1775–1796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1773}
1774
1775ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsize) {
1776 mz_zip_archive *pzip = NULL;
1777
1778 if (!zip) {
1779 // zip_t handler is not initialized
1780 return (ssize_t)ZIP_ENOINIT;
1781 }
1782
1783 pzip = &(zip->archive);
1784 if (pzip->m_zip_mode != MZ_ZIP_MODE_READING ||
1785 zip->entry.index < (ssize_t)0) {
1786 // the entry is not found or we do not have read access
1787 return (ssize_t)ZIP_ENOENT;
1788 }
1789
1790 if (!mz_zip_reader_extract_to_mem_no_alloc(pzip, (mz_uint)zip->entry.index,
1791 buf, bufsize, 0, NULL, 0)) {
1792 return (ssize_t)ZIP_EMEMNOALLOC;
1793 }
1794
1795 return (ssize_t)zip->entry.uncomp_size;
1796}
1797
1798ssize_t zip_entry_noallocreadwithoffset(struct zip_t *zip, size_t offset,
1799 size_t size, void *buf) {

Callers 1

GetEntryDataFunction · 0.85

Tested by

no test coverage detected