diff src/dmres.c @ 2479:c1cae47cd410

Rename DMPackEntry::length to csize (compressed size).
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 27 Apr 2020 21:33:29 +0300
parents 8193f62a541d
children 92b93a12c014
line wrap: on
line diff
--- a/src/dmres.c	Mon Apr 27 20:39:35 2020 +0300
+++ b/src/dmres.c	Mon Apr 27 21:33:29 2020 +0300
@@ -388,7 +388,7 @@
     memset(&zstr, 0, sizeof(zstr));
     zstr.next_out = handle->memData;
     zstr.avail_out = handle->memSize;
-    cdataLeft = node->length;
+    cdataLeft = node->csize;
 
     if ((zret = inflateInit(&zstr)) != Z_OK)
     {
@@ -430,14 +430,14 @@
     int ret;
 
     // Allocate buffer for compressed data
-    if ((inBuf = dmMalloc(node->length)) == NULL)
+    if ((inBuf = dmMalloc(node->csize)) == NULL)
     {
         ret = DMERR_MALLOC;
         goto out;
     }
 
     // Read compressed data
-    if (fread(inBuf, sizeof(Uint8), node->length, handle->lib->packFile->file) != node->length)
+    if (fread(inBuf, sizeof(Uint8), node->csize, handle->lib->packFile->file) != node->csize)
     {
         ret = DMERR_FREAD;
         goto out;
@@ -448,7 +448,7 @@
         goto out;
 
     zctx.inBuffer     = zctx.inBufferStart = inBuf;
-    zctx.inBufferEnd  = inBuf + node->length;
+    zctx.inBufferEnd  = inBuf + node->csize;
     zctx.outBuffer    = zctx.outBufferStart = handle->memData;
     zctx.outBufferEnd = handle->memData + node->size;
     zctx.expandable   = FALSE;
@@ -522,11 +522,11 @@
     }
     else
     {
-        if (node->size != node->length)
+        if (node->size != node->csize)
         {
             ret = dmErrorDBG(DMERR_INVALID_DATA,
                 "Node '%s' raw size and length fields differ for uncompressed node: %d <> %d.\n",
-                handle->filename, node->size, node->length);
+                handle->filename, node->size, node->csize);
             goto out;
         }
         if (fread(handle->memData, sizeof(Uint8), node->size, handle->lib->packFile->file) != node->size)
@@ -707,7 +707,7 @@
     // Check for EOF
     if (!dm_mem_realloc(ctx, ctx->memOffset + 1))
         return EOF;
-    
+
     ctx->memData[ctx->memOffset++] = ch;
     return ch;
 }