X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fobj2buck.c;h=367764a5aef3f214610752313cbe07daf19c338d;hb=e828732528e0ed88973dd18f2dee97a42c0b4e59;hp=0ced895bea00c8132bc19ddfdb3a41c6a03b7eb3;hpb=a010e5f6e075097c0d6362d40fb49e812e99e185;p=libucw.git diff --git a/lib/obj2buck.c b/lib/obj2buck.c index 0ced895b..367764a5 100644 --- a/lib/obj2buck.c +++ b/lib/obj2buck.c @@ -17,6 +17,7 @@ #include static uns use_v33; +static int hdr_sep; void attr_set_type(uns type) @@ -24,12 +25,17 @@ attr_set_type(uns type) switch (type) { case BUCKET_TYPE_PLAIN: + use_v33 = 0; + hdr_sep = -1; + break; case BUCKET_TYPE_V30: use_v33 = 0; + hdr_sep = '\n'; break; case BUCKET_TYPE_V33: case BUCKET_TYPE_V33_LIZARD: use_v33 = 1; + hdr_sep = 0; break; default: die("Don't know how to generate buckets of type %08x", type); @@ -118,6 +124,14 @@ put_attr_num(byte *ptr, uns type, uns val) return ptr; } +byte * +put_attr_separator(byte *ptr) +{ + if (hdr_sep >= 0) + *ptr++ = hdr_sep; + return ptr; +} + inline void bput_attr(struct fastbuf *b, uns type, byte *val, uns len) { @@ -185,6 +199,13 @@ bput_attr_num(struct fastbuf *b, uns type, uns val) bprintf(b, "%c%d\n", type, val); } +void +bput_attr_separator(struct fastbuf *b) +{ + if (hdr_sep >= 0) + bputc(b, hdr_sep); +} + void obj_write(struct fastbuf *f, struct odes *d) { @@ -195,7 +216,7 @@ obj_write(struct fastbuf *f, struct odes *d) for (z = b->val; *z; z++) if (*z < ' ' && *z != '\t') { - log(L_ERROR, "obj_dump: Found non-ASCII characters (URL might be %s)", obj_find_aval(d, 'U')); + log(L_ERROR, "obj_dump: Found non-ASCII character %02x (URL might be %s) in %c%s", *z, obj_find_aval(d, 'U'), a->attr, b->val); *z = '?'; } ASSERT(z - b->val <= MAX_ATTR_SIZE-2);