return Z_STREAM_ERROR; \
}
-#define FINISH_WITH_ERR(strm, message) { \
- strm->msg = message; \
- return Z_STREAM_ERROR; \
-}
-
#define FINISH_WITH_NULL_ERR(msg) { \
(void)msg; \
return NULL; \
}
+int ZWRAPC_finish_with_error_message(z_streamp strm, char* message)
+{
+ ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
+ strm->msg = message;
+ if (zwc == NULL) return Z_STREAM_ERROR;
+
+ return ZWRAPC_finish_with_error(zwc, strm, 0);
+}
+
+
ZEXTERN int ZEXPORT z_deflateInit_ OF((z_streamp strm, int level,
const char *version, int stream_size))
{
strm->avail_in -= zwc->inBuffer.pos;
}
- if (flush == Z_FULL_FLUSH || flush == Z_BLOCK || flush == Z_TREES) FINISH_WITH_ERR(strm, "Z_FULL_FLUSH, Z_BLOCK and Z_TREES are not supported!");
+ if (flush == Z_FULL_FLUSH || flush == Z_BLOCK || flush == Z_TREES) return ZWRAPC_finish_with_error_message(strm, "Z_FULL_FLUSH, Z_BLOCK and Z_TREES are not supported!");
if (flush == Z_FINISH) {
size_t bytesLeft;
}
+int ZWRAPD_finish_with_error_message(z_streamp strm, char* message)
+{
+ ZWRAP_DCtx* zwd = (ZWRAP_DCtx*) strm->state;
+ strm->msg = message;
+ if (zwd == NULL) return Z_STREAM_ERROR;
+
+ return ZWRAPD_finish_with_error(zwd, strm, 0);
+}
+
+
ZEXTERN int ZEXPORT z_inflateInit_ OF((z_streamp strm,
const char *version, int stream_size))
{
{
if (!g_useZSTD)
return deflateCopy(dest, source);
- FINISH_WITH_ERR(source, "deflateCopy is not supported!");
+ return ZWRAPC_finish_with_error_message(source, "deflateCopy is not supported!");
}
{
if (!g_useZSTD)
return deflateTune(strm, good_length, max_lazy, nice_length, max_chain);
- FINISH_WITH_ERR(strm, "deflateTune is not supported!");
+ return ZWRAPC_finish_with_error_message(strm, "deflateTune is not supported!");
}
{
if (!g_useZSTD)
return deflatePending(strm, pending, bits);
- FINISH_WITH_ERR(strm, "deflatePending is not supported!");
+ return ZWRAPC_finish_with_error_message(strm, "deflatePending is not supported!");
}
#endif
{
if (!g_useZSTD)
return deflatePrime(strm, bits, value);
- FINISH_WITH_ERR(strm, "deflatePrime is not supported!");
+ return ZWRAPC_finish_with_error_message(strm, "deflatePrime is not supported!");
}
{
if (!g_useZSTD)
return deflateSetHeader(strm, head);
- FINISH_WITH_ERR(strm, "deflateSetHeader is not supported!");
+ return ZWRAPC_finish_with_error_message(strm, "deflateSetHeader is not supported!");
}
{
if (!strm->reserved)
return inflateGetDictionary(strm, dictionary, dictLength);
- FINISH_WITH_ERR(strm, "inflateGetDictionary is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflateGetDictionary is not supported!");
}
#endif
{
if (!g_useZSTD)
return inflateCopy(dest, source);
- FINISH_WITH_ERR(source, "inflateCopy is not supported!");
+ return ZWRAPD_finish_with_error_message(source, "inflateCopy is not supported!");
}
{
if (!strm->reserved)
return inflateMark(strm);
- FINISH_WITH_ERR(strm, "inflateMark is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflateMark is not supported!");
}
#endif
{
if (!strm->reserved)
return inflatePrime(strm, bits, value);
- FINISH_WITH_ERR(strm, "inflatePrime is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflatePrime is not supported!");
}
{
if (!strm->reserved)
return inflateGetHeader(strm, head);
- FINISH_WITH_ERR(strm, "inflateGetHeader is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflateGetHeader is not supported!");
}
{
if (!strm->reserved)
return inflateBackInit_(strm, windowBits, window, version, stream_size);
- FINISH_WITH_ERR(strm, "inflateBackInit is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflateBackInit is not supported!");
}
{
if (!strm->reserved)
return inflateBack(strm, in, in_desc, out, out_desc);
- FINISH_WITH_ERR(strm, "inflateBack is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflateBack is not supported!");
}
{
if (!strm->reserved)
return inflateBackEnd(strm);
- FINISH_WITH_ERR(strm, "inflateBackEnd is not supported!");
+ return ZWRAPD_finish_with_error_message(strm, "inflateBackEnd is not supported!");
}