]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.c
Moved object reading and writing functions where they belong.
[libucw.git] / lib / fastbuf.c
index bf887a18f86acd33ae61603a62486b5a2fbf34b5..85df8250370f10197234d902f4cbcc908fd73895 100644 (file)
@@ -342,3 +342,28 @@ brewind(struct fastbuf *f)
   bflush(f);
   bsetpos(f, 0);
 }
+
+void
+bskip(struct fastbuf *f, uns len)
+{
+  while (len)
+    {
+      byte *buf;
+      uns l = bdirect_read_prepare(f, &buf);
+      l = MIN(l, len);
+      bdirect_read_commit(f, buf+l);
+      len -= l;
+    }
+}
+
+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;
+}