2 * Bucket -> Object converter
4 * (c) 2004, Robert Spalek <robert@ucw.cz>
8 #include "lib/fastbuf.h"
9 #include "charset/unicode.h"
10 #include "lib/object.h"
11 #include "lib/bucket.h"
12 #include "lib/lizard.h"
13 #include "lib/buck2obj.h"
18 decode_attributes(byte *start, byte *end, struct odes *o)
29 obj_add_attr(o, type, p);
35 extract_odes(struct obuck_header *hdr, struct fastbuf *body, struct odes *o, byte *buf, uns buf_len, struct lizard_buffer *lizard_buf)
37 if (hdr->type < BUCKET_TYPE_V30C)
40 obj_read_multi(body, o);
45 /* Read all the bucket into 1 buffer, 0-copy if possible. */
47 uns len = bdirect_read_prepare(body, &start);
48 if (len < hdr->length)
50 if (hdr->length > buf_len)
55 len = bread(body, buf, hdr->length);
60 /* Decode the header, 0-copy. */
61 byte *p = decode_attributes(start, end, o);
63 /* Decompress the body. */
65 int res = lizard_decompress_safe(p, lizard_buf, len);
74 /* Decode the body, 0-copy. */
75 start = lizard_buf->ptr;
77 p = decode_attributes(start, end, o);