diff tests/testdmzlib.c @ 1121:043b5942fdb6

Rename some dmzlib functions and add context init/close functions.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 04 Mar 2015 04:37:58 +0200
parents 5a8d29b88431
children d0898867ec4c
line wrap: on
line diff
--- a/tests/testdmzlib.c	Wed Mar 04 03:53:22 2015 +0200
+++ b/tests/testdmzlib.c	Wed Mar 04 04:37:58 2015 +0200
@@ -129,6 +129,9 @@
     }
 
     // Initialize decompression structures
+    if ((ret = dmZLibInitInflate(&ctx)) != DMERR_OK)
+        goto out;
+
     ctx.inBuffer     = ctx.inBufferStart = inBuffer;
     ctx.inBufferEnd  = inBuffer + *inSize;
 
@@ -143,7 +146,7 @@
         goto out;
     }
 
-    if ((ret = dmZLibDecode(&ctx)) != DMERR_OK)
+    if ((ret = dmZLibInflate(&ctx)) != DMERR_OK)
     {
         dmErrorMsg("Error in ZLIB decompress: %d, %s\n", ret, dmErrorStr(ret));
         goto out;
@@ -159,7 +162,7 @@
     }
 
 out:
-
+    dmZLibCloseInflate(&ctx);
     dmFree(inBuffer);
     dmFree(outBuffer);
     return ret;
@@ -275,6 +278,8 @@
         argHandleOpt, argHandleFile, OPTH_BAILOUT))
         exit(1);
 
+    dmZLibInit();
+
     // Input and output files
     if (optInFilename == NULL)
         inFile = stdin;
@@ -321,5 +326,6 @@
     if (inFile != NULL)
         fclose(inFile);
 
+    dmZLibClose();
     return 0;
 }