Code to create test zchunk file with optional flags
authorJonathan Dieter <jdieter@gmail.com>
Mon, 8 Oct 2018 13:05:00 +0000 (14:05 +0100)
committerJonathan Dieter <jdieter@gmail.com>
Mon, 8 Oct 2018 13:05:00 +0000 (14:05 +0100)
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
src/lib/header.c

index cc402f2679ac7a54c89b8e851703d785ae86194e..3ebae0aa107261be0aa19e37bb8a1225cc255e68 100644 (file)
@@ -238,7 +238,7 @@ static bool preface_create(zckCtx *zck) {
     length += zck->hash_type.digest_size;
 
     /* Write out flags */
-    size_t flags = 0;
+    size_t flags = 2;
     if(zck->has_streams)
         flags &= 1;
     compint_from_size(header+length, flags, &length);
@@ -248,6 +248,11 @@ static bool preface_create(zckCtx *zck) {
         free(header);
         return false;
     }
+
+    compint_from_size(header+length, 15, &length);
+    header = zrealloc(header, length + 100);
+    memcpy(header+length, "This is a test\0", 15);
+    length += 15;
     compint_from_size(header+length, zck->index_size, &length);
 
     /* Shrink header to actual size */