From bbce32bde51829ae8c4e5290c9baaca0001ec660 Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Thu, 24 Jun 2004 15:33:59 +0000 Subject: [PATCH] generalized for extracting also uncompressed buckets in the new 0-copy format (assumes BUCKET_TYPE_V30F = 0x80000003 is added into lib/bucket.h) --- lib/buck2obj.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/buck2obj.c b/lib/buck2obj.c index 235c17db..df980a0b 100644 --- a/lib/buck2obj.c +++ b/lib/buck2obj.c @@ -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) { -- 2.39.2