Stats-LikeR
view release on metacpan or search on metacpan
return 1;
}
/* Append one STORED (uncompressed) member to the ZIP under construction: 'zip'
* is the growing archive, 'cdir' accumulates its central-directory records and
* '*count' the member count. */
static void xlsx_zip_add(pTHX_ SV *restrict zip, SV *restrict cdir,
unsigned *restrict count, const char *restrict name, SV *restrict content)
{
STRLEN nlen = strlen(name);
STRLEN clen; const char *restrict cdata = SvPV(content, clen);
uint32_t crc = xlsx_crc32((const unsigned char*)cdata, (size_t)clen);
uint32_t off = (uint32_t)SvCUR(zip);
/* local file header */
zip_le32(aTHX_ zip, 0x04034b50);
zip_le16(aTHX_ zip, 20); /* version needed to extract */
zip_le16(aTHX_ zip, 0); /* general-purpose flags */
zip_le16(aTHX_ zip, 0); /* method 0 = stored */
zip_le16(aTHX_ zip, 0); /* mod time */
zip_le16(aTHX_ zip, 0x21); /* mod date = 1980-01-01 */
zip_le32(aTHX_ zip, crc);
zip_le32(aTHX_ zip, (uint32_t)clen); /* compressed size */
zip_le32(aTHX_ zip, (uint32_t)clen); /* uncompressed size */
zip_le16(aTHX_ zip, (unsigned)nlen);
zip_le16(aTHX_ zip, 0); /* extra length */
sv_catpvn(zip, name, nlen);
sv_catpvn(zip, cdata, clen);
/* central-directory header */
zip_le32(aTHX_ cdir, 0x02014b50);
zip_le16(aTHX_ cdir, 20); /* version made by */
zip_le16(aTHX_ cdir, 20); /* version needed */
zip_le16(aTHX_ cdir, 0);
zip_le16(aTHX_ cdir, 0);
zip_le16(aTHX_ cdir, 0);
zip_le16(aTHX_ cdir, 0x21);
zip_le32(aTHX_ cdir, crc);
zip_le32(aTHX_ cdir, (uint32_t)clen);
( run in 1.904 second using v1.01-cache-2.11-cpan-995e09ba956 )