]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.c
enlarge MAX_ATTR_SIZE
[libucw.git] / lib / fastbuf.c
index d2e08f8648def7918c8fc04404f530aa18fabd0b..a29dc30b370e8a5c2606eab15edb665b9746bbbb 100644 (file)
@@ -343,15 +343,30 @@ brewind(struct fastbuf *f)
   bsetpos(f, 0);
 }
 
-void
+int
 bskip(struct fastbuf *f, uns len)
 {
   while (len)
     {
       byte *buf;
       uns l = bdirect_read_prepare(f, &buf);
+      if (!l)
+       return 0;
       l = MIN(l, len);
       bdirect_read_commit(f, buf+l);
       len -= l;
     }
+  return 1;
+}
+
+sh_off_t
+bfilesize(struct fastbuf *f)
+{
+  if (!f)
+    return 0;
+  sh_off_t pos = btell(f);
+  bseek(f, 0, SEEK_END);
+  sh_off_t len = btell(f);
+  bsetpos(f, pos);
+  return len;
 }