Logic fixes; seems to work rather well with KenBuild, now.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 09 Jul 2001 01:43:28 +0000
changeset 26 575e03541d5e
parent 25 96b32c0fd7f3
child 27 e1d3292769b2
Logic fixes; seems to work rather well with KenBuild, now.
archivers/grp.c
--- a/archivers/grp.c	Mon Jul 09 00:51:46 2001 +0000
+++ b/archivers/grp.c	Mon Jul 09 01:43:28 2001 +0000
@@ -82,7 +82,7 @@
 
     errno = 0;
     retval = fread(buffer, objSize, objCount, fh);
-    finfo->curPos += retval;
+    finfo->curPos += (retval * objSize);
     BAIL_IF_MACRO((retval < objCount) && (ferror(fh)),strerror(errno),retval);
 
     return(retval);
@@ -106,7 +106,7 @@
 static int GRP_seek(FileHandle *handle, int offset)
 {
     GRPfileinfo *finfo = (GRPfileinfo *) (handle->opaque);
-    int newPos = finfo->curPos + offset;
+    int newPos = finfo->startPos + offset;
 
     BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
     BAIL_IF_MACRO(newPos > finfo->startPos + finfo->size, ERR_PAST_EOF, 0);
@@ -242,7 +242,7 @@
     FILE *fh = g->handle;
     int i;
     char *ptr;
-    int retval = 0; /*(g->totalEntries + 1) * 16;*/ /* offset of raw file data */
+    int retval = (g->totalEntries + 1) * 16; /* offset of raw file data */
 
     /* Rule out filenames to avoid unneeded file i/o... */
     if (strchr(name, '/') != NULL)  /* no directories in groupfiles. */