]> mj.ucw.cz Git - libucw.git/commitdiff
generalized for extracting also uncompressed buckets in the new 0-copy
authorRobert Spalek <robert@ucw.cz>
Thu, 24 Jun 2004 15:33:59 +0000 (15:33 +0000)
committerRobert Spalek <robert@ucw.cz>
Thu, 24 Jun 2004 15:33:59 +0000 (15:33 +0000)
format (assumes BUCKET_TYPE_V30F = 0x80000003 is added into lib/bucket.h)

lib/buck2obj.c

index 235c17dbaf325a6ebe6974a1e418c5f273e310c0..df980a0b448424cb266e4f233a949503ea562125 100644 (file)
@@ -61,19 +61,24 @@ extract_odes(struct obuck_header *hdr, struct fastbuf *body, struct odes *o, byt
     byte *p = decode_attributes(start, end, o);
 
     /* Decompress the body.  */
-    GET_UTF8(p, len);
-    int res = lizard_decompress_safe(p, lizard_buf, len);
-    if (res < 0)
-      return res;
-    if (res != (int) len)
+    if (hdr->type == BUCKET_TYPE_V30C)
     {
-      errno = EINVAL;
-      return -1;
+      GET_UTF8(p, len);
+      int res = lizard_decompress_safe(p, lizard_buf, len);
+      if (res < 0)
+       return res;
+      if (res != (int) len)
+      {
+       errno = EINVAL;
+       return -1;
+      }
+      start = lizard_buf->ptr;
+      end = start + len;
     }
+    else
+      start = p;
 
     /* Decode the body, 0-copy.  */
-    start = lizard_buf->ptr;
-    end = start + len;
     p = decode_attributes(start, end, o);
     if (p != end)
     {