From 11460c1f56ed4939c8f0df0482059f5fecd289fa Mon Sep 17 00:00:00 2001 From: Timo Savinen Date: Tue, 27 Sep 2005 14:29:01 +0000 Subject: 0.1.2 --- src/buffer.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index b5798d3..d7a5b4e 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -20,7 +20,7 @@ * */ -/* $Id: buffer.c,v 1.25 2005/09/25 10:03:47 timo Exp $ */ +/* $Id: buffer.c,v 1.30 2005/09/30 10:58:15 timo Exp $ */ #include "bbe.h" #include @@ -113,6 +113,8 @@ get_current_file(void) struct io_file *prev; off_t current_offset = in_buffer.stream_offset + (off_t) (in_buffer.read_pos-in_buffer.buffer); + if(f == NULL) return ""; + while(f != NULL) { prev = f; @@ -196,6 +198,20 @@ read_byte() return *in_buffer.read_pos; } +/* returns pointer to the read position */ +inline unsigned char * +read_pos() +{ + return in_buffer.read_pos; +} + +/* return the block end pointer */ +inline unsigned char * +block_end_pos() +{ + return in_buffer.block_end; +} + /* advances the read pointer, if buffer has reached low water, get more from stream to buffer */ /* returns false in case of end of stream */ @@ -451,6 +467,8 @@ write_buffer(unsigned char *buf,off_t length) { unsigned char *save_pos; + if(!length) return; + if(length > (off_t) (OUTPUT_BUFFER_SIZE - (out_buffer.write_pos - out_buffer.buffer))) { save_pos = out_buffer.cycle_start < out_buffer.low_pos ? out_buffer.cycle_start : out_buffer.low_pos; -- cgit v1.2.3