summary refs log tree commit diff
path: root/mico-dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'mico-dump.c')
-rw-r--r--mico-dump.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/mico-dump.c b/mico-dump.c
index ce13a3e..37ed025 100644
--- a/mico-dump.c
+++ b/mico-dump.c
@@ -1,6 +1,7 @@
 #include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <zip.h>
@@ -105,9 +106,17 @@ main()
 		int64_t t = 0, td = 0;
 		double v = 0.0;
 
-		while (!ts.eof) {
-			int32_t tdd = get1(&ts);
-			int32_t vd = get1(&vs);
+		int64_t len = get1(&ts);
+		int64_t lenv = get1(&vs);
+
+		if (len != lenv) {
+			fprintf(stderr, "time and value length don't agree");
+			exit(-1);
+		}
+
+		for (int64_t j = 0; j < len; j++) {
+			int64_t tdd = get1(&ts);
+			int64_t vd = get1(&vs);
 
 			td += tdd;
 			t += td;