summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demo.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/demo.c b/src/demo.c
index fd1f310..21b5eea 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -109,7 +109,11 @@ int readdemosnap(FILE *fp, demosnap *snap, int size)
fread(data, sizeof(unsigned char), size, fp);
- int r = decompresshuff((char *)data, size, (char *)unpacked, 1034 * 8);
+ if (decompresshuff((char *)data, size, (char *)unpacked, 1034 * 8) < 0)
+ {
+ printf("[ ERROR ] error while decompressing snap cunk!\n");
+ return 0;
+ }
unsigned char *cp = unpacked;
@@ -156,7 +160,7 @@ int readdemochunk(FILE *fp, demochunk *chunk, unsigned char ver)
demotick *tick = (demotick *)malloc(sizeof(demotick));
if (readdemotick(fp, chunkhead, tick, ver))
{
- chunk->type = 0;
+ chunk->type = DEMOTICK;
chunk->data.tick = tick;
printf("TICK={keyframe: %d, innline: %d, delta: %d}\n", tick->keyframe, tick->innline, tick->delta);
}
@@ -181,7 +185,7 @@ int readdemochunk(FILE *fp, demochunk *chunk, unsigned char ver)
demosnap *snap = (demosnap *)malloc(sizeof(demosnap));
if (readdemosnap(fp, snap, size))
{
- chunk->type = 1; // TODO make a chunk-type enum
+ chunk->type = DEMOSNAP;
chunk->data.snap = snap;
printf("SNAPSHOT={datasize: %d, numitems: %d, offsets: [ ", snap->datasize, snap->numitems);
@@ -214,6 +218,10 @@ int readdemochunk(FILE *fp, demochunk *chunk, unsigned char ver)
printf("SNAPSHOT_DELTA={");
fseek(fp, size, SEEK_CUR);
}
+ else
+ {
+ printf("[ ERROR ] unknown chunk type!\n");
+ }
printf("size: %d}\n", size);
}