changeset 720:09528946f92b

Rename a variable.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 19 Apr 2013 20:26:38 +0300
parents eb4bd1f7b679
children ad3965b93ef1
files dmpackutil.c
diffstat 1 files changed, 33 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/dmpackutil.c	Fri Apr 19 19:26:15 2013 +0300
+++ b/dmpackutil.c	Fri Apr 19 20:26:38 2013 +0300
@@ -118,7 +118,7 @@
 int dm_pack_add_file(DMPackFile * pack, const char *filename, BOOL doCompress, int resFlags,
                     DMPackEntry ** ppEntry)
 {
-    z_stream compStream;
+    z_stream zstr;
     off_t startOffs;
     unsigned int compSize;
     FILE *inFile;
@@ -169,10 +169,10 @@
 
     // Read (and possibly compress) the data
     compSize = 0;
-    compStream.zalloc = (alloc_func) Z_NULL;
-    compStream.zfree = (free_func) Z_NULL;
-    compStream.opaque = (voidpf) Z_NULL;
-    result = deflateInit(&compStream, (doCompress) ? Z_DEFAULT_COMPRESSION : 0);
+    zstr.zalloc = (alloc_func) Z_NULL;
+    zstr.zfree = (free_func) Z_NULL;
+    zstr.opaque = (voidpf) Z_NULL;
+    result = deflateInit(&zstr, (doCompress) ? Z_DEFAULT_COMPRESSION : 0);
     if (result != Z_OK)
     {
         dmFree(inBuffer);
@@ -185,30 +185,30 @@
     result = Z_OK;
     while (!feof(inFile) && result == Z_OK)
     {
-        compStream.avail_in = fread(inBuffer, sizeof(Uint8), DPACK_TMPSIZE, inFile);
-        compStream.next_in = inBuffer;
-        compStream.next_out = outBuffer;
-        compStream.avail_out = DPACK_TMPSIZE;
-        compStream.total_out = 0;
-        result = deflate(&compStream, Z_FULL_FLUSH);
+        zstr.avail_in = fread(inBuffer, sizeof(Uint8), DPACK_TMPSIZE, inFile);
+        zstr.next_in = inBuffer;
+        zstr.next_out = outBuffer;
+        zstr.avail_out = DPACK_TMPSIZE;
+        zstr.total_out = 0;
+        result = deflate(&zstr, Z_FULL_FLUSH);
 
-        if (result == Z_OK && compStream.total_out > 0)
+        if (result == Z_OK && zstr.total_out > 0)
         {
-            compSize += compStream.total_out;
-            fwrite(outBuffer, sizeof(Uint8), compStream.total_out, pack->file);
+            compSize += zstr.total_out;
+            fwrite(outBuffer, sizeof(Uint8), zstr.total_out, pack->file);
         }
     }
 
     // Create directory entry
     strncpy(entry.filename, filename, sizeof(entry.filename));
     entry.filename[sizeof(entry.filename) - 1] = 0;
-    entry.size = compStream.total_in;
+    entry.size = zstr.total_in;
     entry.offset = startOffs;
     entry.length = compSize;
     entry.resFlags = resFlags;
 
     // Cleanup
-    deflateEnd(&compStream);
+    deflateEnd(&zstr);
     dmFree(inBuffer);
     dmFree(outBuffer);
     fclose(inFile);
@@ -229,7 +229,7 @@
  */
 int dm_pack_extract_file(DMPackFile *pack, DMPackEntry * entry)
 {
-    z_stream compStream;
+    z_stream zstr;
     FILE *outFile;
     Uint8 *inBuffer, *outBuffer;
     size_t inDataLeft;
@@ -264,10 +264,10 @@
     }
 
     // Read and uncompress the data
-    compStream.zalloc = (alloc_func) Z_NULL;
-    compStream.zfree = (free_func) Z_NULL;
-    compStream.opaque = (voidpf) Z_NULL;
-    ret = inflateInit(&compStream);
+    zstr.zalloc = (alloc_func) Z_NULL;
+    zstr.zfree = (free_func) Z_NULL;
+    zstr.opaque = (voidpf) Z_NULL;
+    ret = inflateInit(&zstr);
     if (ret != Z_OK)
     {
         dmFree(inBuffer);
@@ -282,28 +282,28 @@
     while (inDataLeft > 0 && ret == Z_OK)
     {
         if (inDataLeft >= DPACK_TMPSIZE)
-            compStream.avail_in = fread(inBuffer, sizeof(Uint8), DPACK_TMPSIZE, pack->file);
+            zstr.avail_in = fread(inBuffer, sizeof(Uint8), DPACK_TMPSIZE, pack->file);
         else
-            compStream.avail_in = fread(inBuffer, sizeof(Uint8), inDataLeft, pack->file);
+            zstr.avail_in = fread(inBuffer, sizeof(Uint8), inDataLeft, pack->file);
 
-        inDataLeft -= compStream.avail_in;
-        compStream.next_in = inBuffer;
+        inDataLeft -= zstr.avail_in;
+        zstr.next_in = inBuffer;
 
-        while (compStream.avail_in > 0 && ret == Z_OK)
+        while (zstr.avail_in > 0 && ret == Z_OK)
         {
-            compStream.next_out = outBuffer;
-            compStream.avail_out = DPACK_TMPSIZE;
-            compStream.total_out = 0;
-            ret = inflate(&compStream, Z_FULL_FLUSH);
-            if (compStream.total_out > 0)
+            zstr.next_out = outBuffer;
+            zstr.avail_out = DPACK_TMPSIZE;
+            zstr.total_out = 0;
+            ret = inflate(&zstr, Z_FULL_FLUSH);
+            if (zstr.total_out > 0)
             {
-                fwrite(outBuffer, sizeof(Uint8), compStream.total_out, outFile);
+                fwrite(outBuffer, sizeof(Uint8), zstr.total_out, outFile);
             }
         }
     }
 
     // Cleanup
-    inflateEnd(&compStream);
+    inflateEnd(&zstr);
     dmFree(inBuffer);
     dmFree(outBuffer);
     fclose(outFile);