]> mj.ucw.cz Git - libucw.git/commitdiff
patch obj_write{,_nocheck}() to use bput_attr_str() to support both V30 and V33 buckets
authorRobert Spalek <robert@ucw.cz>
Sat, 10 Jul 2004 16:26:54 +0000 (16:26 +0000)
committerRobert Spalek <robert@ucw.cz>
Sat, 10 Jul 2004 16:26:54 +0000 (16:26 +0000)
lib/object.c

index 371d9b3647d7e6443f09dd838d34716acc78b84f..32beab2e895e0474825fba895afeeae97f5dc52c 100644 (file)
@@ -2,6 +2,7 @@
  *     Sherlock Library -- Object Functions
  *
  *     (c) 1997--2004 Martin Mares <mj@ucw.cz>
+ *     (c) 2004 Robert Spalek <robert@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
@@ -87,17 +88,14 @@ obj_write(struct fastbuf *f, struct odes *d)
     for(struct oattr *b=a; b; b=b->same)
       {
        byte *z;
-       bputc(f, a->attr);
-       for(z = b->val; *z; z++)
-         if (*z >= ' ' || *z == '\t')
-           bputc(f, *z);
-         else
+       for (z = b->val; *z; z++)
+         if (*z < ' ' && *z != '\t')
            {
-             bputc(f, '?');
              log(L_ERROR, "obj_dump: Found non-ASCII characters (URL might be %s)", obj_find_aval(d, 'U'));
+             *z = '?';
            }
        ASSERT(z - b->val <= MAX_ATTR_SIZE-2);
-       bputc(f, '\n');
+       bput_attr_str(f, a->attr, b->val);
       }
 }
 
@@ -106,10 +104,7 @@ obj_write_nocheck(struct fastbuf *f, struct odes *d)
 {
   for(struct oattr *a=d->attrs; a; a=a->next)
     for(struct oattr *b=a; b; b=b->same)
-      {
-       bputc(f, a->attr);
-       bputsn(f, b->val);
-      }
+      bput_attr_str(f, a->attr, b->val);
 }
 
 struct oattr *