mz_crypt_crc32_update:
   35|  56.0M|uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) {
   36|       |#if defined(HAVE_ZLIB)
   37|       |#  ifndef ZLIB_VERNUM
   38|       |    /* HAVE_ZLIB but no ZLIB_VERNUM? */
   39|       |    typedef uint32_t z_crc_t;
   40|       |#  elif (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270)
   41|       |    /* Define z_crc_t in zlib 1.2.6 and less */
   42|       |    typedef unsigned long z_crc_t;
   43|       |#  elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df)
   44|       |    /* Define z_crc_t in zlib-ng 2.0.7 and less */
   45|       |    typedef unsigned int z_crc_t;
   46|       |#  endif
   47|       |    return (uint32_t)ZLIB_PREFIX(crc32)((z_crc_t)value, buf, (uInt)size);
   48|       |#elif defined(HAVE_LZMA)
   49|       |    return (uint32_t)lzma_crc32(buf, (size_t)size, (uint32_t)value);
   50|       |#else
   51|  56.0M|    static uint32_t crc32_table[256] = {
   52|  56.0M|        0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832,
   53|  56.0M|        0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
   54|  56.0M|        0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a,
   55|  56.0M|        0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
   56|  56.0M|        0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
   57|  56.0M|        0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
   58|  56.0M|        0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab,
   59|  56.0M|        0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
   60|  56.0M|        0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4,
   61|  56.0M|        0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
   62|  56.0M|        0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074,
   63|  56.0M|        0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
   64|  56.0M|        0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525,
   65|  56.0M|        0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
   66|  56.0M|        0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
   67|  56.0M|        0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
   68|  56.0M|        0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76,
   69|  56.0M|        0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
   70|  56.0M|        0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6,
   71|  56.0M|        0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
   72|  56.0M|        0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7,
   73|  56.0M|        0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
   74|  56.0M|        0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7,
   75|  56.0M|        0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
   76|  56.0M|        0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
   77|  56.0M|        0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
   78|  56.0M|        0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330,
   79|  56.0M|        0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
   80|  56.0M|        0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
   81|  56.0M|    value = ~value;
   82|       |
   83|   157M|    while (size > 0) {
  ------------------
  |  Branch (83:12): [True: 101M, False: 56.0M]
  ------------------
   84|   101M|        value = (value >> 8) ^ crc32_table[(value ^ *buf) & 0xFF];
   85|       |
   86|   101M|        buf += 1;
   87|   101M|        size -= 1;
   88|   101M|    }
   89|       |
   90|  56.0M|    return ~value;
   91|  56.0M|#endif
   92|  56.0M|}

mz_crypt_rand:
   48|    194|int32_t mz_crypt_rand(uint8_t *buf, int32_t size) {
   49|    194|    if (!RAND_bytes(buf, size))
  ------------------
  |  Branch (49:9): [True: 0, False: 194]
  ------------------
   50|      0|        return MZ_CRYPT_ERROR;
  ------------------
  |  |   35|      0|#define MZ_CRYPT_ERROR    (-106)
  ------------------
   51|       |
   52|    194|    return size;
   53|    194|}

mz_stream_open:
   20|    736|int32_t mz_stream_open(void *stream, const char *path, int32_t mode) {
   21|    736|    mz_stream *strm = (mz_stream *)stream;
   22|    736|    if (!strm || !strm->vtbl || !strm->vtbl->open)
  ------------------
  |  Branch (22:9): [True: 0, False: 736]
  |  Branch (22:18): [True: 0, False: 736]
  |  Branch (22:33): [True: 0, False: 736]
  ------------------
   23|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   24|    736|    return strm->vtbl->open(strm, path, mode);
   25|    736|}
mz_stream_is_open:
   27|  31.4k|int32_t mz_stream_is_open(void *stream) {
   28|  31.4k|    mz_stream *strm = (mz_stream *)stream;
   29|  31.4k|    if (!strm || !strm->vtbl || !strm->vtbl->is_open)
  ------------------
  |  Branch (29:9): [True: 0, False: 31.4k]
  |  Branch (29:18): [True: 0, False: 31.4k]
  |  Branch (29:33): [True: 0, False: 31.4k]
  ------------------
   30|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   31|  31.4k|    return strm->vtbl->is_open(strm);
   32|  31.4k|}
mz_stream_read:
   34|  2.79k|int32_t mz_stream_read(void *stream, void *buf, int32_t size) {
   35|  2.79k|    mz_stream *strm = (mz_stream *)stream;
   36|  2.79k|    if (!strm || !strm->vtbl || !strm->vtbl->read)
  ------------------
  |  Branch (36:9): [True: 0, False: 2.79k]
  |  Branch (36:18): [True: 0, False: 2.79k]
  |  Branch (36:33): [True: 0, False: 2.79k]
  ------------------
   37|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
   38|  2.79k|    if (mz_stream_is_open(stream) != MZ_OK)
  ------------------
  |  |   21|  2.79k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (38:9): [True: 0, False: 2.79k]
  ------------------
   39|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   40|  2.79k|    return strm->vtbl->read(strm, buf, size);
   41|  2.79k|}
mz_stream_read_uint8:
   60|  1.95k|int32_t mz_stream_read_uint8(void *stream, uint8_t *value) {
   61|  1.95k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  1.95k|#define MZ_OK             (0)  /* zlib */
  ------------------
   62|  1.95k|    uint64_t value64 = 0;
   63|       |
   64|  1.95k|    *value = 0;
   65|  1.95k|    err = mz_stream_read_value(stream, &value64, sizeof(uint8_t));
   66|  1.95k|    if (err == MZ_OK)
  ------------------
  |  |   21|  1.95k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (66:9): [True: 1.74k, False: 212]
  ------------------
   67|  1.74k|        *value = (uint8_t)value64;
   68|  1.95k|    return err;
   69|  1.95k|}
mz_stream_read_uint16:
   71|    471|int32_t mz_stream_read_uint16(void *stream, uint16_t *value) {
   72|    471|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    471|#define MZ_OK             (0)  /* zlib */
  ------------------
   73|    471|    uint64_t value64 = 0;
   74|       |
   75|    471|    *value = 0;
   76|    471|    err = mz_stream_read_value(stream, &value64, sizeof(uint16_t));
   77|    471|    if (err == MZ_OK)
  ------------------
  |  |   21|    471|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (77:9): [True: 449, False: 22]
  ------------------
   78|    449|        *value = (uint16_t)value64;
   79|    471|    return err;
   80|    471|}
mz_stream_write:
  101|  22.3k|int32_t mz_stream_write(void *stream, const void *buf, int32_t size) {
  102|  22.3k|    mz_stream *strm = (mz_stream *)stream;
  103|  22.3k|    if (size == 0)
  ------------------
  |  Branch (103:9): [True: 913, False: 21.4k]
  ------------------
  104|    913|        return size;
  105|  21.4k|    if (!strm || !strm->vtbl || !strm->vtbl->write)
  ------------------
  |  Branch (105:9): [True: 0, False: 21.4k]
  |  Branch (105:18): [True: 0, False: 21.4k]
  |  Branch (105:33): [True: 0, False: 21.4k]
  ------------------
  106|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  107|  21.4k|    if (mz_stream_is_open(stream) != MZ_OK)
  ------------------
  |  |   21|  21.4k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (107:9): [True: 0, False: 21.4k]
  ------------------
  108|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  109|  21.4k|    return strm->vtbl->write(strm, buf, size);
  110|  21.4k|}
mz_stream_write_uint8:
  133|  1.84k|int32_t mz_stream_write_uint8(void *stream, uint8_t value) {
  134|  1.84k|    return mz_stream_write_value(stream, value, sizeof(uint8_t));
  135|  1.84k|}
mz_stream_write_uint16:
  137|  8.18k|int32_t mz_stream_write_uint16(void *stream, uint16_t value) {
  138|  8.18k|    return mz_stream_write_value(stream, value, sizeof(uint16_t));
  139|  8.18k|}
mz_stream_write_uint32:
  141|  6.60k|int32_t mz_stream_write_uint32(void *stream, uint32_t value) {
  142|  6.60k|    return mz_stream_write_value(stream, value, sizeof(uint32_t));
  143|  6.60k|}
mz_stream_write_int64:
  145|  1.39k|int32_t mz_stream_write_int64(void *stream, int64_t value) {
  146|  1.39k|    return mz_stream_write_value(stream, (uint64_t)value, sizeof(uint64_t));
  147|  1.39k|}
mz_stream_copy:
  153|    460|int32_t mz_stream_copy(void *target, void *source, int32_t len) {
  154|    460|    return mz_stream_copy_stream(target, NULL, source, NULL, len);
  155|    460|}
mz_stream_copy_stream:
  162|    460|                              int32_t len) {
  163|    460|    uint8_t buf[16384];
  164|    460|    int32_t bytes_to_copy = 0;
  165|    460|    int32_t read = 0;
  166|    460|    int32_t written = 0;
  167|       |
  168|    460|    if (!write_cb)
  ------------------
  |  Branch (168:9): [True: 460, False: 0]
  ------------------
  169|    460|        write_cb = mz_stream_write;
  170|    460|    if (!read_cb)
  ------------------
  |  Branch (170:9): [True: 460, False: 0]
  ------------------
  171|    460|        read_cb = mz_stream_read;
  172|       |
  173|    828|    while (len > 0) {
  ------------------
  |  Branch (173:12): [True: 368, False: 460]
  ------------------
  174|    368|        bytes_to_copy = len;
  175|    368|        if (bytes_to_copy > (int32_t)sizeof(buf))
  ------------------
  |  Branch (175:13): [True: 0, False: 368]
  ------------------
  176|      0|            bytes_to_copy = sizeof(buf);
  177|    368|        read = read_cb(source, buf, bytes_to_copy);
  178|    368|        if (read <= 0)
  ------------------
  |  Branch (178:13): [True: 0, False: 368]
  ------------------
  179|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  180|    368|        written = write_cb(target, buf, read);
  181|    368|        if (written != read)
  ------------------
  |  Branch (181:13): [True: 0, False: 368]
  ------------------
  182|      0|            return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  183|    368|        len -= read;
  184|    368|    }
  185|       |
  186|    460|    return MZ_OK;
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  187|    460|}
mz_stream_tell:
  214|  3.58k|int64_t mz_stream_tell(void *stream) {
  215|  3.58k|    mz_stream *strm = (mz_stream *)stream;
  216|  3.58k|    if (!strm || !strm->vtbl || !strm->vtbl->tell)
  ------------------
  |  Branch (216:9): [True: 0, False: 3.58k]
  |  Branch (216:18): [True: 0, False: 3.58k]
  |  Branch (216:33): [True: 0, False: 3.58k]
  ------------------
  217|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  218|  3.58k|    if (mz_stream_is_open(stream) != MZ_OK)
  ------------------
  |  |   21|  3.58k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (218:9): [True: 0, False: 3.58k]
  ------------------
  219|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  220|  3.58k|    return strm->vtbl->tell(strm);
  221|  3.58k|}
mz_stream_seek:
  223|  1.38k|int32_t mz_stream_seek(void *stream, int64_t offset, int32_t origin) {
  224|  1.38k|    mz_stream *strm = (mz_stream *)stream;
  225|  1.38k|    if (!strm || !strm->vtbl || !strm->vtbl->seek)
  ------------------
  |  Branch (225:9): [True: 0, False: 1.38k]
  |  Branch (225:18): [True: 0, False: 1.38k]
  |  Branch (225:33): [True: 0, False: 1.38k]
  ------------------
  226|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  227|  1.38k|    if (mz_stream_is_open(stream) != MZ_OK)
  ------------------
  |  |   21|  1.38k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (227:9): [True: 0, False: 1.38k]
  ------------------
  228|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  229|  1.38k|    if (origin == MZ_SEEK_SET && offset < 0)
  ------------------
  |  |   58|  2.76k|#define MZ_SEEK_SET (0)
  ------------------
  |  Branch (229:9): [True: 920, False: 460]
  |  Branch (229:34): [True: 0, False: 920]
  ------------------
  230|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  231|  1.38k|    return strm->vtbl->seek(strm, offset, origin);
  232|  1.38k|}
mz_stream_close:
  359|  1.02k|int32_t mz_stream_close(void *stream) {
  360|  1.02k|    mz_stream *strm = (mz_stream *)stream;
  361|  1.02k|    if (!strm || !strm->vtbl || !strm->vtbl->close)
  ------------------
  |  Branch (361:9): [True: 0, False: 1.02k]
  |  Branch (361:18): [True: 0, False: 1.02k]
  |  Branch (361:33): [True: 0, False: 1.02k]
  ------------------
  362|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  363|  1.02k|    if (mz_stream_is_open(stream) != MZ_OK)
  ------------------
  |  |   21|  1.02k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (363:9): [True: 0, False: 1.02k]
  ------------------
  364|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  365|  1.02k|    return strm->vtbl->close(strm);
  366|  1.02k|}
mz_stream_error:
  368|    234|int32_t mz_stream_error(void *stream) {
  369|    234|    mz_stream *strm = (mz_stream *)stream;
  370|    234|    if (!strm || !strm->vtbl || !strm->vtbl->error)
  ------------------
  |  Branch (370:9): [True: 0, False: 234]
  |  Branch (370:18): [True: 0, False: 234]
  |  Branch (370:33): [True: 0, False: 234]
  ------------------
  371|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  372|    234|    return strm->vtbl->error(strm);
  373|    234|}
mz_stream_set_base:
  375|    930|int32_t mz_stream_set_base(void *stream, void *base) {
  376|    930|    mz_stream *strm = (mz_stream *)stream;
  377|    930|    strm->base = (mz_stream *)base;
  378|    930|    return MZ_OK;
  ------------------
  |  |   21|    930|#define MZ_OK             (0)  /* zlib */
  ------------------
  379|    930|}
mz_stream_get_prop_int64:
  388|  2.31k|int32_t mz_stream_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  389|  2.31k|    mz_stream *strm = (mz_stream *)stream;
  390|  2.31k|    if (!strm || !strm->vtbl || !strm->vtbl->get_prop_int64)
  ------------------
  |  Branch (390:9): [True: 0, False: 2.31k]
  |  Branch (390:18): [True: 0, False: 2.31k]
  |  Branch (390:33): [True: 1.38k, False: 930]
  ------------------
  391|  1.38k|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|  1.38k|#define MZ_PARAM_ERROR    (-102)
  ------------------
  392|    930|    return strm->vtbl->get_prop_int64(stream, prop, value);
  393|  2.31k|}
mz_stream_set_prop_int64:
  395|    828|int32_t mz_stream_set_prop_int64(void *stream, int32_t prop, int64_t value) {
  396|    828|    mz_stream *strm = (mz_stream *)stream;
  397|    828|    if (!strm || !strm->vtbl || !strm->vtbl->set_prop_int64)
  ------------------
  |  Branch (397:9): [True: 0, False: 828]
  |  Branch (397:18): [True: 0, False: 828]
  |  Branch (397:33): [True: 460, False: 368]
  ------------------
  398|    460|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|    460|#define MZ_PARAM_ERROR    (-102)
  ------------------
  399|    368|    return strm->vtbl->set_prop_int64(stream, prop, value);
  400|    828|}
mz_stream_delete:
  408|  1.19k|void mz_stream_delete(void **stream) {
  409|  1.19k|    mz_stream *strm = NULL;
  410|  1.19k|    if (!stream)
  ------------------
  |  Branch (410:9): [True: 0, False: 1.19k]
  ------------------
  411|      0|        return;
  412|  1.19k|    strm = (mz_stream *)*stream;
  413|  1.19k|    if (strm && strm->vtbl && strm->vtbl->destroy)
  ------------------
  |  Branch (413:9): [True: 1.19k, False: 0]
  |  Branch (413:17): [True: 1.19k, False: 0]
  |  Branch (413:31): [True: 1.19k, False: 0]
  ------------------
  414|  1.19k|        strm->vtbl->destroy(stream);
  415|  1.19k|    *stream = NULL;
  416|  1.19k|}
mz_stream_raw_open:
  429|    542|int32_t mz_stream_raw_open(void *stream, const char *path, int32_t mode) {
  430|    542|    MZ_UNUSED(stream);
  ------------------
  |  |  147|    542|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  431|    542|    MZ_UNUSED(path);
  ------------------
  |  |  147|    542|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  432|    542|    MZ_UNUSED(mode);
  ------------------
  |  |  147|    542|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  433|       |
  434|    542|    return MZ_OK;
  ------------------
  |  |   21|    542|#define MZ_OK             (0)  /* zlib */
  ------------------
  435|    542|}
mz_stream_raw_is_open:
  437|  1.02k|int32_t mz_stream_raw_is_open(void *stream) {
  438|  1.02k|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  439|  1.02k|    return mz_stream_is_open(raw->stream.base);
  440|  1.02k|}
mz_stream_raw_write:
  462|    382|int32_t mz_stream_raw_write(void *stream, const void *buf, int32_t size) {
  463|    382|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  464|    382|    int32_t written = 0;
  465|       |
  466|    382|    written = mz_stream_write(raw->stream.base, buf, size);
  467|       |
  468|    382|    if (written > 0) {
  ------------------
  |  Branch (468:9): [True: 382, False: 0]
  ------------------
  469|    382|        raw->total_out += written;
  470|    382|        raw->total_in += written;
  471|    382|    }
  472|       |
  473|    382|    return written;
  474|    382|}
mz_stream_raw_close:
  486|    368|int32_t mz_stream_raw_close(void *stream) {
  487|    368|    MZ_UNUSED(stream);
  ------------------
  |  |  147|    368|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  488|    368|    return MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  489|    368|}
mz_stream_raw_get_prop_int64:
  496|    736|int32_t mz_stream_raw_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  497|    736|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  498|    736|    switch (prop) {
  ------------------
  |  Branch (498:13): [True: 0, False: 736]
  ------------------
  499|    368|    case MZ_STREAM_PROP_TOTAL_IN:
  ------------------
  |  |   20|    368|#define MZ_STREAM_PROP_TOTAL_IN        (1)
  ------------------
  |  Branch (499:5): [True: 368, False: 368]
  ------------------
  500|    368|        *value = raw->total_in;
  501|    368|        return MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  502|    368|    case MZ_STREAM_PROP_TOTAL_OUT:
  ------------------
  |  |   22|    368|#define MZ_STREAM_PROP_TOTAL_OUT       (3)
  ------------------
  |  Branch (502:5): [True: 368, False: 368]
  ------------------
  503|    368|        *value = raw->total_out;
  504|    368|        return MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  505|    736|    }
  506|      0|    return MZ_EXIST_ERROR;
  ------------------
  |  |   36|      0|#define MZ_EXIST_ERROR    (-107)
  ------------------
  507|    736|}
mz_stream_raw_set_prop_int64:
  509|    368|int32_t mz_stream_raw_set_prop_int64(void *stream, int32_t prop, int64_t value) {
  510|    368|    mz_stream_raw *raw = (mz_stream_raw *)stream;
  511|    368|    switch (prop) {
  ------------------
  |  Branch (511:13): [True: 368, False: 0]
  ------------------
  512|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX    (2)
  ------------------
  |  Branch (512:5): [True: 0, False: 368]
  ------------------
  513|      0|        raw->max_total_in = value;
  514|      0|        return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  515|    368|    }
  516|    368|    return MZ_EXIST_ERROR;
  ------------------
  |  |   36|    368|#define MZ_EXIST_ERROR    (-107)
  ------------------
  517|    368|}
mz_stream_raw_create:
  528|    542|void *mz_stream_raw_create(void) {
  529|    542|    mz_stream_raw *raw = (mz_stream_raw *)calloc(1, sizeof(mz_stream_raw));
  530|    542|    if (raw)
  ------------------
  |  Branch (530:9): [True: 542, False: 0]
  ------------------
  531|    542|        raw->stream.vtbl = &mz_stream_raw_vtbl;
  532|    542|    return raw;
  533|    542|}
mz_stream_raw_delete:
  535|    542|void mz_stream_raw_delete(void **stream) {
  536|    542|    mz_stream_raw *raw = NULL;
  537|    542|    if (!stream)
  ------------------
  |  Branch (537:9): [True: 0, False: 542]
  ------------------
  538|      0|        return;
  539|    542|    raw = (mz_stream_raw *)*stream;
  540|    542|    free(raw);
  541|    542|    *stream = NULL;
  542|    542|}
mz_strm.c:mz_stream_read_value:
   43|  2.42k|static int32_t mz_stream_read_value(void *stream, uint64_t *value, int32_t len) {
   44|  2.42k|    uint8_t buf[8];
   45|  2.42k|    int32_t n = 0;
   46|  2.42k|    int32_t i = 0;
   47|       |
   48|  2.42k|    *value = 0;
   49|  2.42k|    if (mz_stream_read(stream, buf, len) == len) {
  ------------------
  |  Branch (49:9): [True: 2.19k, False: 234]
  ------------------
   50|  4.83k|        for (n = 0; n < len; n += 1, i += 8)
  ------------------
  |  Branch (50:21): [True: 2.64k, False: 2.19k]
  ------------------
   51|  2.64k|            *value += ((uint64_t)buf[n]) << i;
   52|  2.19k|    } else if (mz_stream_error(stream))
  ------------------
  |  Branch (52:16): [True: 0, False: 234]
  ------------------
   53|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
   54|    234|    else
   55|    234|        return MZ_END_OF_STREAM;
  ------------------
  |  |   29|    234|#define MZ_END_OF_STREAM  (-101)
  ------------------
   56|       |
   57|  2.19k|    return MZ_OK;
  ------------------
  |  |   21|  2.19k|#define MZ_OK             (0)  /* zlib */
  ------------------
   58|  2.42k|}
mz_strm.c:mz_stream_write_value:
  112|  18.0k|static int32_t mz_stream_write_value(void *stream, uint64_t value, int32_t len) {
  113|  18.0k|    uint8_t buf[8];
  114|  18.0k|    int32_t n = 0;
  115|       |
  116|  73.8k|    for (n = 0; n < len; n += 1) {
  ------------------
  |  Branch (116:17): [True: 55.7k, False: 18.0k]
  ------------------
  117|  55.7k|        buf[n] = (uint8_t)(value & 0xff);
  118|  55.7k|        value >>= 8;
  119|  55.7k|    }
  120|       |
  121|  18.0k|    if (value != 0) {
  ------------------
  |  Branch (121:9): [True: 0, False: 18.0k]
  ------------------
  122|       |        /* Data overflow - hack for ZIP64 (X Roche) */
  123|      0|        for (n = 0; n < len; n += 1)
  ------------------
  |  Branch (123:21): [True: 0, False: 0]
  ------------------
  124|      0|            buf[n] = 0xff;
  125|      0|    }
  126|       |
  127|  18.0k|    if (mz_stream_write(stream, buf, len) != len)
  ------------------
  |  Branch (127:9): [True: 0, False: 18.0k]
  ------------------
  128|      0|        return MZ_STREAM_ERROR;
  ------------------
  |  |   22|      0|#define MZ_STREAM_ERROR   (-1) /* zlib */
  ------------------
  129|       |
  130|  18.0k|    return MZ_OK;
  ------------------
  |  |   21|  18.0k|#define MZ_OK             (0)  /* zlib */
  ------------------
  131|  18.0k|}

mz_stream_mem_open:
   71|  1.84k|int32_t mz_stream_mem_open(void *stream, const char *path, int32_t mode) {
   72|  1.84k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   73|  1.84k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  1.84k|#define MZ_OK             (0)  /* zlib */
  ------------------
   74|       |
   75|  1.84k|    MZ_UNUSED(path);
  ------------------
  |  |  147|  1.84k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
   76|       |
   77|  1.84k|    mem->mode = mode;
   78|  1.84k|    mem->limit = 0;
   79|  1.84k|    mem->position = 0;
   80|       |
   81|  1.84k|    if (mem->mode & MZ_OPEN_MODE_CREATE)
  ------------------
  |  |   54|  1.84k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (81:9): [True: 1.84k, False: 0]
  ------------------
   82|  1.84k|        err = mz_stream_mem_set_size(stream, mem->grow_size);
   83|      0|    else
   84|      0|        mem->limit = mem->size;
   85|       |
   86|  1.84k|    return err;
   87|  1.84k|}
mz_stream_mem_is_open:
   89|  29.6k|int32_t mz_stream_mem_is_open(void *stream) {
   90|  29.6k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   91|  29.6k|    if (!mem->buffer)
  ------------------
  |  Branch (91:9): [True: 0, False: 29.6k]
  ------------------
   92|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
   93|  29.6k|    return MZ_OK;
  ------------------
  |  |   21|  29.6k|#define MZ_OK             (0)  /* zlib */
  ------------------
   94|  29.6k|}
mz_stream_mem_read:
   96|  2.79k|int32_t mz_stream_mem_read(void *stream, void *buf, int32_t size) {
   97|  2.79k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   98|       |
   99|  2.79k|    if (size > mem->size - mem->position)
  ------------------
  |  Branch (99:9): [True: 234, False: 2.56k]
  ------------------
  100|    234|        size = mem->size - mem->position;
  101|  2.79k|    if (mem->position + size > mem->limit)
  ------------------
  |  Branch (101:9): [True: 0, False: 2.79k]
  ------------------
  102|      0|        size = mem->limit - mem->position;
  103|       |
  104|  2.79k|    if (size <= 0)
  ------------------
  |  Branch (104:9): [True: 232, False: 2.56k]
  ------------------
  105|    232|        return 0;
  106|       |
  107|  2.56k|    memcpy(buf, mem->buffer + mem->position, size);
  108|  2.56k|    mem->position += size;
  109|       |
  110|  2.56k|    return size;
  111|  2.79k|}
mz_stream_mem_write:
  113|  20.9k|int32_t mz_stream_mem_write(void *stream, const void *buf, int32_t size) {
  114|  20.9k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  115|  20.9k|    int32_t new_size = 0;
  116|  20.9k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  20.9k|#define MZ_OK             (0)  /* zlib */
  ------------------
  117|       |
  118|  20.9k|    if (!size)
  ------------------
  |  Branch (118:9): [True: 0, False: 20.9k]
  ------------------
  119|      0|        return size;
  120|       |
  121|  20.9k|    if (size > mem->size - mem->position) {
  ------------------
  |  Branch (121:9): [True: 519, False: 20.3k]
  ------------------
  122|    519|        if (mem->mode & MZ_OPEN_MODE_CREATE) {
  ------------------
  |  |   54|    519|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (122:13): [True: 519, False: 0]
  ------------------
  123|    519|            new_size = mem->size;
  124|    519|            if (size < mem->grow_size)
  ------------------
  |  Branch (124:17): [True: 25, False: 494]
  ------------------
  125|     25|                new_size += mem->grow_size;
  126|    494|            else
  127|    494|                new_size += size;
  128|       |
  129|    519|            err = mz_stream_mem_set_size(stream, new_size);
  130|    519|            if (err != MZ_OK)
  ------------------
  |  |   21|    519|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (130:17): [True: 0, False: 519]
  ------------------
  131|      0|                return err;
  132|    519|        } else {
  133|      0|            size = mem->size - mem->position;
  134|      0|        }
  135|    519|    }
  136|       |
  137|  20.9k|    memcpy(mem->buffer + mem->position, buf, size);
  138|       |
  139|  20.9k|    mem->position += size;
  140|  20.9k|    if (mem->position > mem->limit)
  ------------------
  |  Branch (140:9): [True: 20.9k, False: 0]
  ------------------
  141|  20.9k|        mem->limit = mem->position;
  142|       |
  143|  20.9k|    return size;
  144|  20.9k|}
mz_stream_mem_tell:
  146|  3.58k|int64_t mz_stream_mem_tell(void *stream) {
  147|  3.58k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  148|  3.58k|    return mem->position;
  149|  3.58k|}
mz_stream_mem_seek:
  151|  1.38k|int32_t mz_stream_mem_seek(void *stream, int64_t offset, int32_t origin) {
  152|  1.38k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  153|  1.38k|    int64_t new_pos = 0;
  154|  1.38k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  1.38k|#define MZ_OK             (0)  /* zlib */
  ------------------
  155|       |
  156|  1.38k|    switch (origin) {
  157|      0|    case MZ_SEEK_CUR:
  ------------------
  |  |   59|      0|#define MZ_SEEK_CUR (1)
  ------------------
  |  Branch (157:5): [True: 0, False: 1.38k]
  ------------------
  158|      0|        new_pos = mem->position + offset;
  159|      0|        break;
  160|    460|    case MZ_SEEK_END:
  ------------------
  |  |   60|    460|#define MZ_SEEK_END (2)
  ------------------
  |  Branch (160:5): [True: 460, False: 920]
  ------------------
  161|    460|        new_pos = mem->limit + offset;
  162|    460|        break;
  163|    920|    case MZ_SEEK_SET:
  ------------------
  |  |   58|    920|#define MZ_SEEK_SET (0)
  ------------------
  |  Branch (163:5): [True: 920, False: 460]
  ------------------
  164|    920|        new_pos = offset;
  165|    920|        break;
  166|      0|    default:
  ------------------
  |  Branch (166:5): [True: 0, False: 1.38k]
  ------------------
  167|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  168|  1.38k|    }
  169|       |
  170|  1.38k|    if (new_pos > mem->size) {
  ------------------
  |  Branch (170:9): [True: 0, False: 1.38k]
  ------------------
  171|      0|        if ((mem->mode & MZ_OPEN_MODE_CREATE) == 0)
  ------------------
  |  |   54|      0|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (171:13): [True: 0, False: 0]
  ------------------
  172|      0|            return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  173|       |
  174|      0|        err = mz_stream_mem_set_size(stream, (int32_t)new_pos);
  175|      0|        if (err != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (175:13): [True: 0, False: 0]
  ------------------
  176|      0|            return err;
  177|  1.38k|    } else if (new_pos < 0) {
  ------------------
  |  Branch (177:16): [True: 0, False: 1.38k]
  ------------------
  178|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  179|      0|    }
  180|       |
  181|  1.38k|    mem->position = (int32_t)new_pos;
  182|  1.38k|    return MZ_OK;
  ------------------
  |  |   21|  1.38k|#define MZ_OK             (0)  /* zlib */
  ------------------
  183|  1.38k|}
mz_stream_mem_close:
  185|  1.38k|int32_t mz_stream_mem_close(void *stream) {
  186|  1.38k|    MZ_UNUSED(stream);
  ------------------
  |  |  147|  1.38k|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  187|       |
  188|       |    /* We never return errors */
  189|  1.38k|    return MZ_OK;
  ------------------
  |  |   21|  1.38k|#define MZ_OK             (0)  /* zlib */
  ------------------
  190|  1.38k|}
mz_stream_mem_error:
  192|    234|int32_t mz_stream_mem_error(void *stream) {
  193|    234|    MZ_UNUSED(stream);
  ------------------
  |  |  147|    234|#define MZ_UNUSED(SYMBOL) ((void)SYMBOL)
  ------------------
  194|       |
  195|       |    /* We never return errors */
  196|    234|    return MZ_OK;
  ------------------
  |  |   21|    234|#define MZ_OK             (0)  /* zlib */
  ------------------
  197|    234|}
mz_stream_mem_set_buffer:
  199|    460|void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size) {
  200|    460|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  201|    460|    mem->buffer = (uint8_t *)buf;
  202|    460|    mem->size = size;
  203|    460|    mem->limit = size;
  204|    460|}
mz_stream_mem_get_buffer_at:
  210|  2.20k|int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void **buf) {
  211|  2.20k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  212|  2.20k|    if (!buf || position < 0 || !mem->buffer || mem->size < position)
  ------------------
  |  Branch (212:9): [True: 0, False: 2.20k]
  |  Branch (212:17): [True: 0, False: 2.20k]
  |  Branch (212:33): [True: 0, False: 2.20k]
  |  Branch (212:49): [True: 0, False: 2.20k]
  ------------------
  213|      0|        return MZ_SEEK_ERROR;
  ------------------
  |  |   42|      0|#define MZ_SEEK_ERROR     (-113)
  ------------------
  214|  2.20k|    *buf = mem->buffer + position;
  215|  2.20k|    return MZ_OK;
  ------------------
  |  |   21|  2.20k|#define MZ_OK             (0)  /* zlib */
  ------------------
  216|  2.20k|}
mz_stream_mem_get_buffer_at_current:
  218|    368|int32_t mz_stream_mem_get_buffer_at_current(void *stream, const void **buf) {
  219|    368|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  220|    368|    return mz_stream_mem_get_buffer_at(stream, mem->position, buf);
  221|    368|}
mz_stream_mem_get_buffer_length:
  223|    368|void mz_stream_mem_get_buffer_length(void *stream, int32_t *length) {
  224|    368|    mz_stream_mem *mem = (mz_stream_mem *)stream;
  225|    368|    *length = mem->limit;
  226|    368|}
mz_stream_mem_create:
  238|  2.30k|void *mz_stream_mem_create(void) {
  239|  2.30k|    mz_stream_mem *mem = (mz_stream_mem *)calloc(1, sizeof(mz_stream_mem));
  240|  2.30k|    if (mem) {
  ------------------
  |  Branch (240:9): [True: 2.30k, False: 0]
  ------------------
  241|  2.30k|        mem->stream.vtbl = &mz_stream_mem_vtbl;
  242|  2.30k|        mem->grow_size = 4096;
  243|  2.30k|    }
  244|  2.30k|    return mem;
  245|  2.30k|}
mz_stream_mem_delete:
  247|  2.30k|void mz_stream_mem_delete(void **stream) {
  248|  2.30k|    mz_stream_mem *mem = NULL;
  249|  2.30k|    if (!stream)
  ------------------
  |  Branch (249:9): [True: 0, False: 2.30k]
  ------------------
  250|      0|        return;
  251|  2.30k|    mem = (mz_stream_mem *)*stream;
  252|  2.30k|    if (mem) {
  ------------------
  |  Branch (252:9): [True: 2.30k, False: 0]
  ------------------
  253|  2.30k|        if ((mem->mode & MZ_OPEN_MODE_CREATE) && (mem->buffer))
  ------------------
  |  |   54|  2.30k|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (253:13): [True: 1.84k, False: 460]
  |  Branch (253:50): [True: 1.84k, False: 0]
  ------------------
  254|  1.84k|            free(mem->buffer);
  255|  2.30k|        free(mem);
  256|  2.30k|    }
  257|  2.30k|    *stream = NULL;
  258|  2.30k|}
mz_strm_mem.c:mz_stream_mem_set_size:
   52|  2.35k|static int32_t mz_stream_mem_set_size(void *stream, int32_t size) {
   53|  2.35k|    mz_stream_mem *mem = (mz_stream_mem *)stream;
   54|  2.35k|    int32_t new_size = size;
   55|  2.35k|    uint8_t *new_buf = NULL;
   56|       |
   57|  2.35k|    new_buf = (uint8_t *)malloc((uint32_t)new_size);
   58|  2.35k|    if (!new_buf)
  ------------------
  |  Branch (58:9): [True: 0, False: 2.35k]
  ------------------
   59|      0|        return MZ_BUF_ERROR;
  ------------------
  |  |   25|      0|#define MZ_BUF_ERROR      (-5) /* zlib */
  ------------------
   60|       |
   61|  2.35k|    if (mem->buffer) {
  ------------------
  |  Branch (61:9): [True: 519, False: 1.84k]
  ------------------
   62|    519|        memcpy(new_buf, mem->buffer, mem->size);
   63|    519|        free(mem->buffer);
   64|    519|    }
   65|       |
   66|  2.35k|    mem->buffer = new_buf;
   67|  2.35k|    mem->size = new_size;
   68|  2.35k|    return MZ_OK;
  ------------------
  |  |   21|  2.35k|#define MZ_OK             (0)  /* zlib */
  ------------------
   69|  2.35k|}

mz_stream_pkcrypt_open:
  106|    194|int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode) {
  107|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  108|    194|    uint16_t t = 0;
  109|    194|    int16_t i = 0;
  110|    194|    uint8_t verify1 = 0;
  111|    194|    uint8_t verify2 = 0;
  112|    194|    uint8_t header[MZ_PKCRYPT_HEADER_SIZE];
  113|    194|    const char *password = path;
  114|       |
  115|    194|    pkcrypt->total_in = 0;
  116|    194|    pkcrypt->total_out = 0;
  117|    194|    pkcrypt->initialized = 0;
  118|       |
  119|    194|    if (mz_stream_is_open(pkcrypt->stream.base) != MZ_OK)
  ------------------
  |  |   21|    194|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (119:9): [True: 0, False: 194]
  ------------------
  120|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
  121|       |
  122|    194|    if (!password)
  ------------------
  |  Branch (122:9): [True: 194, False: 0]
  ------------------
  123|    194|        password = pkcrypt->password;
  124|    194|    if (!password)
  ------------------
  |  Branch (124:9): [True: 0, False: 194]
  ------------------
  125|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  126|       |
  127|    194|    mz_stream_pkcrypt_init_keys(stream, password);
  128|       |
  129|    194|    if (mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    194|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (129:9): [True: 194, False: 0]
  ------------------
  130|       |        /* First generate RAND_HEAD_LEN - 2 random bytes. */
  131|    194|        mz_crypt_rand(header, MZ_PKCRYPT_HEADER_SIZE - 2);
  ------------------
  |  |  110|    194|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  132|       |
  133|       |        /* Encrypt random header (last two bytes is high word of crc) */
  134|  2.13k|        for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
  ------------------
  |  |  110|  2.13k|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  |  Branch (134:21): [True: 1.94k, False: 194]
  ------------------
  135|  1.94k|            header[i] = mz_stream_pkcrypt_encode(stream, header[i], t);
  ------------------
  |  |   60|  1.94k|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  136|       |
  137|    194|        header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify1, t);
  ------------------
  |  |   60|    194|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  138|    194|        header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify2, t);
  ------------------
  |  |   60|    194|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  139|       |
  140|    194|        if (mz_stream_write(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
  ------------------
  |  Branch (140:13): [True: 0, False: 194]
  ------------------
  141|      0|            return MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  142|       |
  143|    194|        pkcrypt->total_out += MZ_PKCRYPT_HEADER_SIZE;
  ------------------
  |  |  110|    194|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  144|    194|    } else if (mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (144:16): [True: 0, False: 0]
  ------------------
  145|      0|        if (mz_stream_read(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            return MZ_READ_ERROR;
  ------------------
  |  |   44|      0|#define MZ_READ_ERROR     (-115)
  ------------------
  147|       |
  148|      0|        for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
  ------------------
  |  |  110|      0|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  |  Branch (148:21): [True: 0, False: 0]
  ------------------
  149|      0|            header[i] = mz_stream_pkcrypt_decode(stream, header[i]);
  ------------------
  |  |   57|      0|    (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
  ------------------
  150|       |
  151|      0|        verify1 = mz_stream_pkcrypt_decode(stream, header[i++]);
  ------------------
  |  |   57|      0|    (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
  ------------------
  152|      0|        verify2 = mz_stream_pkcrypt_decode(stream, header[i++]);
  ------------------
  |  |   57|      0|    (mz_stream_pkcrypt_update_keys(strm, c ^= mz_stream_pkcrypt_decrypt_byte(strm)))
  ------------------
  153|       |
  154|       |        /* PKZIP 2.0 and higher use 1 byte check, older versions used 2 byte check.
  155|       |           See app note section 6.1.6. */
  156|      0|        if (verify2 != pkcrypt->verify2)
  ------------------
  |  Branch (156:13): [True: 0, False: 0]
  ------------------
  157|      0|            return MZ_PASSWORD_ERROR;
  ------------------
  |  |   37|      0|#define MZ_PASSWORD_ERROR (-108)
  ------------------
  158|      0|        if (pkcrypt->verify_version < 2) {
  ------------------
  |  Branch (158:13): [True: 0, False: 0]
  ------------------
  159|      0|            if (verify1 != pkcrypt->verify1)
  ------------------
  |  Branch (159:17): [True: 0, False: 0]
  ------------------
  160|      0|                return MZ_PASSWORD_ERROR;
  ------------------
  |  |   37|      0|#define MZ_PASSWORD_ERROR (-108)
  ------------------
  161|      0|        }
  162|       |
  163|      0|        pkcrypt->total_in += MZ_PKCRYPT_HEADER_SIZE;
  ------------------
  |  |  110|      0|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  164|      0|    }
  165|       |
  166|    194|    pkcrypt->initialized = 1;
  167|    194|    return MZ_OK;
  ------------------
  |  |   21|    194|#define MZ_OK             (0)  /* zlib */
  ------------------
  168|    194|}
mz_stream_pkcrypt_is_open:
  170|    756|int32_t mz_stream_pkcrypt_is_open(void *stream) {
  171|    756|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  172|    756|    if (!pkcrypt->initialized)
  ------------------
  |  Branch (172:9): [True: 0, False: 756]
  ------------------
  173|      0|        return MZ_OPEN_ERROR;
  ------------------
  |  |   40|      0|#define MZ_OPEN_ERROR     (-111)
  ------------------
  174|    756|    return MZ_OK;
  ------------------
  |  |   21|    756|#define MZ_OK             (0)  /* zlib */
  ------------------
  175|    756|}
mz_stream_pkcrypt_write:
  198|    184|int32_t mz_stream_pkcrypt_write(void *stream, const void *buf, int32_t size) {
  199|    184|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  200|    184|    const uint8_t *buf_ptr = (const uint8_t *)buf;
  201|    184|    int32_t bytes_to_write = sizeof(pkcrypt->buffer);
  202|    184|    int32_t total_written = 0;
  203|    184|    int32_t written = 0;
  204|    184|    int32_t i = 0;
  205|    184|    uint16_t t = 0;
  206|       |
  207|    184|    if (size < 0)
  ------------------
  |  Branch (207:9): [True: 0, False: 184]
  ------------------
  208|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  209|       |
  210|    561|    do {
  211|    561|        if (bytes_to_write > (size - total_written))
  ------------------
  |  Branch (211:13): [True: 178, False: 383]
  ------------------
  212|    178|            bytes_to_write = (size - total_written);
  213|       |
  214|  28.0M|        for (i = 0; i < bytes_to_write; i += 1) {
  ------------------
  |  Branch (214:21): [True: 28.0M, False: 561]
  ------------------
  215|  28.0M|            pkcrypt->buffer[i] = mz_stream_pkcrypt_encode(stream, *buf_ptr, t);
  ------------------
  |  |   60|  28.0M|    (t = mz_stream_pkcrypt_decrypt_byte(strm), mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t ^ (c)))
  ------------------
  216|  28.0M|            buf_ptr += 1;
  217|  28.0M|        }
  218|       |
  219|    561|        written = mz_stream_write(pkcrypt->stream.base, pkcrypt->buffer, bytes_to_write);
  220|    561|        if (written < 0)
  ------------------
  |  Branch (220:13): [True: 0, False: 561]
  ------------------
  221|      0|            return written;
  222|       |
  223|    561|        total_written += written;
  224|    561|    } while (total_written < size && written > 0);
  ------------------
  |  Branch (224:14): [True: 377, False: 184]
  |  Branch (224:38): [True: 377, False: 0]
  ------------------
  225|       |
  226|    184|    pkcrypt->total_out += total_written;
  227|    184|    return total_written;
  228|    184|}
mz_stream_pkcrypt_close:
  240|    194|int32_t mz_stream_pkcrypt_close(void *stream) {
  241|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  242|    194|    pkcrypt->initialized = 0;
  243|    194|    return MZ_OK;
  ------------------
  |  |   21|    194|#define MZ_OK             (0)  /* zlib */
  ------------------
  244|    194|}
mz_stream_pkcrypt_set_password:
  251|    194|void mz_stream_pkcrypt_set_password(void *stream, const char *password) {
  252|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  253|    194|    pkcrypt->password = password;
  254|    194|}
mz_stream_pkcrypt_set_verify:
  256|    194|void mz_stream_pkcrypt_set_verify(void *stream, uint8_t verify1, uint8_t verify2, uint16_t version) {
  257|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  258|    194|    pkcrypt->verify1 = verify1;
  259|    194|    pkcrypt->verify2 = verify2;
  260|    194|    pkcrypt->verify_version = version;
  261|    194|}
mz_stream_pkcrypt_get_prop_int64:
  270|    194|int32_t mz_stream_pkcrypt_get_prop_int64(void *stream, int32_t prop, int64_t *value) {
  271|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
  272|    194|    switch (prop) {
  273|      0|    case MZ_STREAM_PROP_TOTAL_IN:
  ------------------
  |  |   20|      0|#define MZ_STREAM_PROP_TOTAL_IN        (1)
  ------------------
  |  Branch (273:5): [True: 0, False: 194]
  ------------------
  274|      0|        *value = pkcrypt->total_in;
  275|      0|        break;
  276|    194|    case MZ_STREAM_PROP_TOTAL_OUT:
  ------------------
  |  |   22|    194|#define MZ_STREAM_PROP_TOTAL_OUT       (3)
  ------------------
  |  Branch (276:5): [True: 194, False: 0]
  ------------------
  277|    194|        *value = pkcrypt->total_out;
  278|    194|        break;
  279|      0|    case MZ_STREAM_PROP_TOTAL_IN_MAX:
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX    (2)
  ------------------
  |  Branch (279:5): [True: 0, False: 194]
  ------------------
  280|      0|        *value = pkcrypt->max_total_in;
  281|      0|        break;
  282|      0|    case MZ_STREAM_PROP_HEADER_SIZE:
  ------------------
  |  |   24|      0|#define MZ_STREAM_PROP_HEADER_SIZE     (5)
  ------------------
  |  Branch (282:5): [True: 0, False: 194]
  ------------------
  283|      0|        *value = MZ_PKCRYPT_HEADER_SIZE;
  ------------------
  |  |  110|      0|#define MZ_PKCRYPT_HEADER_SIZE (12)
  ------------------
  284|      0|        break;
  285|      0|    case MZ_STREAM_PROP_FOOTER_SIZE:
  ------------------
  |  |   25|      0|#define MZ_STREAM_PROP_FOOTER_SIZE     (6)
  ------------------
  |  Branch (285:5): [True: 0, False: 194]
  ------------------
  286|      0|        *value = 0;
  287|      0|        break;
  288|      0|    default:
  ------------------
  |  Branch (288:5): [True: 0, False: 194]
  ------------------
  289|      0|        return MZ_EXIST_ERROR;
  ------------------
  |  |   36|      0|#define MZ_EXIST_ERROR    (-107)
  ------------------
  290|    194|    }
  291|    194|    return MZ_OK;
  ------------------
  |  |   21|    194|#define MZ_OK             (0)  /* zlib */
  ------------------
  292|    194|}
mz_stream_pkcrypt_create:
  306|    194|void *mz_stream_pkcrypt_create(void) {
  307|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)calloc(1, sizeof(mz_stream_pkcrypt));
  308|    194|    if (pkcrypt)
  ------------------
  |  Branch (308:9): [True: 194, False: 0]
  ------------------
  309|    194|        pkcrypt->stream.vtbl = &mz_stream_pkcrypt_vtbl;
  310|    194|    return pkcrypt;
  311|    194|}
mz_stream_pkcrypt_delete:
  313|    194|void mz_stream_pkcrypt_delete(void **stream) {
  314|    194|    mz_stream_pkcrypt *pkcrypt = NULL;
  315|    194|    if (!stream)
  ------------------
  |  Branch (315:9): [True: 0, False: 194]
  ------------------
  316|      0|        return;
  317|    194|    pkcrypt = (mz_stream_pkcrypt *)*stream;
  318|    194|    free(pkcrypt);
  319|    194|    *stream = NULL;
  320|    194|}
mz_strm_pkcrypt.c:mz_stream_pkcrypt_init_keys:
   91|    194|static void mz_stream_pkcrypt_init_keys(void *stream, const char *password) {
   92|    194|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
   93|       |
   94|    194|    pkcrypt->keys[0] = 305419896L;
   95|    194|    pkcrypt->keys[1] = 591751049L;
   96|    194|    pkcrypt->keys[2] = 878082192L;
   97|       |
   98|  1.55k|    while (*password != 0) {
  ------------------
  |  Branch (98:12): [True: 1.35k, False: 194]
  ------------------
   99|  1.35k|        mz_stream_pkcrypt_update_keys(stream, (uint8_t)*password);
  100|  1.35k|        password += 1;
  101|  1.35k|    }
  102|    194|}
mz_strm_pkcrypt.c:mz_stream_pkcrypt_decrypt_byte:
   64|  28.0M|static uint8_t mz_stream_pkcrypt_decrypt_byte(void *stream) {
   65|  28.0M|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
   66|       |
   67|  28.0M|    unsigned temp; /* POTENTIAL BUG:  temp*(temp^1) may overflow in an */
   68|       |                   /* unpredictable manner on 16-bit systems; not a problem */
   69|       |                   /* with any known compiler so far, though. */
   70|       |
   71|  28.0M|    temp = pkcrypt->keys[2] | 2;
   72|  28.0M|    return (uint8_t)(((temp * (temp ^ 1)) >> 8) & 0xff);
   73|  28.0M|}
mz_strm_pkcrypt.c:mz_stream_pkcrypt_update_keys:
   75|  28.0M|static uint8_t mz_stream_pkcrypt_update_keys(void *stream, uint8_t c) {
   76|  28.0M|    mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
   77|  28.0M|    uint8_t buf = c;
   78|       |
   79|  28.0M|    pkcrypt->keys[0] = (uint32_t)~mz_crypt_crc32_update(~pkcrypt->keys[0], &buf, 1);
   80|       |
   81|  28.0M|    pkcrypt->keys[1] += pkcrypt->keys[0] & 0xff;
   82|  28.0M|    pkcrypt->keys[1] *= 134775813L;
   83|  28.0M|    pkcrypt->keys[1] += 1;
   84|       |
   85|  28.0M|    buf = (uint8_t)(pkcrypt->keys[1] >> 24);
   86|  28.0M|    pkcrypt->keys[2] = (uint32_t)~mz_crypt_crc32_update(~pkcrypt->keys[2], &buf, 1);
   87|       |
   88|  28.0M|    return (uint8_t)c;
   89|  28.0M|}

mz_zip_create:
 1407|    460|void *mz_zip_create(void) {
 1408|    460|    mz_zip *zip = (mz_zip *)calloc(1, sizeof(mz_zip));
 1409|    460|    if (zip)
  ------------------
  |  Branch (1409:9): [True: 460, False: 0]
  ------------------
 1410|    460|        zip->data_descriptor = 1;
 1411|    460|    return zip;
 1412|    460|}
mz_zip_delete:
 1414|    460|void mz_zip_delete(void **handle) {
 1415|    460|    mz_zip *zip = NULL;
 1416|    460|    if (!handle)
  ------------------
  |  Branch (1416:9): [True: 0, False: 460]
  ------------------
 1417|      0|        return;
 1418|    460|    zip = (mz_zip *)*handle;
 1419|    460|    free(zip);
 1420|    460|    *handle = NULL;
 1421|    460|}
mz_zip_open:
 1423|    460|int32_t mz_zip_open(void *handle, void *stream, int32_t mode) {
 1424|    460|    mz_zip *zip = (mz_zip *)handle;
 1425|    460|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
 1426|       |
 1427|    460|    if (!zip)
  ------------------
  |  Branch (1427:9): [True: 0, False: 460]
  ------------------
 1428|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1429|       |
 1430|    460|    mz_zip_print("Zip - Open\n");
 1431|       |
 1432|    460|    zip->stream = stream;
 1433|    460|    zip->cd_mem_stream = mz_stream_mem_create();
 1434|    460|    if (!zip->cd_mem_stream)
  ------------------
  |  Branch (1434:9): [True: 0, False: 460]
  ------------------
 1435|      0|        return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1436|       |
 1437|    460|    if (mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    460|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1437:9): [True: 460, False: 0]
  ------------------
 1438|    460|        mz_stream_mem_open(zip->cd_mem_stream, NULL, MZ_OPEN_MODE_CREATE);
  ------------------
  |  |   54|    460|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
 1439|    460|        zip->cd_stream = zip->cd_mem_stream;
 1440|    460|    } else {
 1441|      0|        zip->cd_stream = stream;
 1442|      0|    }
 1443|       |
 1444|    460|    if ((mode & MZ_OPEN_MODE_READ) || (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   50|    460|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
                  if ((mode & MZ_OPEN_MODE_READ) || (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   53|    460|#define MZ_OPEN_MODE_APPEND    (0x04)
  ------------------
  |  Branch (1444:9): [True: 0, False: 460]
  |  Branch (1444:39): [True: 0, False: 460]
  ------------------
 1445|      0|        if ((mode & MZ_OPEN_MODE_CREATE) == 0) {
  ------------------
  |  |   54|      0|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
  |  Branch (1445:13): [True: 0, False: 0]
  ------------------
 1446|      0|            err = mz_zip_read_cd(zip);
 1447|      0|            if (err != MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1447:17): [True: 0, False: 0]
  ------------------
 1448|      0|                mz_zip_print("Zip - Error detected reading cd (%" PRId32 ")\n", err);
 1449|      0|                if (zip->recover && mz_zip_recover_cd(zip) == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1449:21): [True: 0, False: 0]
  |  Branch (1449:37): [True: 0, False: 0]
  ------------------
 1450|      0|                    err = MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 1451|      0|            }
 1452|      0|        }
 1453|       |
 1454|      0|        if ((err == MZ_OK) && (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
                      if ((err == MZ_OK) && (mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   53|      0|#define MZ_OPEN_MODE_APPEND    (0x04)
  ------------------
  |  Branch (1454:13): [True: 0, False: 0]
  |  Branch (1454:31): [True: 0, False: 0]
  ------------------
 1455|      0|            if (zip->cd_size > 0) {
  ------------------
  |  Branch (1455:17): [True: 0, False: 0]
  ------------------
 1456|       |                /* Store central directory in memory */
 1457|      0|                err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
 1458|      0|                if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1458:21): [True: 0, False: 0]
  ------------------
 1459|      0|                    err = mz_stream_copy(zip->cd_mem_stream, zip->stream, (int32_t)zip->cd_size);
 1460|      0|                if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1460:21): [True: 0, False: 0]
  ------------------
 1461|      0|                    err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
 1462|      0|            } else {
 1463|      0|                if (zip->cd_signature == MZ_ZIP_MAGIC_ENDHEADER) {
  ------------------
  |  |   62|      0|#define MZ_ZIP_MAGIC_ENDHEADER          (0x06054b50)
  ------------------
  |  Branch (1463:21): [True: 0, False: 0]
  ------------------
 1464|       |                    /* If tiny zip then overwrite end header */
 1465|      0|                    err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
 1466|      0|                } else {
 1467|       |                    /* If no central directory, append new zip to end of file */
 1468|      0|                    err = mz_stream_seek(zip->stream, 0, MZ_SEEK_END);
  ------------------
  |  |   60|      0|#define MZ_SEEK_END (2)
  ------------------
 1469|      0|                }
 1470|      0|            }
 1471|       |
 1472|      0|            if (zip->disk_number_with_cd > 0) {
  ------------------
  |  Branch (1472:17): [True: 0, False: 0]
  ------------------
 1473|       |                /* Move to last disk to begin appending */
 1474|      0|                mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, zip->disk_number_with_cd - 1);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
 1475|      0|            }
 1476|      0|        } else {
 1477|      0|            zip->cd_start_pos = zip->cd_offset;
 1478|      0|        }
 1479|      0|    }
 1480|       |
 1481|    460|    if (err != MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1481:9): [True: 0, False: 460]
  ------------------
 1482|      0|        mz_zip_close(zip);
 1483|      0|        return err;
 1484|      0|    }
 1485|       |
 1486|       |    /* Memory streams used to store variable length file info data */
 1487|    460|    zip->file_info_stream = mz_stream_mem_create();
 1488|    460|    if (!zip->file_info_stream)
  ------------------
  |  Branch (1488:9): [True: 0, False: 460]
  ------------------
 1489|      0|        return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1490|       |
 1491|    460|    mz_stream_mem_open(zip->file_info_stream, NULL, MZ_OPEN_MODE_CREATE);
  ------------------
  |  |   54|    460|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
 1492|       |
 1493|    460|    zip->local_file_info_stream = mz_stream_mem_create();
 1494|    460|    if (!zip->local_file_info_stream) {
  ------------------
  |  Branch (1494:9): [True: 0, False: 460]
  ------------------
 1495|      0|        mz_stream_delete(&zip->file_info_stream);
 1496|      0|        return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1497|      0|    }
 1498|       |
 1499|    460|    mz_stream_mem_open(zip->local_file_info_stream, NULL, MZ_OPEN_MODE_CREATE);
  ------------------
  |  |   54|    460|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
 1500|       |
 1501|    460|    zip->open_mode = mode;
 1502|       |
 1503|    460|    return err;
 1504|    460|}
mz_zip_close:
 1506|    460|int32_t mz_zip_close(void *handle) {
 1507|    460|    mz_zip *zip = (mz_zip *)handle;
 1508|    460|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
 1509|       |
 1510|    460|    if (!zip)
  ------------------
  |  Branch (1510:9): [True: 0, False: 460]
  ------------------
 1511|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1512|       |
 1513|    460|    mz_zip_print("Zip - Close\n");
 1514|       |
 1515|    460|    if (mz_zip_entry_is_open(handle) == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1515:9): [True: 0, False: 460]
  ------------------
 1516|      0|        err = mz_zip_entry_close(handle);
 1517|       |
 1518|    460|    if ((err == MZ_OK) && (zip->open_mode & MZ_OPEN_MODE_WRITE))
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && (zip->open_mode & MZ_OPEN_MODE_WRITE))
  ------------------
  |  |   51|    460|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1518:9): [True: 460, False: 0]
  |  Branch (1518:27): [True: 460, False: 0]
  ------------------
 1519|    460|        err = mz_zip_write_cd(handle);
 1520|       |
 1521|    460|    if (zip->cd_mem_stream) {
  ------------------
  |  Branch (1521:9): [True: 460, False: 0]
  ------------------
 1522|    460|        mz_stream_close(zip->cd_mem_stream);
 1523|    460|        mz_stream_delete(&zip->cd_mem_stream);
 1524|    460|    }
 1525|       |
 1526|    460|    if (zip->file_info_stream) {
  ------------------
  |  Branch (1526:9): [True: 460, False: 0]
  ------------------
 1527|    460|        mz_stream_mem_close(zip->file_info_stream);
 1528|    460|        mz_stream_mem_delete(&zip->file_info_stream);
 1529|    460|    }
 1530|    460|    if (zip->local_file_info_stream) {
  ------------------
  |  Branch (1530:9): [True: 460, False: 0]
  ------------------
 1531|    460|        mz_stream_mem_close(zip->local_file_info_stream);
 1532|    460|        mz_stream_mem_delete(&zip->local_file_info_stream);
 1533|    460|    }
 1534|       |
 1535|    460|    if (zip->comment) {
  ------------------
  |  Branch (1535:9): [True: 0, False: 460]
  ------------------
 1536|      0|        free(zip->comment);
 1537|      0|        zip->comment = NULL;
 1538|      0|    }
 1539|       |
 1540|    460|    zip->stream = NULL;
 1541|    460|    zip->cd_stream = NULL;
 1542|       |
 1543|    460|    return err;
 1544|    460|}
mz_zip_entry_is_open:
 1864|  2.02k|int32_t mz_zip_entry_is_open(void *handle) {
 1865|  2.02k|    mz_zip *zip = (mz_zip *)handle;
 1866|  2.02k|    if (!zip)
  ------------------
  |  Branch (1866:9): [True: 0, False: 2.02k]
  ------------------
 1867|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1868|  2.02k|    if (zip->entry_opened == 0)
  ------------------
  |  Branch (1868:9): [True: 920, False: 1.10k]
  ------------------
 1869|    920|        return MZ_EXIST_ERROR;
  ------------------
  |  |   36|    920|#define MZ_EXIST_ERROR    (-107)
  ------------------
 1870|  1.10k|    return MZ_OK;
  ------------------
  |  |   21|  1.10k|#define MZ_OK             (0)  /* zlib */
  ------------------
 1871|  2.02k|}
mz_zip_entry_write_open:
 1915|    460|                                const char *password) {
 1916|    460|    mz_zip *zip = (mz_zip *)handle;
 1917|    460|    int64_t filename_pos = -1;
 1918|    460|    int64_t extrafield_pos = 0;
 1919|    460|    int64_t comment_pos = 0;
 1920|    460|    int64_t linkname_pos = 0;
 1921|    460|    int64_t disk_number = 0;
 1922|    460|    uint8_t is_dir = 0;
 1923|    460|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
 1924|       |
 1925|       |#if defined(MZ_ZIP_NO_ENCRYPTION)
 1926|       |    if (password)
 1927|       |        return MZ_SUPPORT_ERROR;
 1928|       |#endif
 1929|    460|    if (!zip || !file_info || !file_info->filename)
  ------------------
  |  Branch (1929:9): [True: 0, False: 460]
  |  Branch (1929:17): [True: 0, False: 460]
  |  Branch (1929:31): [True: 0, False: 460]
  ------------------
 1930|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1931|       |
 1932|    460|    if (mz_zip_entry_is_open(handle) == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1932:9): [True: 0, False: 460]
  ------------------
 1933|      0|        err = mz_zip_entry_close(handle);
 1934|      0|        if (err != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1934:13): [True: 0, False: 0]
  ------------------
 1935|      0|            return err;
 1936|      0|    }
 1937|       |
 1938|    460|    memcpy(&zip->file_info, file_info, sizeof(mz_zip_file));
 1939|       |
 1940|    460|    mz_zip_print("Zip - Entry - Write open - %s (level %" PRId16 " raw %" PRId8 ")\n", zip->file_info.filename,
 1941|    460|                 compress_level, raw);
 1942|       |
 1943|    460|    mz_stream_seek(zip->file_info_stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   58|    460|#define MZ_SEEK_SET (0)
  ------------------
 1944|    460|    mz_stream_write(zip->file_info_stream, file_info, sizeof(mz_zip_file));
 1945|       |
 1946|       |    /* Copy filename, extrafield, and comment internally */
 1947|    460|    filename_pos = mz_stream_tell(zip->file_info_stream);
 1948|    460|    if (file_info->filename)
  ------------------
  |  Branch (1948:9): [True: 460, False: 0]
  ------------------
 1949|    460|        mz_stream_write(zip->file_info_stream, file_info->filename, (int32_t)strlen(file_info->filename));
 1950|    460|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1951|       |
 1952|    460|    extrafield_pos = mz_stream_tell(zip->file_info_stream);
 1953|    460|    if (file_info->extrafield)
  ------------------
  |  Branch (1953:9): [True: 0, False: 460]
  ------------------
 1954|      0|        mz_stream_write(zip->file_info_stream, file_info->extrafield, file_info->extrafield_size);
 1955|    460|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1956|       |
 1957|    460|    comment_pos = mz_stream_tell(zip->file_info_stream);
 1958|    460|    if (file_info->comment)
  ------------------
  |  Branch (1958:9): [True: 0, False: 460]
  ------------------
 1959|      0|        mz_stream_write(zip->file_info_stream, file_info->comment, file_info->comment_size);
 1960|    460|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1961|       |
 1962|    460|    linkname_pos = mz_stream_tell(zip->file_info_stream);
 1963|    460|    if (file_info->linkname)
  ------------------
  |  Branch (1963:9): [True: 0, False: 460]
  ------------------
 1964|      0|        mz_stream_write(zip->file_info_stream, file_info->linkname, (int32_t)strlen(file_info->linkname));
 1965|    460|    mz_stream_write_uint8(zip->file_info_stream, 0);
 1966|       |
 1967|    460|    mz_stream_mem_get_buffer_at(zip->file_info_stream, filename_pos, (const void **)&zip->file_info.filename);
 1968|    460|    mz_stream_mem_get_buffer_at(zip->file_info_stream, extrafield_pos, (const void **)&zip->file_info.extrafield);
 1969|    460|    mz_stream_mem_get_buffer_at(zip->file_info_stream, comment_pos, (const void **)&zip->file_info.comment);
 1970|    460|    mz_stream_mem_get_buffer_at(zip->file_info_stream, linkname_pos, (const void **)&zip->file_info.linkname);
 1971|       |
 1972|    460|    if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE) {
  ------------------
  |  |   64|    460|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
  |  Branch (1972:9): [True: 70, False: 390]
  ------------------
 1973|     70|        if ((compress_level == 8) || (compress_level == 9))
  ------------------
  |  Branch (1973:13): [True: 1, False: 69]
  |  Branch (1973:38): [True: 1, False: 68]
  ------------------
 1974|      2|            zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_MAX;
  ------------------
  |  |   79|      2|#define MZ_ZIP_FLAG_DEFLATE_MAX        (1 << 1)
  ------------------
 1975|     70|        if (compress_level == 2)
  ------------------
  |  Branch (1975:13): [True: 1, False: 69]
  ------------------
 1976|      1|            zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_FAST;
  ------------------
  |  |   81|      1|#define MZ_ZIP_FLAG_DEFLATE_FAST       (1 << 2)
  ------------------
 1977|     70|        if (compress_level == 1)
  ------------------
  |  Branch (1977:13): [True: 1, False: 69]
  ------------------
 1978|      1|            zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_SUPER_FAST;
  ------------------
  |  |   82|      1|#define MZ_ZIP_FLAG_DEFLATE_SUPER_FAST (MZ_ZIP_FLAG_DEFLATE_FAST | MZ_ZIP_FLAG_DEFLATE_MAX)
  |  |  ------------------
  |  |  |  |   81|      1|#define MZ_ZIP_FLAG_DEFLATE_FAST       (1 << 2)
  |  |  ------------------
  |  |               #define MZ_ZIP_FLAG_DEFLATE_SUPER_FAST (MZ_ZIP_FLAG_DEFLATE_FAST | MZ_ZIP_FLAG_DEFLATE_MAX)
  |  |  ------------------
  |  |  |  |   79|      1|#define MZ_ZIP_FLAG_DEFLATE_MAX        (1 << 1)
  |  |  ------------------
  ------------------
 1979|     70|    }
 1980|       |#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP)
 1981|       |    else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_LZMA ||
 1982|       |             zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ)
 1983|       |        zip->file_info.flag |= MZ_ZIP_FLAG_LZMA_EOS_MARKER;
 1984|       |#endif
 1985|       |
 1986|    460|    if (mz_zip_attrib_is_dir(zip->file_info.external_fa, zip->file_info.version_madeby) == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1986:9): [True: 0, False: 460]
  ------------------
 1987|      0|        is_dir = 1;
 1988|       |
 1989|    460|    if (!is_dir) {
  ------------------
  |  Branch (1989:9): [True: 460, False: 0]
  ------------------
 1990|    460|        if (zip->data_descriptor)
  ------------------
  |  Branch (1990:13): [True: 460, False: 0]
  ------------------
 1991|    460|            zip->file_info.flag |= MZ_ZIP_FLAG_DATA_DESCRIPTOR;
  ------------------
  |  |   83|    460|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
 1992|    460|        if (password)
  ------------------
  |  Branch (1992:13): [True: 195, False: 265]
  ------------------
 1993|    195|            zip->file_info.flag |= MZ_ZIP_FLAG_ENCRYPTED;
  ------------------
  |  |   77|    195|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
 1994|    460|    }
 1995|       |
 1996|    460|    mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number);
  ------------------
  |  |   27|    460|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
 1997|    460|    zip->file_info.disk_number = (uint32_t)disk_number;
 1998|    460|    zip->file_info.disk_offset = mz_stream_tell(zip->stream);
 1999|       |
 2000|    460|    if (zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) {
  ------------------
  |  |   77|    460|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (2000:9): [True: 195, False: 265]
  ------------------
 2001|    195|#ifdef HAVE_PKCRYPT
 2002|       |        /* Pre-calculated CRC value is required for PKWARE traditional encryption */
 2003|    195|        uint32_t dos_date = mz_zip_time_t_to_dos_date(zip->file_info.modified_date);
 2004|    195|        zip->file_info.pk_verify = mz_zip_get_pk_verify(dos_date, zip->file_info.crc, zip->file_info.flag);
 2005|    195|#endif
 2006|    195|#ifdef HAVE_WZAES
 2007|    195|        if (zip->file_info.aes_version && zip->file_info.aes_strength == 0)
  ------------------
  |  Branch (2007:13): [True: 0, False: 195]
  |  Branch (2007:43): [True: 0, False: 0]
  ------------------
 2008|      0|            zip->file_info.aes_strength = MZ_AES_STRENGTH_256;
  ------------------
  |  |  119|      0|#define MZ_AES_STRENGTH_256   (3)
  ------------------
 2009|    195|#endif
 2010|    195|    }
 2011|       |
 2012|    460|    zip->file_info.crc = 0;
 2013|    460|    zip->file_info.compressed_size = 0;
 2014|       |
 2015|    460|    if ((compress_level == 0) || (is_dir))
  ------------------
  |  Branch (2015:9): [True: 28, False: 432]
  |  Branch (2015:34): [True: 0, False: 432]
  ------------------
 2016|     28|        zip->file_info.compression_method = MZ_COMPRESS_METHOD_STORE;
  ------------------
  |  |   63|     28|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
 2017|       |
 2018|    460|#ifdef MZ_ZIP_NO_COMPRESSION
 2019|    460|    if (zip->file_info.compression_method != MZ_COMPRESS_METHOD_STORE)
  ------------------
  |  |   63|    460|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (2019:9): [True: 92, False: 368]
  ------------------
 2020|     92|        err = MZ_SUPPORT_ERROR;
  ------------------
  |  |   38|     92|#define MZ_SUPPORT_ERROR  (-109)
  ------------------
 2021|    460|#endif
 2022|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2022:9): [True: 368, False: 92]
  ------------------
 2023|    368|        err = mz_zip_entry_write_header(zip->stream, 1, &zip->file_info);
 2024|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2024:9): [True: 368, False: 92]
  ------------------
 2025|    368|        err = mz_zip_entry_open_int(handle, raw, compress_level, password);
 2026|       |
 2027|    460|    return err;
 2028|    460|}
mz_zip_entry_write:
 2055|    368|int32_t mz_zip_entry_write(void *handle, const void *buf, int32_t len) {
 2056|    368|    mz_zip *zip = (mz_zip *)handle;
 2057|    368|    int32_t written = 0;
 2058|       |
 2059|    368|    if (!zip || mz_zip_entry_is_open(handle) != MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2059:9): [True: 0, False: 368]
  |  Branch (2059:17): [True: 0, False: 368]
  ------------------
 2060|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2061|    368|    written = mz_stream_write(zip->compress_stream, buf, len);
 2062|    368|    if (written > 0)
  ------------------
  |  Branch (2062:9): [True: 283, False: 85]
  ------------------
 2063|    283|        zip->entry_crc32 = mz_crypt_crc32_update(zip->entry_crc32, buf, written);
 2064|       |
 2065|    368|    mz_zip_print("Zip - Entry - Write - %" PRId32 " (max %" PRId32 ")\n", written, len);
 2066|    368|    return written;
 2067|    368|}
mz_zip_entry_write_close:
 2135|    368|int32_t mz_zip_entry_write_close(void *handle, uint32_t crc32, int64_t compressed_size, int64_t uncompressed_size) {
 2136|    368|    mz_zip *zip = (mz_zip *)handle;
 2137|    368|    int64_t end_disk_number = 0;
 2138|    368|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
 2139|    368|    uint8_t zip64 = 0;
 2140|       |
 2141|    368|    if (!zip || mz_zip_entry_is_open(handle) != MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2141:9): [True: 0, False: 368]
  |  Branch (2141:17): [True: 0, False: 368]
  ------------------
 2142|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2143|       |
 2144|    368|    mz_stream_close(zip->compress_stream);
 2145|       |
 2146|    368|    if (!zip->entry_raw)
  ------------------
  |  Branch (2146:9): [True: 368, False: 0]
  ------------------
 2147|    368|        crc32 = zip->entry_crc32;
 2148|       |
 2149|    368|    mz_zip_print("Zip - Entry - Write Close (crc 0x%08" PRIx32 " cs %" PRId64 " ucs %" PRId64 ")\n", crc32,
 2150|    368|                 compressed_size, uncompressed_size);
 2151|       |
 2152|       |    /* If sizes are not set, then read them from the compression stream */
 2153|    368|    if (compressed_size < 0)
  ------------------
  |  Branch (2153:9): [True: 368, False: 0]
  ------------------
 2154|    368|        mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_OUT, &compressed_size);
  ------------------
  |  |   22|    368|#define MZ_STREAM_PROP_TOTAL_OUT       (3)
  ------------------
 2155|    368|    if (uncompressed_size < 0)
  ------------------
  |  Branch (2155:9): [True: 368, False: 0]
  ------------------
 2156|    368|        mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN, &uncompressed_size);
  ------------------
  |  |   20|    368|#define MZ_STREAM_PROP_TOTAL_IN        (1)
  ------------------
 2157|       |
 2158|    368|    if (zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) {
  ------------------
  |  |   77|    368|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (2158:9): [True: 194, False: 174]
  ------------------
 2159|    194|        mz_stream_set_base(zip->crypt_stream, zip->stream);
 2160|    194|        err = mz_stream_close(zip->crypt_stream);
 2161|       |
 2162|    194|        mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_OUT, &compressed_size);
  ------------------
  |  |   22|    194|#define MZ_STREAM_PROP_TOTAL_OUT       (3)
  ------------------
 2163|    194|    }
 2164|       |
 2165|    368|    mz_zip_entry_needs_zip64(&zip->file_info, 1, &zip64);
 2166|       |
 2167|    368|    if ((err == MZ_OK) && (zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && (zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)) {
  ------------------
  |  |   83|    368|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
  |  Branch (2167:9): [True: 368, False: 0]
  |  Branch (2167:27): [True: 368, False: 0]
  ------------------
 2168|       |        /* Determine if we need to write data descriptor in zip64 format,
 2169|       |           if local extrafield was saved with zip64 extrafield */
 2170|       |
 2171|    368|        if (zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO)
  ------------------
  |  |   85|    368|#define MZ_ZIP_FLAG_MASK_LOCAL_INFO    (1 << 13)
  ------------------
  |  Branch (2171:13): [True: 126, False: 242]
  ------------------
 2172|    126|            err = mz_zip_entry_write_descriptor(zip->stream, zip64, 0, compressed_size, 0);
 2173|    242|        else
 2174|    242|            err = mz_zip_entry_write_descriptor(zip->stream, zip64, crc32, compressed_size, uncompressed_size);
 2175|    368|    }
 2176|       |
 2177|       |    /* Write file info to central directory */
 2178|       |
 2179|    368|    mz_zip_print("Zip - Entry - Write cd (ucs %" PRId64 " cs %" PRId64 " crc 0x%08" PRIx32 ")\n", uncompressed_size,
 2180|    368|                 compressed_size, crc32);
 2181|       |
 2182|    368|    zip->file_info.crc = crc32;
 2183|    368|    zip->file_info.compressed_size = compressed_size;
 2184|    368|    zip->file_info.uncompressed_size = uncompressed_size;
 2185|       |
 2186|    368|    if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2186:9): [True: 368, False: 0]
  ------------------
 2187|    368|        err = mz_zip_entry_write_header(zip->cd_mem_stream, 0, &zip->file_info);
 2188|       |
 2189|       |    /* Update local header with crc32 and sizes */
 2190|    368|    if ((err == MZ_OK) && ((zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) == 0) &&
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && ((zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) == 0) &&
  ------------------
  |  |   83|    368|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
  |  Branch (2190:9): [True: 368, False: 0]
  |  Branch (2190:27): [True: 0, False: 368]
  ------------------
 2191|    368|        ((zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO) == 0)) {
  ------------------
  |  |   85|      0|#define MZ_ZIP_FLAG_MASK_LOCAL_INFO    (1 << 13)
  ------------------
  |  Branch (2191:9): [True: 0, False: 0]
  ------------------
 2192|       |        /* Save the disk number and position we are to seek back after updating local header */
 2193|      0|        int64_t end_pos = mz_stream_tell(zip->stream);
 2194|      0|        mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &end_disk_number);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
 2195|       |
 2196|      0|        err = mz_zip_entry_seek_local_header(handle);
 2197|       |
 2198|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2198:13): [True: 0, False: 0]
  ------------------
 2199|       |            /* Seek to crc32 and sizes offset in local header */
 2200|      0|            mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, zip->file_info.disk_number);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
 2201|      0|            err = mz_stream_seek(zip->stream, zip->file_info.disk_offset + MZ_ZIP_OFFSET_CRC_SIZES, MZ_SEEK_SET);
  ------------------
  |  |   74|      0|#define MZ_ZIP_OFFSET_CRC_SIZES         (14)
  ------------------
                          err = mz_stream_seek(zip->stream, zip->file_info.disk_offset + MZ_ZIP_OFFSET_CRC_SIZES, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
 2202|      0|        }
 2203|       |
 2204|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2204:13): [True: 0, False: 0]
  ------------------
 2205|      0|            err = mz_zip_entry_write_crc_sizes(zip->stream, zip64, 0, &zip->file_info);
 2206|       |
 2207|       |        /* Seek to and update zip64 extension sizes */
 2208|      0|        if ((err == MZ_OK) && (zip64)) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2208:13): [True: 0, False: 0]
  |  Branch (2208:31): [True: 0, False: 0]
  ------------------
 2209|      0|            int64_t filename_size = zip->file_info.filename_size;
 2210|       |
 2211|      0|            if (filename_size == 0)
  ------------------
  |  Branch (2211:17): [True: 0, False: 0]
  ------------------
 2212|      0|                filename_size = strlen(zip->file_info.filename);
 2213|       |
 2214|       |            /* Since we write zip64 extension first we know its offset */
 2215|      0|            err = mz_stream_seek(zip->stream, 2 + 2 + filename_size + 4, MZ_SEEK_CUR);
  ------------------
  |  |   59|      0|#define MZ_SEEK_CUR (1)
  ------------------
 2216|       |
 2217|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2217:17): [True: 0, False: 0]
  ------------------
 2218|      0|                err = mz_stream_write_uint64(zip->stream, zip->file_info.uncompressed_size);
 2219|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2219:17): [True: 0, False: 0]
  ------------------
 2220|      0|                err = mz_stream_write_uint64(zip->stream, zip->file_info.compressed_size);
 2221|      0|        }
 2222|       |
 2223|      0|        mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, end_disk_number);
  ------------------
  |  |   27|      0|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
 2224|      0|        mz_stream_seek(zip->stream, end_pos, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
 2225|      0|    }
 2226|       |
 2227|    368|    zip->number_entry += 1;
 2228|       |
 2229|    368|    mz_zip_entry_close_int(handle);
 2230|       |
 2231|    368|    return err;
 2232|    368|}
mz_zip_entry_close:
 2267|    368|int32_t mz_zip_entry_close(void *handle) {
 2268|    368|    return mz_zip_entry_close_raw(handle, UINT64_MAX, 0);
 2269|    368|}
mz_zip_entry_close_raw:
 2271|    368|int32_t mz_zip_entry_close_raw(void *handle, int64_t uncompressed_size, uint32_t crc32) {
 2272|    368|    mz_zip *zip = (mz_zip *)handle;
 2273|    368|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
 2274|       |
 2275|    368|    if (!zip || mz_zip_entry_is_open(handle) != MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2275:9): [True: 0, False: 368]
  |  Branch (2275:17): [True: 0, False: 368]
  ------------------
 2276|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2277|       |
 2278|    368|    if (zip->open_mode & MZ_OPEN_MODE_WRITE)
  ------------------
  |  |   51|    368|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (2278:9): [True: 368, False: 0]
  ------------------
 2279|    368|        err = mz_zip_entry_write_close(handle, crc32, UINT64_MAX, uncompressed_size);
 2280|      0|    else
 2281|      0|        err = mz_zip_entry_read_close(handle, NULL, NULL, NULL);
 2282|       |
 2283|    368|    return err;
 2284|    368|}
mz_zip_attrib_is_dir:
 2479|  1.78k|int32_t mz_zip_attrib_is_dir(uint32_t attrib, int32_t version_madeby) {
 2480|  1.78k|    uint32_t posix_attrib = 0;
 2481|  1.78k|    uint8_t system = MZ_HOST_SYSTEM(version_madeby);
  ------------------
  |  |  102|  1.78k|#define MZ_HOST_SYSTEM(VERSION_MADEBY) ((uint8_t)(VERSION_MADEBY >> 8))
  ------------------
 2482|  1.78k|    int32_t err = MZ_OK;
  ------------------
  |  |   21|  1.78k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2483|       |
 2484|  1.78k|    err = mz_zip_attrib_convert(system, attrib, MZ_HOST_SYSTEM_UNIX, &posix_attrib);
  ------------------
  |  |  104|  1.78k|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
 2485|  1.78k|    if (err == MZ_OK) {
  ------------------
  |  |   21|  1.78k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2485:9): [True: 1.78k, False: 0]
  ------------------
 2486|  1.78k|        if ((posix_attrib & 0170000) == 0040000) /* S_ISDIR */
  ------------------
  |  Branch (2486:13): [True: 0, False: 1.78k]
  ------------------
 2487|      0|            return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 2488|  1.78k|    }
 2489|       |
 2490|  1.78k|    return MZ_EXIST_ERROR;
  ------------------
  |  |   36|  1.78k|#define MZ_EXIST_ERROR    (-107)
  ------------------
 2491|  1.78k|}
mz_zip_attrib_convert:
 2507|  1.78k|int32_t mz_zip_attrib_convert(uint8_t src_sys, uint32_t src_attrib, uint8_t target_sys, uint32_t *target_attrib) {
 2508|  1.78k|    if (!target_attrib)
  ------------------
  |  Branch (2508:9): [True: 0, False: 1.78k]
  ------------------
 2509|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2510|       |
 2511|  1.78k|    *target_attrib = 0;
 2512|       |
 2513|  1.78k|    if ((src_sys == MZ_HOST_SYSTEM_MSDOS) || (src_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  103|  1.78k|#define MZ_HOST_SYSTEM_MSDOS           (0)
  ------------------
                  if ((src_sys == MZ_HOST_SYSTEM_MSDOS) || (src_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  105|      0|#define MZ_HOST_SYSTEM_WINDOWS_NTFS    (10)
  ------------------
  |  Branch (2513:9): [True: 1.78k, False: 0]
  |  Branch (2513:46): [True: 0, False: 0]
  ------------------
 2514|  1.78k|        if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  103|  1.78k|#define MZ_HOST_SYSTEM_MSDOS           (0)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) {
  ------------------
  |  |  105|  1.78k|#define MZ_HOST_SYSTEM_WINDOWS_NTFS    (10)
  ------------------
  |  Branch (2514:13): [True: 0, False: 1.78k]
  |  Branch (2514:53): [True: 0, False: 1.78k]
  ------------------
 2515|      0|            *target_attrib = src_attrib;
 2516|      0|            return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 2517|      0|        }
 2518|  1.78k|        if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  104|  1.78k|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  107|      0|#define MZ_HOST_SYSTEM_OSX_DARWIN      (19)
  ------------------
  |  Branch (2518:13): [True: 1.78k, False: 0]
  |  Branch (2518:52): [True: 0, False: 0]
  ------------------
 2519|  1.78k|            (target_sys == MZ_HOST_SYSTEM_RISCOS))
  ------------------
  |  |  106|      0|#define MZ_HOST_SYSTEM_RISCOS          (13)
  ------------------
  |  Branch (2519:13): [True: 0, False: 0]
  ------------------
 2520|  1.78k|            return mz_zip_attrib_win32_to_posix(src_attrib, target_attrib);
 2521|  1.78k|    } else if ((src_sys == MZ_HOST_SYSTEM_UNIX) || (src_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  104|      0|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
                  } else if ((src_sys == MZ_HOST_SYSTEM_UNIX) || (src_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  107|      0|#define MZ_HOST_SYSTEM_OSX_DARWIN      (19)
  ------------------
  |  Branch (2521:16): [True: 0, False: 0]
  |  Branch (2521:52): [True: 0, False: 0]
  ------------------
 2522|      0|               (src_sys == MZ_HOST_SYSTEM_RISCOS)) {
  ------------------
  |  |  106|      0|#define MZ_HOST_SYSTEM_RISCOS          (13)
  ------------------
  |  Branch (2522:16): [True: 0, False: 0]
  ------------------
 2523|       |        /* If high bytes are set, it contains unix specific attributes */
 2524|      0|        if ((src_attrib >> 16) != 0)
  ------------------
  |  Branch (2524:13): [True: 0, False: 0]
  ------------------
 2525|      0|            src_attrib >>= 16;
 2526|       |
 2527|      0|        if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  104|      0|#define MZ_HOST_SYSTEM_UNIX            (3)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) ||
  ------------------
  |  |  107|      0|#define MZ_HOST_SYSTEM_OSX_DARWIN      (19)
  ------------------
  |  Branch (2527:13): [True: 0, False: 0]
  |  Branch (2527:52): [True: 0, False: 0]
  ------------------
 2528|      0|            (target_sys == MZ_HOST_SYSTEM_RISCOS)) {
  ------------------
  |  |  106|      0|#define MZ_HOST_SYSTEM_RISCOS          (13)
  ------------------
  |  Branch (2528:13): [True: 0, False: 0]
  ------------------
 2529|      0|            *target_attrib = src_attrib;
 2530|      0|            return MZ_OK;
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
 2531|      0|        }
 2532|      0|        if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS))
  ------------------
  |  |  103|      0|#define MZ_HOST_SYSTEM_MSDOS           (0)
  ------------------
                      if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS))
  ------------------
  |  |  105|      0|#define MZ_HOST_SYSTEM_WINDOWS_NTFS    (10)
  ------------------
  |  Branch (2532:13): [True: 0, False: 0]
  |  Branch (2532:53): [True: 0, False: 0]
  ------------------
 2533|      0|            return mz_zip_attrib_posix_to_win32(src_attrib, target_attrib);
 2534|      0|    }
 2535|       |
 2536|      0|    return MZ_SUPPORT_ERROR;
  ------------------
  |  |   38|      0|#define MZ_SUPPORT_ERROR  (-109)
  ------------------
 2537|  1.78k|}
mz_zip_attrib_win32_to_posix:
 2561|  1.78k|int32_t mz_zip_attrib_win32_to_posix(uint32_t win32_attrib, uint32_t *posix_attrib) {
 2562|  1.78k|    if (!posix_attrib)
  ------------------
  |  Branch (2562:9): [True: 0, False: 1.78k]
  ------------------
 2563|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2564|       |
 2565|  1.78k|    *posix_attrib = 0000444; /* S_IRUSR | S_IRGRP | S_IROTH */
 2566|       |    /* FILE_ATTRIBUTE_READONLY */
 2567|  1.78k|    if ((win32_attrib & 0x01) == 0)
  ------------------
  |  Branch (2567:9): [True: 1.78k, False: 0]
  ------------------
 2568|  1.78k|        *posix_attrib |= 0000222; /* S_IWUSR | S_IWGRP | S_IWOTH */
 2569|       |    /* FILE_ATTRIBUTE_REPARSE_POINT */
 2570|  1.78k|    if ((win32_attrib & 0x400) == 0x400)
  ------------------
  |  Branch (2570:9): [True: 0, False: 1.78k]
  ------------------
 2571|      0|        *posix_attrib |= 0120000; /* S_IFLNK */
 2572|       |    /* FILE_ATTRIBUTE_DIRECTORY */
 2573|  1.78k|    else if ((win32_attrib & 0x10) == 0x10)
  ------------------
  |  Branch (2573:14): [True: 0, False: 1.78k]
  ------------------
 2574|      0|        *posix_attrib |= 0040111; /* S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH */
 2575|  1.78k|    else
 2576|  1.78k|        *posix_attrib |= 0100000; /* S_IFREG */
 2577|       |
 2578|  1.78k|    return MZ_OK;
  ------------------
  |  |   21|  1.78k|#define MZ_OK             (0)  /* zlib */
  ------------------
 2579|  1.78k|}
mz_zip_extrafield_write:
 2642|    367|int32_t mz_zip_extrafield_write(void *stream, uint16_t type, uint16_t length) {
 2643|    367|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    367|#define MZ_OK             (0)  /* zlib */
  ------------------
 2644|    367|    err = mz_stream_write_uint16(stream, type);
 2645|    367|    if (err == MZ_OK)
  ------------------
  |  |   21|    367|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (2645:9): [True: 367, False: 0]
  ------------------
 2646|    367|        err = mz_stream_write_uint16(stream, length);
 2647|    367|    return err;
 2648|    367|}
mz_zip_time_t_to_tm:
 2697|    195|int32_t mz_zip_time_t_to_tm(time_t unix_time, struct tm *ptm) {
 2698|    195|    struct tm ltm;
 2699|    195|    if (!ptm)
  ------------------
  |  Branch (2699:9): [True: 0, False: 195]
  ------------------
 2700|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 2701|    195|    if (!localtime_r(&unix_time, &ltm)) { /* Returns a 1900-based year */
  ------------------
  |  Branch (2701:9): [True: 0, False: 195]
  ------------------
 2702|       |        /* Invalid date stored, so don't return it */
 2703|      0|        memset(ptm, 0, sizeof(struct tm));
 2704|      0|        return MZ_INTERNAL_ERROR;
  ------------------
  |  |   33|      0|#define MZ_INTERNAL_ERROR (-104)
  ------------------
 2705|      0|    }
 2706|    195|    memcpy(ptm, &ltm, sizeof(struct tm));
 2707|    195|    return MZ_OK;
  ------------------
  |  |   21|    195|#define MZ_OK             (0)  /* zlib */
  ------------------
 2708|    195|}
mz_zip_time_t_to_dos_date:
 2710|    195|uint32_t mz_zip_time_t_to_dos_date(time_t unix_time) {
 2711|    195|    struct tm ptm;
 2712|    195|    mz_zip_time_t_to_tm(unix_time, &ptm);
 2713|    195|    return mz_zip_tm_to_dosdate((const struct tm *)&ptm);
 2714|    195|}
mz_zip_tm_to_dosdate:
 2716|    195|uint32_t mz_zip_tm_to_dosdate(const struct tm *ptm) {
 2717|    195|    struct tm fixed_tm;
 2718|       |
 2719|       |    /* Years supported: */
 2720|       |
 2721|       |    /* [00, 79]      (assumed to be between 2000 and 2079) */
 2722|       |    /* [80, 207]     (assumed to be between 1980 and 2107, typical output of old */
 2723|       |    /*                software that does 'year-1900' to get a double digit year) */
 2724|       |    /* [1980, 2107]  (due to format limitations, only years 1980-2107 can be stored.) */
 2725|       |
 2726|    195|    memcpy(&fixed_tm, ptm, sizeof(struct tm));
 2727|    195|    if (fixed_tm.tm_year >= 1980) /* range [1980, 2107] */
  ------------------
  |  Branch (2727:9): [True: 0, False: 195]
  ------------------
 2728|      0|        fixed_tm.tm_year -= 1980;
 2729|    195|    else if (fixed_tm.tm_year >= 80) /* range [80, 207] */
  ------------------
  |  Branch (2729:14): [True: 0, False: 195]
  ------------------
 2730|      0|        fixed_tm.tm_year -= 80;
 2731|    195|    else /* range [00, 79] */
 2732|    195|        fixed_tm.tm_year += 20;
 2733|       |
 2734|    195|    if (mz_zip_invalid_date(&fixed_tm))
  ------------------
  |  Branch (2734:9): [True: 0, False: 195]
  ------------------
 2735|      0|        return 0;
 2736|       |
 2737|    195|    return (((uint32_t)fixed_tm.tm_mday + (32 * ((uint32_t)fixed_tm.tm_mon + 1)) + (512 * (uint32_t)fixed_tm.tm_year))
 2738|    195|            << 16) |
 2739|    195|        (((uint32_t)fixed_tm.tm_sec / 2) + (32 * (uint32_t)fixed_tm.tm_min) + (2048 * (uint32_t)fixed_tm.tm_hour));
 2740|    195|}
mz_zip.c:mz_zip_write_cd:
 1101|    460|static int32_t mz_zip_write_cd(void *handle) {
 1102|    460|    mz_zip *zip = (mz_zip *)handle;
 1103|    460|    int64_t zip64_eocd_pos_inzip = 0;
 1104|    460|    int64_t disk_number = 0;
 1105|    460|    int64_t disk_size = 0;
 1106|    460|    int32_t comment_size = 0;
 1107|    460|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
 1108|       |
 1109|    460|    if (!zip)
  ------------------
  |  Branch (1109:9): [True: 0, False: 460]
  ------------------
 1110|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1111|       |
 1112|    460|    if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number) == MZ_OK)
  ------------------
  |  |   27|    460|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
                  if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number) == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1112:9): [True: 0, False: 460]
  ------------------
 1113|      0|        zip->disk_number_with_cd = (uint32_t)disk_number;
 1114|    460|    if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_SIZE, &disk_size) == MZ_OK && disk_size > 0)
  ------------------
  |  |   26|    460|#define MZ_STREAM_PROP_DISK_SIZE       (7)
  ------------------
                  if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_SIZE, &disk_size) == MZ_OK && disk_size > 0)
  ------------------
  |  |   21|    920|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1114:9): [True: 0, False: 460]
  |  Branch (1114:97): [True: 0, False: 0]
  ------------------
 1115|      0|        zip->disk_number_with_cd += 1;
 1116|    460|    mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, -1);
  ------------------
  |  |   27|    460|#define MZ_STREAM_PROP_DISK_NUMBER     (8)
  ------------------
 1117|    460|    if ((zip->disk_number_with_cd > 0) && (zip->open_mode & MZ_OPEN_MODE_APPEND)) {
  ------------------
  |  |   53|      0|#define MZ_OPEN_MODE_APPEND    (0x04)
  ------------------
  |  Branch (1117:9): [True: 0, False: 460]
  |  Branch (1117:43): [True: 0, False: 0]
  ------------------
 1118|       |        /* Overwrite existing central directory if using split disks */
 1119|      0|        mz_stream_seek(zip->stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
 1120|      0|    }
 1121|       |
 1122|    460|    zip->cd_offset = mz_stream_tell(zip->stream);
 1123|    460|    mz_stream_seek(zip->cd_mem_stream, 0, MZ_SEEK_END);
  ------------------
  |  |   60|    460|#define MZ_SEEK_END (2)
  ------------------
 1124|    460|    zip->cd_size = (uint32_t)mz_stream_tell(zip->cd_mem_stream);
 1125|    460|    mz_stream_seek(zip->cd_mem_stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   58|    460|#define MZ_SEEK_SET (0)
  ------------------
 1126|       |
 1127|    460|    err = mz_stream_copy(zip->stream, zip->cd_mem_stream, (int32_t)zip->cd_size);
 1128|       |
 1129|    460|    mz_zip_print("Zip - Write cd (disk %" PRId32 " entries %" PRId64 " offset %" PRId64 " size %" PRId64 ")\n",
 1130|    460|                 zip->disk_number_with_cd, zip->number_entry, zip->cd_offset, zip->cd_size);
 1131|       |
 1132|    460|    if (zip->cd_size == 0 && zip->number_entry > 0) {
  ------------------
  |  Branch (1132:9): [True: 92, False: 368]
  |  Branch (1132:30): [True: 0, False: 92]
  ------------------
 1133|       |        /* Zip does not contain central directory, open with recovery option */
 1134|      0|        return MZ_FORMAT_ERROR;
  ------------------
  |  |   32|      0|#define MZ_FORMAT_ERROR   (-103)
  ------------------
 1135|      0|    }
 1136|       |
 1137|       |    /* Write the ZIP64 central directory header */
 1138|    460|    if (zip->cd_offset >= UINT32_MAX || zip->number_entry >= UINT16_MAX) {
  ------------------
  |  Branch (1138:9): [True: 0, False: 460]
  |  Branch (1138:41): [True: 0, False: 460]
  ------------------
 1139|      0|        zip64_eocd_pos_inzip = mz_stream_tell(zip->stream);
 1140|       |
 1141|      0|        err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDHEADER64);
  ------------------
  |  |   64|      0|#define MZ_ZIP_MAGIC_ENDHEADER64        (0x06064b50)
  ------------------
 1142|       |
 1143|       |        /* Size of this 'zip64 end of central directory' */
 1144|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1144:13): [True: 0, False: 0]
  ------------------
 1145|      0|            err = mz_stream_write_uint64(zip->stream, (uint64_t)44);
 1146|       |        /* Version made by */
 1147|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1147:13): [True: 0, False: 0]
  ------------------
 1148|      0|            err = mz_stream_write_uint16(zip->stream, zip->version_madeby);
 1149|       |        /* Version needed */
 1150|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1150:13): [True: 0, False: 0]
  ------------------
 1151|      0|            err = mz_stream_write_uint16(zip->stream, (uint16_t)45);
 1152|       |        /* Number of this disk */
 1153|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1153:13): [True: 0, False: 0]
  ------------------
 1154|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd);
 1155|       |        /* Number of the disk with the start of the central directory */
 1156|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1156:13): [True: 0, False: 0]
  ------------------
 1157|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd);
 1158|       |        /* Total number of entries in the central dir on this disk */
 1159|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1159:13): [True: 0, False: 0]
  ------------------
 1160|      0|            err = mz_stream_write_uint64(zip->stream, zip->number_entry);
 1161|       |        /* Total number of entries in the central dir */
 1162|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1162:13): [True: 0, False: 0]
  ------------------
 1163|      0|            err = mz_stream_write_uint64(zip->stream, zip->number_entry);
 1164|       |        /* Size of the central directory */
 1165|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1165:13): [True: 0, False: 0]
  ------------------
 1166|      0|            err = mz_stream_write_int64(zip->stream, zip->cd_size);
 1167|       |        /* Offset of start of central directory with respect to the starting disk number */
 1168|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1168:13): [True: 0, False: 0]
  ------------------
 1169|      0|            err = mz_stream_write_int64(zip->stream, zip->cd_offset);
 1170|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1170:13): [True: 0, False: 0]
  ------------------
 1171|      0|            err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDLOCHEADER64);
  ------------------
  |  |   65|      0|#define MZ_ZIP_MAGIC_ENDLOCHEADER64     (0x07064b50)
  ------------------
 1172|       |
 1173|       |        /* Number of the disk with the start of the central directory */
 1174|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1174:13): [True: 0, False: 0]
  ------------------
 1175|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd);
 1176|       |        /* Relative offset to the end of zip64 central directory */
 1177|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1177:13): [True: 0, False: 0]
  ------------------
 1178|      0|            err = mz_stream_write_int64(zip->stream, zip64_eocd_pos_inzip);
 1179|       |        /* Number of the disk with the start of the central directory */
 1180|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1180:13): [True: 0, False: 0]
  ------------------
 1181|      0|            err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd + 1);
 1182|      0|    }
 1183|       |
 1184|       |    /* Write the central directory header */
 1185|       |
 1186|       |    /* Signature */
 1187|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1187:9): [True: 460, False: 0]
  ------------------
 1188|    460|        err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDHEADER);
  ------------------
  |  |   62|    460|#define MZ_ZIP_MAGIC_ENDHEADER          (0x06054b50)
  ------------------
 1189|       |    /* Number of this disk */
 1190|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1190:9): [True: 460, False: 0]
  ------------------
 1191|    460|        err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->disk_number_with_cd);
 1192|       |    /* Number of the disk with the start of the central directory */
 1193|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1193:9): [True: 460, False: 0]
  ------------------
 1194|    460|        err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->disk_number_with_cd);
 1195|       |    /* Total number of entries in the central dir on this disk */
 1196|    460|    if (err == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1196:9): [True: 460, False: 0]
  ------------------
 1197|    460|        if (zip->number_entry >= UINT16_MAX)
  ------------------
  |  Branch (1197:13): [True: 0, False: 460]
  ------------------
 1198|      0|            err = mz_stream_write_uint16(zip->stream, UINT16_MAX);
 1199|    460|        else
 1200|    460|            err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry);
 1201|    460|    }
 1202|       |    /* Total number of entries in the central dir */
 1203|    460|    if (err == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1203:9): [True: 460, False: 0]
  ------------------
 1204|    460|        if (zip->number_entry >= UINT16_MAX)
  ------------------
  |  Branch (1204:13): [True: 0, False: 460]
  ------------------
 1205|      0|            err = mz_stream_write_uint16(zip->stream, UINT16_MAX);
 1206|    460|        else
 1207|    460|            err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry);
 1208|    460|    }
 1209|       |    /* Size of the central directory */
 1210|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1210:9): [True: 460, False: 0]
  ------------------
 1211|    460|        err = mz_stream_write_uint32(zip->stream, (uint32_t)zip->cd_size);
 1212|       |    /* Offset of start of central directory with respect to the starting disk number */
 1213|    460|    if (err == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1213:9): [True: 460, False: 0]
  ------------------
 1214|    460|        if (zip->cd_offset >= UINT32_MAX)
  ------------------
  |  Branch (1214:13): [True: 0, False: 460]
  ------------------
 1215|      0|            err = mz_stream_write_uint32(zip->stream, UINT32_MAX);
 1216|    460|        else
 1217|    460|            err = mz_stream_write_uint32(zip->stream, (uint32_t)zip->cd_offset);
 1218|    460|    }
 1219|       |
 1220|       |    /* Write global comment */
 1221|    460|    if (zip->comment) {
  ------------------
  |  Branch (1221:9): [True: 0, False: 460]
  ------------------
 1222|      0|        comment_size = (int32_t)strlen(zip->comment);
 1223|      0|        if (comment_size > UINT16_MAX)
  ------------------
  |  Branch (1223:13): [True: 0, False: 0]
  ------------------
 1224|      0|            comment_size = UINT16_MAX;
 1225|      0|    }
 1226|    460|    if (err == MZ_OK)
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1226:9): [True: 460, False: 0]
  ------------------
 1227|    460|        err = mz_stream_write_uint16(zip->stream, (uint16_t)comment_size);
 1228|    460|    if (err == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1228:9): [True: 460, False: 0]
  ------------------
 1229|    460|        if (mz_stream_write(zip->stream, zip->comment, comment_size) != comment_size)
  ------------------
  |  Branch (1229:13): [True: 0, False: 460]
  ------------------
 1230|      0|            err = MZ_READ_ERROR;
  ------------------
  |  |   44|      0|#define MZ_READ_ERROR     (-115)
  ------------------
 1231|    460|    }
 1232|    460|    return err;
 1233|    460|}
mz_zip.c:mz_zip_entry_open_int:
 1681|    368|static int32_t mz_zip_entry_open_int(void *handle, uint8_t raw, int16_t compress_level, const char *password) {
 1682|    368|    mz_zip *zip = (mz_zip *)handle;
 1683|    368|    int64_t max_total_in = 0;
 1684|    368|    int64_t header_size = 0;
 1685|    368|    int64_t footer_size = 0;
 1686|    368|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
 1687|    368|    uint8_t use_crypt = 0;
 1688|       |
 1689|    368|    if (!zip)
  ------------------
  |  Branch (1689:9): [True: 0, False: 368]
  ------------------
 1690|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1691|       |
 1692|    368|    switch (zip->file_info.compression_method) {
 1693|    368|    case MZ_COMPRESS_METHOD_STORE:
  ------------------
  |  |   63|    368|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (1693:5): [True: 368, False: 0]
  ------------------
 1694|    368|    case MZ_COMPRESS_METHOD_DEFLATE:
  ------------------
  |  |   64|    368|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
  |  Branch (1694:5): [True: 0, False: 368]
  ------------------
 1695|       |#ifdef HAVE_BZIP2
 1696|       |    case MZ_COMPRESS_METHOD_BZIP2:
 1697|       |#endif
 1698|       |#ifdef HAVE_LZMA
 1699|       |    case MZ_COMPRESS_METHOD_LZMA:
 1700|       |#endif
 1701|       |#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP)
 1702|       |    case MZ_COMPRESS_METHOD_XZ:
 1703|       |#endif
 1704|       |#ifdef HAVE_ZSTD
 1705|       |    case MZ_COMPRESS_METHOD_ZSTD:
 1706|       |#endif
 1707|    368|        err = MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
 1708|    368|        break;
 1709|      0|    default:
  ------------------
  |  Branch (1709:5): [True: 0, False: 368]
  ------------------
 1710|      0|        return MZ_SUPPORT_ERROR;
  ------------------
  |  |   38|      0|#define MZ_SUPPORT_ERROR  (-109)
  ------------------
 1711|    368|    }
 1712|       |
 1713|       |#ifndef HAVE_WZAES
 1714|       |    if (zip->file_info.aes_version)
 1715|       |        return MZ_SUPPORT_ERROR;
 1716|       |#endif
 1717|       |
 1718|    368|    zip->entry_raw = raw;
 1719|       |
 1720|    368|    if ((zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) && (password)) {
  ------------------
  |  |   77|    368|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (1720:9): [True: 194, False: 174]
  |  Branch (1720:58): [True: 194, False: 0]
  ------------------
 1721|    194|        if (zip->open_mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    194|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1721:13): [True: 194, False: 0]
  ------------------
 1722|       |            /* Encrypt only when we are not trying to write raw and password is supplied. */
 1723|    194|            if (!zip->entry_raw)
  ------------------
  |  Branch (1723:17): [True: 194, False: 0]
  ------------------
 1724|    194|                use_crypt = 1;
 1725|    194|        } else if (zip->open_mode & MZ_OPEN_MODE_READ) {
  ------------------
  |  |   50|      0|#define MZ_OPEN_MODE_READ      (0x01)
  ------------------
  |  Branch (1725:20): [True: 0, False: 0]
  ------------------
 1726|       |            /* Decrypt only when password is supplied. Don't error when password */
 1727|       |            /* is not supplied as we may want to read the raw encrypted data. */
 1728|      0|            use_crypt = 1;
 1729|      0|        }
 1730|    194|    }
 1731|       |
 1732|    368|    if ((err == MZ_OK) && (use_crypt)) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1732:9): [True: 368, False: 0]
  |  Branch (1732:27): [True: 194, False: 174]
  ------------------
 1733|    194|#ifdef HAVE_WZAES
 1734|    194|        if (zip->file_info.aes_version) {
  ------------------
  |  Branch (1734:13): [True: 0, False: 194]
  ------------------
 1735|      0|            zip->crypt_stream = mz_stream_wzaes_create();
 1736|      0|            if (!zip->crypt_stream)
  ------------------
  |  Branch (1736:17): [True: 0, False: 0]
  ------------------
 1737|      0|                return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1738|      0|            mz_stream_wzaes_set_password(zip->crypt_stream, password);
 1739|      0|            mz_stream_wzaes_set_strength(zip->crypt_stream, zip->file_info.aes_strength);
 1740|      0|        } else
 1741|    194|#endif
 1742|    194|        {
 1743|    194|#ifdef HAVE_PKCRYPT
 1744|    194|            uint8_t verify1 = (uint8_t)((zip->file_info.pk_verify >> 8) & 0xff);
 1745|    194|            uint8_t verify2 = (uint8_t)((zip->file_info.pk_verify) & 0xff);
 1746|       |
 1747|    194|            zip->crypt_stream = mz_stream_pkcrypt_create();
 1748|    194|            if (!zip->crypt_stream)
  ------------------
  |  Branch (1748:17): [True: 0, False: 194]
  ------------------
 1749|      0|                return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1750|    194|            mz_stream_pkcrypt_set_password(zip->crypt_stream, password);
 1751|    194|            mz_stream_pkcrypt_set_verify(zip->crypt_stream, verify1, verify2, zip->file_info.version_needed);
 1752|    194|#endif
 1753|    194|        }
 1754|    194|    }
 1755|       |
 1756|    368|    if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1756:9): [True: 368, False: 0]
  ------------------
 1757|    368|        if (!zip->crypt_stream)
  ------------------
  |  Branch (1757:13): [True: 174, False: 194]
  ------------------
 1758|    174|            zip->crypt_stream = mz_stream_raw_create();
 1759|    368|        if (!zip->crypt_stream)
  ------------------
  |  Branch (1759:13): [True: 0, False: 368]
  ------------------
 1760|      0|            return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1761|       |
 1762|    368|        mz_stream_set_base(zip->crypt_stream, zip->stream);
 1763|       |
 1764|    368|        err = mz_stream_open(zip->crypt_stream, NULL, zip->open_mode);
 1765|    368|    }
 1766|       |
 1767|    368|    if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1767:9): [True: 368, False: 0]
  ------------------
 1768|    368|        if (zip->entry_raw || zip->file_info.compression_method == MZ_COMPRESS_METHOD_STORE)
  ------------------
  |  |   63|    368|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (1768:13): [True: 0, False: 368]
  |  Branch (1768:31): [True: 368, False: 0]
  ------------------
 1769|    368|            zip->compress_stream = mz_stream_raw_create();
 1770|       |#ifdef HAVE_ZLIB
 1771|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE)
 1772|       |            zip->compress_stream = mz_stream_zlib_create();
 1773|       |#endif
 1774|       |#ifdef HAVE_BZIP2
 1775|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_BZIP2)
 1776|       |            zip->compress_stream = mz_stream_bzip_create();
 1777|       |#endif
 1778|       |#ifdef HAVE_LIBCOMP
 1779|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE ||
 1780|       |                 zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) {
 1781|       |            zip->compress_stream = mz_stream_libcomp_create();
 1782|       |            if (zip->compress_stream) {
 1783|       |                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD,
 1784|       |                                         zip->file_info.compression_method);
 1785|       |            }
 1786|       |        }
 1787|       |#endif
 1788|       |#ifdef HAVE_LZMA
 1789|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_LZMA ||
 1790|       |                 zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) {
 1791|       |            zip->compress_stream = mz_stream_lzma_create();
 1792|       |            if (zip->compress_stream) {
 1793|       |                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD,
 1794|       |                                         zip->file_info.compression_method);
 1795|       |            }
 1796|       |        }
 1797|       |#endif
 1798|       |#ifdef HAVE_ZSTD
 1799|       |        else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_ZSTD)
 1800|       |            zip->compress_stream = mz_stream_zstd_create();
 1801|       |#endif
 1802|      0|        else
 1803|      0|            err = MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
 1804|    368|    }
 1805|       |
 1806|    368|    if (err == MZ_OK && !zip->compress_stream)
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1806:9): [True: 368, False: 0]
  |  Branch (1806:25): [True: 0, False: 368]
  ------------------
 1807|      0|        err = MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
 1808|       |
 1809|    368|    if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1809:9): [True: 368, False: 0]
  ------------------
 1810|    368|        if (zip->open_mode & MZ_OPEN_MODE_WRITE) {
  ------------------
  |  |   51|    368|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
  |  Branch (1810:13): [True: 368, False: 0]
  ------------------
 1811|    368|            mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_LEVEL, compress_level);
  ------------------
  |  |   28|    368|#define MZ_STREAM_PROP_COMPRESS_LEVEL  (9)
  ------------------
 1812|    368|        } else {
 1813|      0|            int32_t set_end_of_stream = 0;
 1814|       |
 1815|      0|#ifndef HAVE_LIBCOMP
 1816|      0|            if (zip->entry_raw || zip->file_info.compression_method == MZ_COMPRESS_METHOD_STORE ||
  ------------------
  |  |   63|      0|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
  |  Branch (1816:17): [True: 0, False: 0]
  |  Branch (1816:35): [True: 0, False: 0]
  ------------------
 1817|      0|                zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED)
  ------------------
  |  |   77|      0|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (1817:17): [True: 0, False: 0]
  ------------------
 1818|      0|#endif
 1819|      0|            {
 1820|      0|                max_total_in = zip->file_info.compressed_size;
 1821|      0|                mz_stream_set_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in);
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX    (2)
  ------------------
 1822|       |
 1823|      0|                if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_HEADER_SIZE, &header_size) == MZ_OK)
  ------------------
  |  |   24|      0|#define MZ_STREAM_PROP_HEADER_SIZE     (5)
  ------------------
                              if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_HEADER_SIZE, &header_size) == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1823:21): [True: 0, False: 0]
  ------------------
 1824|      0|                    max_total_in -= header_size;
 1825|      0|                if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_FOOTER_SIZE, &footer_size) == MZ_OK)
  ------------------
  |  |   25|      0|#define MZ_STREAM_PROP_FOOTER_SIZE     (6)
  ------------------
                              if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_FOOTER_SIZE, &footer_size) == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1825:21): [True: 0, False: 0]
  ------------------
 1826|      0|                    max_total_in -= footer_size;
 1827|       |
 1828|      0|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in);
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX    (2)
  ------------------
 1829|      0|            }
 1830|       |
 1831|      0|            switch (zip->file_info.compression_method) {
  ------------------
  |  Branch (1831:21): [True: 0, False: 0]
  ------------------
 1832|      0|            case MZ_COMPRESS_METHOD_LZMA:
  ------------------
  |  |   66|      0|#define MZ_COMPRESS_METHOD_LZMA    (14)
  ------------------
  |  Branch (1832:13): [True: 0, False: 0]
  ------------------
 1833|      0|            case MZ_COMPRESS_METHOD_XZ:
  ------------------
  |  |   68|      0|#define MZ_COMPRESS_METHOD_XZ      (95)
  ------------------
  |  Branch (1833:13): [True: 0, False: 0]
  ------------------
 1834|      0|                set_end_of_stream = (zip->file_info.flag & MZ_ZIP_FLAG_LZMA_EOS_MARKER);
  ------------------
  |  |   78|      0|#define MZ_ZIP_FLAG_LZMA_EOS_MARKER    (1 << 1)
  ------------------
 1835|      0|                break;
 1836|      0|            case MZ_COMPRESS_METHOD_ZSTD:
  ------------------
  |  |   67|      0|#define MZ_COMPRESS_METHOD_ZSTD    (93)
  ------------------
  |  Branch (1836:13): [True: 0, False: 0]
  ------------------
 1837|      0|                set_end_of_stream = 1;
 1838|      0|                break;
 1839|      0|            }
 1840|       |
 1841|      0|            if (set_end_of_stream) {
  ------------------
  |  Branch (1841:17): [True: 0, False: 0]
  ------------------
 1842|      0|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX,
  ------------------
  |  |   21|      0|#define MZ_STREAM_PROP_TOTAL_IN_MAX    (2)
  ------------------
 1843|      0|                                         zip->file_info.compressed_size);
 1844|      0|                mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_OUT_MAX,
  ------------------
  |  |   23|      0|#define MZ_STREAM_PROP_TOTAL_OUT_MAX   (4)
  ------------------
 1845|      0|                                         zip->file_info.uncompressed_size);
 1846|      0|            }
 1847|      0|        }
 1848|       |
 1849|    368|        mz_stream_set_base(zip->compress_stream, zip->crypt_stream);
 1850|       |
 1851|    368|        err = mz_stream_open(zip->compress_stream, NULL, zip->open_mode);
 1852|    368|    }
 1853|       |
 1854|    368|    if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (1854:9): [True: 368, False: 0]
  ------------------
 1855|    368|        zip->entry_opened = 1;
 1856|    368|        zip->entry_crc32 = 0;
 1857|    368|    } else {
 1858|      0|        mz_zip_entry_close_int(handle);
 1859|      0|    }
 1860|       |
 1861|    368|    return err;
 1862|    368|}
mz_zip.c:mz_zip_get_pk_verify:
  191|    195|static uint16_t mz_zip_get_pk_verify(uint32_t dos_date, uint64_t crc, uint16_t flag) {
  192|       |    /* Info-ZIP modification to ZipCrypto format: if bit 3 of the general
  193|       |     * purpose bit flag is set, it uses high byte of 16-bit File Time. */
  194|    195|    if (flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)
  ------------------
  |  |   83|    195|#define MZ_ZIP_FLAG_DATA_DESCRIPTOR    (1 << 3)
  ------------------
  |  Branch (194:9): [True: 195, False: 0]
  ------------------
  195|    195|        return ((dos_date >> 16) & 0xff) << 8 | ((dos_date >> 8) & 0xff);
  196|      0|    return ((crc >> 16) & 0xff) << 8 | ((crc >> 24) & 0xff);
  197|    195|}
mz_zip.c:mz_zip_entry_write_header:
  593|    736|static int32_t mz_zip_entry_write_header(void *stream, uint8_t local, mz_zip_file *file_info) {
  594|    736|    uint64_t ntfs_time = 0;
  595|    736|    uint32_t reserved = 0;
  596|    736|    uint32_t dos_date = 0;
  597|    736|    uint16_t extrafield_size = 0;
  598|    736|    uint16_t field_type = 0;
  599|    736|    uint16_t field_length = 0;
  600|    736|    uint16_t field_length_zip64 = 0;
  601|    736|    uint16_t field_length_ntfs = 0;
  602|    736|    uint16_t field_length_aes = 0;
  603|    736|    uint16_t field_length_unix1 = 0;
  604|    736|    uint16_t filename_size = 0;
  605|    736|    uint16_t filename_length = 0;
  606|    736|    uint16_t linkname_size = 0;
  607|    736|    uint16_t version_needed = 0;
  608|    736|    int32_t comment_size = 0;
  609|    736|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  610|    736|    int32_t err_mem = MZ_OK;
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  611|    736|    uint8_t zip64 = 0;
  612|    736|    uint8_t skip_aes = 0;
  613|    736|    uint8_t mask = 0;
  614|    736|    uint8_t write_end_slash = 0;
  615|    736|    const char *filename = NULL;
  616|    736|    char masked_name[64];
  617|    736|    void *file_extra_stream = NULL;
  618|       |
  619|    736|    if (!file_info)
  ------------------
  |  Branch (619:9): [True: 0, False: 736]
  ------------------
  620|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  621|       |
  622|    736|    if ((local) && (file_info->flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO))
  ------------------
  |  |   85|    368|#define MZ_ZIP_FLAG_MASK_LOCAL_INFO    (1 << 13)
  ------------------
  |  Branch (622:9): [True: 368, False: 368]
  |  Branch (622:20): [True: 126, False: 242]
  ------------------
  623|    126|        mask = 1;
  624|       |
  625|       |    /* Determine if zip64 extra field is necessary */
  626|    736|    err = mz_zip_entry_needs_zip64(file_info, local, &zip64);
  627|    736|    if (err != MZ_OK)
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (627:9): [True: 0, False: 736]
  ------------------
  628|      0|        return err;
  629|       |
  630|       |    /* Start calculating extra field sizes */
  631|    736|    if (zip64) {
  ------------------
  |  Branch (631:9): [True: 367, False: 369]
  ------------------
  632|       |        /* Both compressed and uncompressed sizes must be included (at least in local header) */
  633|    367|        field_length_zip64 = 8 + 8;
  634|    367|        if ((!local) && (file_info->disk_offset >= UINT32_MAX))
  ------------------
  |  Branch (634:13): [True: 37, False: 330]
  |  Branch (634:25): [True: 0, False: 37]
  ------------------
  635|      0|            field_length_zip64 += 8;
  636|       |
  637|    367|        extrafield_size += 4;
  638|    367|        extrafield_size += field_length_zip64;
  639|    367|    }
  640|       |
  641|       |    /* Calculate extra field size and check for duplicates */
  642|    736|    if (file_info->extrafield_size > 0) {
  ------------------
  |  Branch (642:9): [True: 0, False: 736]
  ------------------
  643|      0|        file_extra_stream = mz_stream_mem_create();
  644|      0|        if (!file_extra_stream)
  ------------------
  |  Branch (644:13): [True: 0, False: 0]
  ------------------
  645|      0|            return MZ_MEM_ERROR;
  ------------------
  |  |   24|      0|#define MZ_MEM_ERROR      (-4) /* zlib */
  ------------------
  646|      0|        mz_stream_mem_set_buffer(file_extra_stream, (void *)file_info->extrafield, file_info->extrafield_size);
  647|       |
  648|      0|        do {
  649|      0|            err_mem = mz_stream_read_uint16(file_extra_stream, &field_type);
  650|      0|            if (err_mem == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (650:17): [True: 0, False: 0]
  ------------------
  651|      0|                err_mem = mz_stream_read_uint16(file_extra_stream, &field_length);
  652|      0|            if (err_mem != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (652:17): [True: 0, False: 0]
  ------------------
  653|      0|                break;
  654|       |
  655|       |            /* Prefer incoming aes extensions over ours */
  656|      0|            if (field_type == MZ_ZIP_EXTENSION_AES)
  ------------------
  |  |   90|      0|#define MZ_ZIP_EXTENSION_AES   (0x9901)
  ------------------
  |  Branch (656:17): [True: 0, False: 0]
  ------------------
  657|      0|                skip_aes = 1;
  658|       |
  659|       |            /* Prefer our zip64, ntfs, unix1 extension over incoming */
  660|      0|            if (field_type != MZ_ZIP_EXTENSION_ZIP64 && field_type != MZ_ZIP_EXTENSION_NTFS &&
  ------------------
  |  |   88|      0|#define MZ_ZIP_EXTENSION_ZIP64 (0x0001)
  ------------------
                          if (field_type != MZ_ZIP_EXTENSION_ZIP64 && field_type != MZ_ZIP_EXTENSION_NTFS &&
  ------------------
  |  |   89|      0|#define MZ_ZIP_EXTENSION_NTFS  (0x000a)
  ------------------
  |  Branch (660:17): [True: 0, False: 0]
  |  Branch (660:57): [True: 0, False: 0]
  ------------------
  661|      0|                field_type != MZ_ZIP_EXTENSION_UNIX1)
  ------------------
  |  |   91|      0|#define MZ_ZIP_EXTENSION_UNIX1 (0x000d)
  ------------------
  |  Branch (661:17): [True: 0, False: 0]
  ------------------
  662|      0|                extrafield_size += 4 + field_length;
  663|       |
  664|      0|            if (err_mem == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                err_mem = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR);
  ------------------
  |  |   59|      0|#define MZ_SEEK_CUR (1)
  ------------------
  666|      0|        } while (err_mem == MZ_OK);
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (666:18): [True: 0, False: 0]
  ------------------
  667|      0|    }
  668|       |
  669|    736|#ifdef HAVE_WZAES
  670|    736|    if (!skip_aes) {
  ------------------
  |  Branch (670:9): [True: 736, False: 0]
  ------------------
  671|    736|        if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) {
  ------------------
  |  |   77|    736|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (671:13): [True: 388, False: 348]
  |  Branch (671:58): [True: 0, False: 388]
  ------------------
  672|      0|            field_length_aes = 1 + 1 + 1 + 2 + 2;
  673|      0|            extrafield_size += 4 + field_length_aes;
  674|      0|        }
  675|    736|    }
  676|       |#else
  677|       |    MZ_UNUSED(field_length_aes);
  678|       |    MZ_UNUSED(skip_aes);
  679|       |#endif
  680|       |    /* NTFS timestamps */
  681|    736|    if ((file_info->modified_date != 0) && (file_info->accessed_date != 0) && (file_info->creation_date != 0) &&
  ------------------
  |  Branch (681:9): [True: 0, False: 736]
  |  Branch (681:44): [True: 0, False: 0]
  |  Branch (681:79): [True: 0, False: 0]
  ------------------
  682|    736|        (!mask)) {
  ------------------
  |  Branch (682:9): [True: 0, False: 0]
  ------------------
  683|      0|        field_length_ntfs = 8 + 8 + 8 + 4 + 2 + 2;
  684|      0|        extrafield_size += 4 + field_length_ntfs;
  685|      0|    }
  686|       |
  687|       |    /* Unix1 symbolic links */
  688|    736|    if (file_info->linkname && *file_info->linkname != 0) {
  ------------------
  |  Branch (688:9): [True: 736, False: 0]
  |  Branch (688:32): [True: 0, False: 736]
  ------------------
  689|      0|        linkname_size = (uint16_t)strlen(file_info->linkname);
  690|      0|        field_length_unix1 = 12 + linkname_size;
  691|      0|        extrafield_size += 4 + field_length_unix1;
  692|      0|    }
  693|       |
  694|    736|    if (local)
  ------------------
  |  Branch (694:9): [True: 368, False: 368]
  ------------------
  695|    368|        err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_LOCALHEADER);
  ------------------
  |  |   58|    368|#define MZ_ZIP_MAGIC_LOCALHEADER        (0x04034b50)
  ------------------
  696|    368|    else {
  697|    368|        err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_CENTRALHEADER);
  ------------------
  |  |   60|    368|#define MZ_ZIP_MAGIC_CENTRALHEADER      (0x02014b50)
  ------------------
  698|    368|        if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (698:13): [True: 368, False: 0]
  ------------------
  699|    368|            err = mz_stream_write_uint16(stream, file_info->version_madeby);
  700|    368|    }
  701|       |
  702|       |    /* Calculate version needed to extract */
  703|    736|    if (err == MZ_OK) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (703:9): [True: 736, False: 0]
  ------------------
  704|    736|        version_needed = file_info->version_needed;
  705|    736|        if (version_needed == 0) {
  ------------------
  |  Branch (705:13): [True: 736, False: 0]
  ------------------
  706|    736|            version_needed = 20;
  707|    736|            if (zip64)
  ------------------
  |  Branch (707:17): [True: 367, False: 369]
  ------------------
  708|    367|                version_needed = 45;
  709|       |#ifdef HAVE_BZIP2
  710|       |            if (file_info->compression_method == MZ_COMPRESS_METHOD_BZIP2)
  711|       |                version_needed = 46;
  712|       |#endif
  713|    736|#ifdef HAVE_WZAES
  714|    736|            if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version))
  ------------------
  |  |   77|    736|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (714:17): [True: 388, False: 348]
  |  Branch (714:62): [True: 0, False: 388]
  ------------------
  715|      0|                version_needed = 51;
  716|    736|#endif
  717|       |#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP)
  718|       |            if ((file_info->compression_method == MZ_COMPRESS_METHOD_LZMA) ||
  719|       |                (file_info->compression_method == MZ_COMPRESS_METHOD_XZ))
  720|       |                version_needed = 63;
  721|       |#endif
  722|    736|        }
  723|    736|        err = mz_stream_write_uint16(stream, version_needed);
  724|    736|    }
  725|    736|    if (err == MZ_OK)
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (725:9): [True: 736, False: 0]
  ------------------
  726|    736|        err = mz_stream_write_uint16(stream, file_info->flag);
  727|    736|    if (err == MZ_OK) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (727:9): [True: 736, False: 0]
  ------------------
  728|    736|#ifdef HAVE_WZAES
  729|    736|        if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version))
  ------------------
  |  |   77|    736|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (729:13): [True: 388, False: 348]
  |  Branch (729:58): [True: 0, False: 388]
  ------------------
  730|      0|            err = mz_stream_write_uint16(stream, MZ_COMPRESS_METHOD_AES);
  ------------------
  |  |   69|      0|#define MZ_COMPRESS_METHOD_AES     (99)
  ------------------
  731|    736|        else
  732|    736|#endif
  733|    736|            err = mz_stream_write_uint16(stream, file_info->compression_method);
  734|    736|    }
  735|    736|    if (err == MZ_OK) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (735:9): [True: 736, False: 0]
  ------------------
  736|    736|        if (file_info->modified_date != 0 && !mask)
  ------------------
  |  Branch (736:13): [True: 0, False: 736]
  |  Branch (736:46): [True: 0, False: 0]
  ------------------
  737|      0|            dos_date = mz_zip_time_t_to_dos_date(file_info->modified_date);
  738|    736|        err = mz_stream_write_uint32(stream, dos_date);
  739|    736|    }
  740|       |
  741|    736|    if (err == MZ_OK)
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (741:9): [True: 736, False: 0]
  ------------------
  742|    736|        err = mz_zip_entry_write_crc_sizes(stream, zip64, mask, file_info);
  743|       |
  744|    736|    if (mask) {
  ------------------
  |  Branch (744:9): [True: 126, False: 610]
  ------------------
  745|    126|        snprintf(masked_name, sizeof(masked_name), "%" PRIx32 "_%" PRIx64, file_info->disk_number,
  746|    126|                 file_info->disk_offset);
  747|    126|        filename = masked_name;
  748|    610|    } else {
  749|    610|        filename = file_info->filename;
  750|    610|    }
  751|       |
  752|    736|    filename_length = (uint16_t)strlen(filename);
  753|    736|    filename_size += filename_length;
  754|       |
  755|    736|    if ((mz_zip_attrib_is_dir(file_info->external_fa, file_info->version_madeby) == MZ_OK) &&
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (755:9): [True: 0, False: 736]
  ------------------
  756|    736|        ((filename[filename_length - 1] != '/') && (filename[filename_length - 1] != '\\'))) {
  ------------------
  |  Branch (756:10): [True: 0, False: 0]
  |  Branch (756:52): [True: 0, False: 0]
  ------------------
  757|      0|        filename_size += 1;
  758|      0|        write_end_slash = 1;
  759|      0|    }
  760|       |
  761|    736|    if (err == MZ_OK)
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (761:9): [True: 736, False: 0]
  ------------------
  762|    736|        err = mz_stream_write_uint16(stream, filename_size);
  763|    736|    if (err == MZ_OK)
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (763:9): [True: 736, False: 0]
  ------------------
  764|    736|        err = mz_stream_write_uint16(stream, extrafield_size);
  765|       |
  766|    736|    if (!local) {
  ------------------
  |  Branch (766:9): [True: 368, False: 368]
  ------------------
  767|    368|        if (file_info->comment) {
  ------------------
  |  Branch (767:13): [True: 368, False: 0]
  ------------------
  768|    368|            comment_size = (int32_t)strlen(file_info->comment);
  769|    368|            if (comment_size > UINT16_MAX)
  ------------------
  |  Branch (769:17): [True: 0, False: 368]
  ------------------
  770|      0|                comment_size = UINT16_MAX;
  771|    368|        }
  772|    368|        if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (772:13): [True: 368, False: 0]
  ------------------
  773|    368|            err = mz_stream_write_uint16(stream, (uint16_t)comment_size);
  774|    368|        if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (774:13): [True: 368, False: 0]
  ------------------
  775|    368|            err = mz_stream_write_uint16(stream, (uint16_t)file_info->disk_number);
  776|    368|        if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (776:13): [True: 368, False: 0]
  ------------------
  777|    368|            err = mz_stream_write_uint16(stream, file_info->internal_fa);
  778|    368|        if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (778:13): [True: 368, False: 0]
  ------------------
  779|    368|            err = mz_stream_write_uint32(stream, file_info->external_fa);
  780|    368|        if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (780:13): [True: 368, False: 0]
  ------------------
  781|    368|            if (file_info->disk_offset >= UINT32_MAX)
  ------------------
  |  Branch (781:17): [True: 0, False: 368]
  ------------------
  782|      0|                err = mz_stream_write_uint32(stream, UINT32_MAX);
  783|    368|            else
  784|    368|                err = mz_stream_write_uint32(stream, (uint32_t)file_info->disk_offset);
  785|    368|        }
  786|    368|    }
  787|       |
  788|    736|    if (err == MZ_OK) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (788:9): [True: 736, False: 0]
  ------------------
  789|    736|        const char *next = filename;
  790|    736|        int32_t left = filename_length;
  791|       |#if defined(_WIN32)
  792|       |        const char *backslash = NULL;
  793|       |
  794|       |        /* Ensure all slashes are written as forward slashes according to 4.4.17.1 */
  795|       |        while ((err == MZ_OK) && (backslash = strchr(next, '\\'))) {
  796|       |            int32_t part_length = (int32_t)(backslash - next);
  797|       |
  798|       |            if (mz_stream_write(stream, next, part_length) != part_length || mz_stream_write(stream, "/", 1) != 1)
  799|       |                err = MZ_WRITE_ERROR;
  800|       |
  801|       |            left -= part_length + 1;
  802|       |            next = backslash + 1;
  803|       |        }
  804|       |#endif
  805|    736|        if (err == MZ_OK && left > 0) {
  ------------------
  |  |   21|  1.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (805:13): [True: 736, False: 0]
  |  Branch (805:29): [True: 736, False: 0]
  ------------------
  806|    736|            if (mz_stream_write(stream, next, left) != left)
  ------------------
  |  Branch (806:17): [True: 0, False: 736]
  ------------------
  807|      0|                err = MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  808|    736|        }
  809|       |
  810|       |        /* Ensure that directories have a slash appended to them for compatibility */
  811|    736|        if (err == MZ_OK && write_end_slash)
  ------------------
  |  |   21|  1.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (811:13): [True: 736, False: 0]
  |  Branch (811:29): [True: 0, False: 736]
  ------------------
  812|      0|            err = mz_stream_write_uint8(stream, '/');
  813|    736|    }
  814|       |
  815|       |    /* Write ZIP64 extra field first so we can update sizes later if data descriptor not used */
  816|    736|    if ((err == MZ_OK) && (zip64)) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (816:9): [True: 736, False: 0]
  |  Branch (816:27): [True: 367, False: 369]
  ------------------
  817|    367|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_ZIP64, field_length_zip64);
  ------------------
  |  |   88|    367|#define MZ_ZIP_EXTENSION_ZIP64 (0x0001)
  ------------------
  818|    367|        if (err == MZ_OK) {
  ------------------
  |  |   21|    367|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (818:13): [True: 367, False: 0]
  ------------------
  819|    367|            if (mask)
  ------------------
  |  Branch (819:17): [True: 126, False: 241]
  ------------------
  820|    126|                err = mz_stream_write_int64(stream, 0);
  821|    241|            else
  822|    241|                err = mz_stream_write_int64(stream, file_info->uncompressed_size);
  823|    367|        }
  824|    367|        if (err == MZ_OK)
  ------------------
  |  |   21|    367|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (824:13): [True: 367, False: 0]
  ------------------
  825|    367|            err = mz_stream_write_int64(stream, file_info->compressed_size);
  826|    367|        if ((err == MZ_OK) && (!local) && (file_info->disk_offset >= UINT32_MAX))
  ------------------
  |  |   21|    367|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (826:13): [True: 367, False: 0]
  |  Branch (826:31): [True: 37, False: 330]
  |  Branch (826:43): [True: 0, False: 37]
  ------------------
  827|      0|            err = mz_stream_write_int64(stream, file_info->disk_offset);
  828|    367|        if ((err == MZ_OK) && (!local) && (file_info->disk_number >= UINT16_MAX))
  ------------------
  |  |   21|    367|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (828:13): [True: 367, False: 0]
  |  Branch (828:31): [True: 37, False: 330]
  |  Branch (828:43): [True: 0, False: 37]
  ------------------
  829|      0|            err = mz_stream_write_uint32(stream, file_info->disk_number);
  830|    367|    }
  831|       |    /* Write NTFS extra field */
  832|    736|    if ((err == MZ_OK) && (field_length_ntfs > 0)) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (832:9): [True: 736, False: 0]
  |  Branch (832:27): [True: 0, False: 736]
  ------------------
  833|      0|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_NTFS, field_length_ntfs);
  ------------------
  |  |   89|      0|#define MZ_ZIP_EXTENSION_NTFS  (0x000a)
  ------------------
  834|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (834:13): [True: 0, False: 0]
  ------------------
  835|      0|            err = mz_stream_write_uint32(stream, reserved);
  836|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (836:13): [True: 0, False: 0]
  ------------------
  837|      0|            err = mz_stream_write_uint16(stream, 0x01);
  838|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (838:13): [True: 0, False: 0]
  ------------------
  839|      0|            err = mz_stream_write_uint16(stream, field_length_ntfs - 8);
  840|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (840:13): [True: 0, False: 0]
  ------------------
  841|      0|            mz_zip_unix_to_ntfs_time(file_info->modified_date, &ntfs_time);
  842|      0|            err = mz_stream_write_uint64(stream, ntfs_time);
  843|      0|        }
  844|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (844:13): [True: 0, False: 0]
  ------------------
  845|      0|            mz_zip_unix_to_ntfs_time(file_info->accessed_date, &ntfs_time);
  846|      0|            err = mz_stream_write_uint64(stream, ntfs_time);
  847|      0|        }
  848|      0|        if (err == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (848:13): [True: 0, False: 0]
  ------------------
  849|      0|            mz_zip_unix_to_ntfs_time(file_info->creation_date, &ntfs_time);
  850|      0|            err = mz_stream_write_uint64(stream, ntfs_time);
  851|      0|        }
  852|      0|    }
  853|       |    /* Write UNIX extra block extra field */
  854|    736|    if ((err == MZ_OK) && (field_length_unix1 > 0)) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (854:9): [True: 736, False: 0]
  |  Branch (854:27): [True: 0, False: 736]
  ------------------
  855|      0|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_UNIX1, field_length_unix1);
  ------------------
  |  |   91|      0|#define MZ_ZIP_EXTENSION_UNIX1 (0x000d)
  ------------------
  856|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (856:13): [True: 0, False: 0]
  ------------------
  857|      0|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->accessed_date);
  858|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (858:13): [True: 0, False: 0]
  ------------------
  859|      0|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->modified_date);
  860|      0|        if (err == MZ_OK) /* User id */
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (860:13): [True: 0, False: 0]
  ------------------
  861|      0|            err = mz_stream_write_uint16(stream, 0);
  862|      0|        if (err == MZ_OK) /* Group id */
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (862:13): [True: 0, False: 0]
  ------------------
  863|      0|            err = mz_stream_write_uint16(stream, 0);
  864|      0|        if (err == MZ_OK && linkname_size > 0) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (864:13): [True: 0, False: 0]
  |  Branch (864:29): [True: 0, False: 0]
  ------------------
  865|      0|            if (mz_stream_write(stream, file_info->linkname, linkname_size) != linkname_size)
  ------------------
  |  Branch (865:17): [True: 0, False: 0]
  ------------------
  866|      0|                err = MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  867|      0|        }
  868|      0|    }
  869|    736|#ifdef HAVE_WZAES
  870|       |    /* Write AES extra field */
  871|    736|    if ((err == MZ_OK) && (!skip_aes) && (file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
                  if ((err == MZ_OK) && (!skip_aes) && (file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) {
  ------------------
  |  |   77|    736|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
  |  Branch (871:9): [True: 736, False: 0]
  |  Branch (871:27): [True: 736, False: 0]
  |  Branch (871:42): [True: 388, False: 348]
  |  Branch (871:87): [True: 0, False: 388]
  ------------------
  872|      0|        err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_AES, field_length_aes);
  ------------------
  |  |   90|      0|#define MZ_ZIP_EXTENSION_AES   (0x9901)
  ------------------
  873|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (873:13): [True: 0, False: 0]
  ------------------
  874|      0|            err = mz_stream_write_uint16(stream, file_info->aes_version);
  875|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (875:13): [True: 0, False: 0]
  ------------------
  876|      0|            err = mz_stream_write_uint8(stream, 'A');
  877|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (877:13): [True: 0, False: 0]
  ------------------
  878|      0|            err = mz_stream_write_uint8(stream, 'E');
  879|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (879:13): [True: 0, False: 0]
  ------------------
  880|      0|            err = mz_stream_write_uint8(stream, file_info->aes_strength);
  881|      0|        if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (881:13): [True: 0, False: 0]
  ------------------
  882|      0|            err = mz_stream_write_uint16(stream, file_info->compression_method);
  883|      0|    }
  884|    736|#endif
  885|       |
  886|    736|    if (file_info->extrafield_size > 0) {
  ------------------
  |  Branch (886:9): [True: 0, False: 736]
  ------------------
  887|      0|        err_mem = mz_stream_mem_seek(file_extra_stream, 0, MZ_SEEK_SET);
  ------------------
  |  |   58|      0|#define MZ_SEEK_SET (0)
  ------------------
  888|      0|        while (err == MZ_OK && err_mem == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
                      while (err == MZ_OK && err_mem == MZ_OK) {
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (888:16): [True: 0, False: 0]
  |  Branch (888:32): [True: 0, False: 0]
  ------------------
  889|      0|            err_mem = mz_stream_read_uint16(file_extra_stream, &field_type);
  890|      0|            if (err_mem == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (890:17): [True: 0, False: 0]
  ------------------
  891|      0|                err_mem = mz_stream_read_uint16(file_extra_stream, &field_length);
  892|      0|            if (err_mem != MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (892:17): [True: 0, False: 0]
  ------------------
  893|      0|                break;
  894|       |
  895|       |            /* Prefer our zip 64, ntfs, unix1 extensions over incoming */
  896|      0|            if (field_type == MZ_ZIP_EXTENSION_ZIP64 || field_type == MZ_ZIP_EXTENSION_NTFS ||
  ------------------
  |  |   88|      0|#define MZ_ZIP_EXTENSION_ZIP64 (0x0001)
  ------------------
                          if (field_type == MZ_ZIP_EXTENSION_ZIP64 || field_type == MZ_ZIP_EXTENSION_NTFS ||
  ------------------
  |  |   89|      0|#define MZ_ZIP_EXTENSION_NTFS  (0x000a)
  ------------------
  |  Branch (896:17): [True: 0, False: 0]
  |  Branch (896:57): [True: 0, False: 0]
  ------------------
  897|      0|                field_type == MZ_ZIP_EXTENSION_UNIX1) {
  ------------------
  |  |   91|      0|#define MZ_ZIP_EXTENSION_UNIX1 (0x000d)
  ------------------
  |  Branch (897:17): [True: 0, False: 0]
  ------------------
  898|      0|                err_mem = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR);
  ------------------
  |  |   59|      0|#define MZ_SEEK_CUR (1)
  ------------------
  899|      0|                continue;
  900|      0|            }
  901|       |
  902|      0|            err = mz_stream_write_uint16(stream, field_type);
  903|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (903:17): [True: 0, False: 0]
  ------------------
  904|      0|                err = mz_stream_write_uint16(stream, field_length);
  905|      0|            if (err == MZ_OK)
  ------------------
  |  |   21|      0|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (905:17): [True: 0, False: 0]
  ------------------
  906|      0|                err = mz_stream_copy(stream, file_extra_stream, field_length);
  907|      0|        }
  908|       |
  909|      0|        mz_stream_mem_delete(&file_extra_stream);
  910|      0|    }
  911|       |
  912|    736|    if (err == MZ_OK && !local && file_info->comment) {
  ------------------
  |  |   21|  1.47k|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (912:9): [True: 736, False: 0]
  |  Branch (912:25): [True: 368, False: 368]
  |  Branch (912:35): [True: 368, False: 0]
  ------------------
  913|    368|        if (mz_stream_write(stream, file_info->comment, file_info->comment_size) != file_info->comment_size)
  ------------------
  |  Branch (913:13): [True: 0, False: 368]
  ------------------
  914|      0|            err = MZ_WRITE_ERROR;
  ------------------
  |  |   45|      0|#define MZ_WRITE_ERROR    (-116)
  ------------------
  915|    368|    }
  916|       |
  917|    736|    return err;
  918|    736|}
mz_zip.c:mz_zip_entry_close_int:
 1666|    368|static int32_t mz_zip_entry_close_int(void *handle) {
 1667|    368|    mz_zip *zip = (mz_zip *)handle;
 1668|       |
 1669|    368|    if (zip->crypt_stream)
  ------------------
  |  Branch (1669:9): [True: 368, False: 0]
  ------------------
 1670|    368|        mz_stream_delete(&zip->crypt_stream);
 1671|    368|    zip->crypt_stream = NULL;
 1672|    368|    if (zip->compress_stream)
  ------------------
  |  Branch (1672:9): [True: 368, False: 0]
  ------------------
 1673|    368|        mz_stream_delete(&zip->compress_stream);
 1674|    368|    zip->compress_stream = NULL;
 1675|       |
 1676|    368|    zip->entry_opened = 0;
 1677|       |
 1678|    368|    return MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
 1679|    368|}
mz_zip.c:mz_zip_entry_needs_zip64:
  550|  1.10k|static int32_t mz_zip_entry_needs_zip64(mz_zip_file *file_info, uint8_t local, uint8_t *zip64) {
  551|  1.10k|    uint32_t max_uncompressed_size = UINT32_MAX;
  552|  1.10k|    uint8_t needs_zip64 = 0;
  553|       |
  554|  1.10k|    if (!zip64)
  ------------------
  |  Branch (554:9): [True: 0, False: 1.10k]
  ------------------
  555|      0|        return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  556|       |
  557|  1.10k|    *zip64 = 0;
  558|       |
  559|  1.10k|    if (local) {
  ------------------
  |  Branch (559:9): [True: 736, False: 368]
  ------------------
  560|       |        /* At local header we might not know yet whether compressed size will overflow unsigned
  561|       |           32-bit integer which might happen for high entropy data so we give it some cushion */
  562|       |
  563|    736|        max_uncompressed_size -= MZ_ZIP_UNCOMPR_SIZE64_CUSHION;
  ------------------
  |  |   75|    736|#define MZ_ZIP_UNCOMPR_SIZE64_CUSHION   (2 * 1024 * 1024)
  ------------------
  564|    736|    }
  565|       |
  566|  1.10k|    needs_zip64 = (file_info->uncompressed_size >= max_uncompressed_size) || (file_info->compressed_size >= UINT32_MAX);
  ------------------
  |  Branch (566:19): [True: 0, False: 1.10k]
  |  Branch (566:78): [True: 0, False: 1.10k]
  ------------------
  567|       |
  568|  1.10k|    if (!local) {
  ------------------
  |  Branch (568:9): [True: 368, False: 736]
  ------------------
  569|       |        /* Disk offset and number only used in central directory header */
  570|    368|        needs_zip64 |= (file_info->disk_offset >= UINT32_MAX) || (file_info->disk_number >= UINT16_MAX);
  ------------------
  |  Branch (570:24): [True: 0, False: 368]
  |  Branch (570:66): [True: 0, False: 368]
  ------------------
  571|    368|    }
  572|       |
  573|  1.10k|    if (file_info->zip64 == MZ_ZIP64_AUTO) {
  ------------------
  |  |   97|  1.10k|#define MZ_ZIP64_AUTO    (0)
  ------------------
  |  Branch (573:9): [True: 879, False: 225]
  ------------------
  574|       |        /* If uncompressed size is unknown, assume zip64 for 64-bit data descriptors */
  575|    879|        if (local && file_info->uncompressed_size == 0) {
  ------------------
  |  Branch (575:13): [True: 586, False: 293]
  |  Branch (575:22): [True: 586, False: 0]
  ------------------
  576|       |            /* Don't use zip64 for local header directory entries */
  577|    586|            if (mz_zip_attrib_is_dir(file_info->external_fa, file_info->version_madeby) != MZ_OK) {
  ------------------
  |  |   21|    586|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (577:17): [True: 586, False: 0]
  ------------------
  578|    586|                *zip64 = 1;
  579|    586|            }
  580|    586|        }
  581|    879|        *zip64 |= needs_zip64;
  582|    879|    } else if (file_info->zip64 == MZ_ZIP64_FORCE) {
  ------------------
  |  |   98|    225|#define MZ_ZIP64_FORCE   (1)
  ------------------
  |  Branch (582:16): [True: 111, False: 114]
  ------------------
  583|    111|        *zip64 = 1;
  584|    114|    } else if (file_info->zip64 == MZ_ZIP64_DISABLE) {
  ------------------
  |  |   99|    114|#define MZ_ZIP64_DISABLE (2)
  ------------------
  |  Branch (584:16): [True: 3, False: 111]
  ------------------
  585|       |        /* Zip64 extension is required to zip file */
  586|      3|        if (needs_zip64)
  ------------------
  |  Branch (586:13): [True: 0, False: 3]
  ------------------
  587|      0|            return MZ_PARAM_ERROR;
  ------------------
  |  |   31|      0|#define MZ_PARAM_ERROR    (-102)
  ------------------
  588|      3|    }
  589|       |
  590|  1.10k|    return MZ_OK;
  ------------------
  |  |   21|  1.10k|#define MZ_OK             (0)  /* zlib */
  ------------------
  591|  1.10k|}
mz_zip.c:mz_zip_entry_write_descriptor:
  921|    368|                                             int64_t uncompressed_size) {
  922|    368|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  923|       |
  924|    368|    err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_DATADESCRIPTOR);
  ------------------
  |  |   66|    368|#define MZ_ZIP_MAGIC_DATADESCRIPTOR     (0x08074b50)
  ------------------
  925|    368|    if (err == MZ_OK)
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (925:9): [True: 368, False: 0]
  ------------------
  926|    368|        err = mz_stream_write_uint32(stream, crc32);
  927|       |
  928|       |    /* Store data descriptor as 8 bytes if zip 64 extension enabled */
  929|    368|    if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (929:9): [True: 368, False: 0]
  ------------------
  930|       |        /* Zip 64 extension is enabled when uncompressed size is > UINT32_MAX */
  931|    368|        if (!zip64)
  ------------------
  |  Branch (931:13): [True: 38, False: 330]
  ------------------
  932|     38|            err = mz_stream_write_uint32(stream, (uint32_t)compressed_size);
  933|    330|        else
  934|    330|            err = mz_stream_write_int64(stream, compressed_size);
  935|    368|    }
  936|    368|    if (err == MZ_OK) {
  ------------------
  |  |   21|    368|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (936:9): [True: 368, False: 0]
  ------------------
  937|    368|        if (!zip64)
  ------------------
  |  Branch (937:13): [True: 38, False: 330]
  ------------------
  938|     38|            err = mz_stream_write_uint32(stream, (uint32_t)uncompressed_size);
  939|    330|        else
  940|    330|            err = mz_stream_write_int64(stream, uncompressed_size);
  941|    368|    }
  942|       |
  943|    368|    return err;
  944|    368|}
mz_zip.c:mz_zip_entry_write_crc_sizes:
  522|    736|static int32_t mz_zip_entry_write_crc_sizes(void *stream, uint8_t zip64, uint8_t mask, mz_zip_file *file_info) {
  523|    736|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  524|       |
  525|    736|    if (mask)
  ------------------
  |  Branch (525:9): [True: 126, False: 610]
  ------------------
  526|    126|        err = mz_stream_write_uint32(stream, 0);
  527|    610|    else
  528|    610|        err = mz_stream_write_uint32(stream, file_info->crc); /* crc */
  529|       |
  530|       |    /* For backwards-compatibility with older zip applications we set all sizes to UINT32_MAX
  531|       |     * when zip64 is needed, instead of only setting sizes larger than UINT32_MAX. */
  532|       |
  533|    736|    if (err == MZ_OK) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (533:9): [True: 736, False: 0]
  ------------------
  534|    736|        if (zip64) /* compr size */
  ------------------
  |  Branch (534:13): [True: 367, False: 369]
  ------------------
  535|    367|            err = mz_stream_write_uint32(stream, UINT32_MAX);
  536|    369|        else
  537|    369|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->compressed_size);
  538|    736|    }
  539|    736|    if (err == MZ_OK) {
  ------------------
  |  |   21|    736|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (539:9): [True: 736, False: 0]
  ------------------
  540|    736|        if (mask) /* uncompr size */
  ------------------
  |  Branch (540:13): [True: 126, False: 610]
  ------------------
  541|    126|            err = mz_stream_write_uint32(stream, 0);
  542|    610|        else if (zip64)
  ------------------
  |  Branch (542:18): [True: 241, False: 369]
  ------------------
  543|    241|            err = mz_stream_write_uint32(stream, UINT32_MAX);
  544|    369|        else
  545|    369|            err = mz_stream_write_uint32(stream, (uint32_t)file_info->uncompressed_size);
  546|    736|    }
  547|    736|    return err;
  548|    736|}
mz_zip.c:mz_zip_invalid_date:
 2652|    195|static int32_t mz_zip_invalid_date(const struct tm *ptm) {
 2653|    195|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
 2654|    195|    return (!datevalue_in_range(0, 127 + 80, ptm->tm_year) || /* 1980-based year, allow 80 extra */
  ------------------
  |  | 2653|    390|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2653:46): [True: 195, False: 0]
  |  |  |  Branch (2653:66): [True: 195, False: 0]
  |  |  ------------------
  ------------------
 2655|    195|            !datevalue_in_range(0, 11, ptm->tm_mon) || !datevalue_in_range(1, 31, ptm->tm_mday) ||
  ------------------
  |  | 2653|    390|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2653:46): [True: 195, False: 0]
  |  |  |  Branch (2653:66): [True: 195, False: 0]
  |  |  ------------------
  ------------------
                          !datevalue_in_range(0, 11, ptm->tm_mon) || !datevalue_in_range(1, 31, ptm->tm_mday) ||
  ------------------
  |  | 2653|    390|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2653:46): [True: 195, False: 0]
  |  |  |  Branch (2653:66): [True: 195, False: 0]
  |  |  ------------------
  ------------------
 2656|    195|            !datevalue_in_range(0, 23, ptm->tm_hour) || !datevalue_in_range(0, 59, ptm->tm_min) ||
  ------------------
  |  | 2653|    390|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2653:46): [True: 195, False: 0]
  |  |  |  Branch (2653:66): [True: 195, False: 0]
  |  |  ------------------
  ------------------
                          !datevalue_in_range(0, 23, ptm->tm_hour) || !datevalue_in_range(0, 59, ptm->tm_min) ||
  ------------------
  |  | 2653|    390|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2653:46): [True: 195, False: 0]
  |  |  |  Branch (2653:66): [True: 195, False: 0]
  |  |  ------------------
  ------------------
 2657|    195|            !datevalue_in_range(0, 59, ptm->tm_sec));
  ------------------
  |  | 2653|    195|#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
  |  |  ------------------
  |  |  |  Branch (2653:46): [True: 195, False: 0]
  |  |  |  Branch (2653:66): [True: 195, False: 0]
  |  |  ------------------
  ------------------
 2658|    195|#undef datevalue_in_range
 2659|    195|}

LLVMFuzzerTestOneInput:
   29|    460|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   30|    460|    mz_zip_file file_info;
   31|    460|    void *fuzz_stream = NULL;
   32|    460|    void *stream = NULL;
   33|    460|    void *handle = NULL;
   34|    460|    int32_t err = MZ_OK;
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
   35|    460|    uint16_t value16 = 0;
   36|    460|    uint8_t value8 = 0;
   37|    460|    int16_t compress_level = 0;
   38|    460|    int64_t fuzz_pos = 0;
   39|    460|    int32_t fuzz_length = 0;
   40|    460|    uint8_t *fuzz_buf = NULL;
   41|    460|    const char *password = NULL;
   42|       |
   43|    460|    fuzz_stream = mz_stream_mem_create();
   44|    460|    if (!fuzz_stream)
  ------------------
  |  Branch (44:9): [True: 0, False: 460]
  ------------------
   45|      0|        return 1;
   46|    460|    mz_stream_mem_set_buffer(fuzz_stream, (void *)data, (int32_t)size);
   47|       |
   48|    460|    memset(&file_info, 0, sizeof(file_info));
   49|       |
   50|    460|    file_info.flag = MZ_ZIP_FLAG_UTF8;
  ------------------
  |  |   84|    460|#define MZ_ZIP_FLAG_UTF8               (1 << 11)
  ------------------
   51|    460|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (51:9): [True: 460, False: 0]
  |  Branch (51:66): [True: 220, False: 240]
  ------------------
   52|    220|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|    220|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (52:13): [True: 215, False: 5]
  ------------------
   53|    215|            file_info.flag = value16;
   54|    220|    }
   55|    460|    file_info.compression_method = MZ_COMPRESS_METHOD_DEFLATE;
  ------------------
  |  |   64|    460|#define MZ_COMPRESS_METHOD_DEFLATE (8)
  ------------------
   56|    460|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (56:9): [True: 445, False: 15]
  |  Branch (56:66): [True: 345, False: 100]
  ------------------
   57|    345|        file_info.compression_method = MZ_COMPRESS_METHOD_STORE;
  ------------------
  |  |   63|    345|#define MZ_COMPRESS_METHOD_STORE   (0)
  ------------------
   58|    345|    } else if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|    115|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (58:16): [True: 94, False: 21]
  |  Branch (58:73): [True: 48, False: 46]
  ------------------
   59|     48|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|     48|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (59:13): [True: 45, False: 3]
  ------------------
   60|     45|            file_info.compression_method = value16;
   61|     48|    }
   62|       |
   63|    460|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (63:9): [True: 392, False: 68]
  |  Branch (63:66): [True: 112, False: 280]
  ------------------
   64|    112|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|    112|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (64:13): [True: 105, False: 7]
  ------------------
   65|    105|            file_info.zip64 = value16;
   66|    112|    }
   67|       |
   68|    460|    file_info.filename = MZ_FUZZ_TEST_FILENAME;
  ------------------
  |  |   24|    460|#define MZ_FUZZ_TEST_FILENAME "foo"
  ------------------
   69|    460|    file_info.filename_size = (uint16_t)strlen(MZ_FUZZ_TEST_FILENAME);
  ------------------
  |  |   24|    460|#define MZ_FUZZ_TEST_FILENAME "foo"
  ------------------
   70|       |
   71|    460|    compress_level = MZ_COMPRESS_LEVEL_DEFAULT;
  ------------------
  |  |   71|    460|#define MZ_COMPRESS_LEVEL_DEFAULT  (-1)
  ------------------
   72|    460|    if ((mz_stream_read_uint8(fuzz_stream, &value8) == MZ_OK) && (value8 < 0x08)) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (72:9): [True: 352, False: 108]
  |  Branch (72:66): [True: 91, False: 261]
  ------------------
   73|     91|        if (mz_stream_read_uint16(fuzz_stream, &value16) == MZ_OK)
  ------------------
  |  |   21|     91|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (73:13): [True: 84, False: 7]
  ------------------
   74|     84|            compress_level = value16;
   75|     91|    }
   76|       |
   77|    460|    stream = mz_stream_mem_create();
   78|    460|    if (!stream) {
  ------------------
  |  Branch (78:9): [True: 0, False: 460]
  ------------------
   79|      0|        mz_stream_mem_delete(&fuzz_stream);
   80|      0|        return 1;
   81|      0|    }
   82|       |
   83|    460|    err = mz_stream_mem_open(stream, MZ_FUZZ_TEST_FILENAME, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   24|    460|#define MZ_FUZZ_TEST_FILENAME "foo"
  ------------------
                  err = mz_stream_mem_open(stream, MZ_FUZZ_TEST_FILENAME, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   54|    460|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
                  err = mz_stream_mem_open(stream, MZ_FUZZ_TEST_FILENAME, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   51|    460|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
   84|    460|    if (err != MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (84:9): [True: 0, False: 460]
  ------------------
   85|      0|        mz_stream_mem_delete(&stream);
   86|      0|        mz_stream_mem_delete(&fuzz_stream);
   87|      0|        return 1;
   88|      0|    }
   89|       |
   90|    460|    handle = mz_zip_create();
   91|    460|    if (!handle) {
  ------------------
  |  Branch (91:9): [True: 0, False: 460]
  ------------------
   92|      0|        mz_stream_mem_delete(&stream);
   93|      0|        mz_stream_mem_delete(&fuzz_stream);
   94|      0|        return 1;
   95|      0|    }
   96|       |
   97|    460|    err = mz_zip_open(handle, stream, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   54|    460|#define MZ_OPEN_MODE_CREATE    (0x08)
  ------------------
                  err = mz_zip_open(handle, stream, MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_WRITE);
  ------------------
  |  |   51|    460|#define MZ_OPEN_MODE_WRITE     (0x02)
  ------------------
   98|    460|    if (err == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (98:9): [True: 460, False: 0]
  ------------------
   99|    460|        password = file_info.flag & MZ_ZIP_FLAG_ENCRYPTED ? MZ_FUZZ_TEST_PWD : NULL;
  ------------------
  |  |   77|    460|#define MZ_ZIP_FLAG_ENCRYPTED          (1 << 0)
  ------------------
                      password = file_info.flag & MZ_ZIP_FLAG_ENCRYPTED ? MZ_FUZZ_TEST_PWD : NULL;
  ------------------
  |  |   25|    195|#define MZ_FUZZ_TEST_PWD      "test123"
  ------------------
  |  Branch (99:20): [True: 195, False: 265]
  ------------------
  100|    460|        err = mz_zip_entry_write_open(handle, &file_info, compress_level, 0, password);
  101|    460|        if (err == MZ_OK) {
  ------------------
  |  |   21|    460|#define MZ_OK             (0)  /* zlib */
  ------------------
  |  Branch (101:13): [True: 368, False: 92]
  ------------------
  102|    368|            mz_stream_mem_get_buffer_at_current(fuzz_stream, (const void **)&fuzz_buf);
  103|    368|            fuzz_pos = mz_stream_tell(fuzz_stream);
  104|    368|            mz_stream_mem_get_buffer_length(fuzz_stream, &fuzz_length);
  105|       |
  106|    368|            err = mz_zip_entry_write(handle, fuzz_buf, (fuzz_length - (int32_t)fuzz_pos));
  107|       |
  108|    368|            mz_zip_entry_close(handle);
  109|    368|        }
  110|       |
  111|    460|        mz_zip_close(handle);
  112|    460|    }
  113|       |
  114|    460|    mz_zip_delete(&handle);
  115|    460|    mz_stream_mem_delete(&stream);
  116|       |
  117|    460|    mz_stream_mem_delete(&fuzz_stream);
  118|       |
  119|    460|    return 0;
  120|    460|}

