MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / mz_zip_writer_init_file

Function mz_zip_writer_init_file

SampleFramework12/v1.00/TinyEXR.cpp:5584–5611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5582}
5583
5584mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename,
5585 mz_uint64 size_to_reserve_at_beginning) {
5586 MZ_FILE *pFile;
5587 pZip->m_pWrite = mz_zip_file_write_func;
5588 pZip->m_pIO_opaque = pZip;
5589 if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning))
5590 return MZ_FALSE;
5591 if (NULL == (pFile = MZ_FOPEN(pFilename, "wb"))) {
5592 mz_zip_writer_end(pZip);
5593 return MZ_FALSE;
5594 }
5595 pZip->m_pState->m_pFile = pFile;
5596 if (size_to_reserve_at_beginning) {
5597 mz_uint64 cur_ofs = 0;
5598 char buf[4096];
5599 MZ_CLEAR_OBJ(buf);
5600 do {
5601 size_t n = (size_t)MZ_MIN(sizeof(buf), size_to_reserve_at_beginning);
5602 if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n) {
5603 mz_zip_writer_end(pZip);
5604 return MZ_FALSE;
5605 }
5606 cur_ofs += n;
5607 size_to_reserve_at_beginning -= n;
5608 } while (size_to_reserve_at_beginning);
5609 }
5610 return MZ_TRUE;
5611}
5612#endif // #ifndef MINIZ_NO_STDIO
5613
5614mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip,

Calls 2

mz_zip_writer_initFunction · 0.85
mz_zip_writer_endFunction · 0.85

Tested by

no test coverage detected