Lines Matching refs:ctx
57 struct crc *ctx; in zip_source_crc() local
64 if ((ctx=(struct crc *)malloc(sizeof(*ctx))) == NULL) { in zip_source_crc()
69 ctx->validate = validate; in zip_source_crc()
71 return zip_source_layered(za, src, crc_read, ctx); in zip_source_crc()
80 struct crc *ctx; in crc_read() local
83 ctx = (struct crc *)_ctx; in crc_read()
87 ctx->eof = 0; in crc_read()
88 ctx->crc = crc32(0, NULL, 0); in crc_read()
89 ctx->size = 0; in crc_read()
94 if (ctx->eof || len == 0) in crc_read()
101 ctx->eof = 1; in crc_read()
102 if (ctx->validate) { in crc_read()
108 if ((st.valid & ZIP_STAT_CRC) && st.crc != ctx->crc) { in crc_read()
109 ctx->e[0] = ZIP_ER_CRC; in crc_read()
110 ctx->e[1] = 0; in crc_read()
114 if ((st.valid & ZIP_STAT_SIZE) && st.size != ctx->size) { in crc_read()
115 ctx->e[0] = ZIP_ER_INCONS; in crc_read()
116 ctx->e[1] = 0; in crc_read()
123 ctx->size += n; in crc_read()
124 ctx->crc = crc32(ctx->crc, data, n); in crc_read()
137 if (ctx->eof) { in crc_read()
140 st->size = ctx->size; in crc_read()
141 st->crc = ctx->crc; in crc_read()
148 memcpy(data, ctx->e, sizeof(ctx->e)); in crc_read()
152 free(ctx); in crc_read()