summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorTimo Savinen <tjsa@iki.fi>2005-09-27 14:29:01 +0000
committerHadrien Dorio <hadrien.dorio@gmail.com>2017-12-16 00:24:05 +0100
commit11460c1f56ed4939c8f0df0482059f5fecd289fa (patch)
tree4734a3d9bd595f2e0b9c4a2d57ba04a3c1b8c287 /src/buffer.c
parentb9eb6e4429575318d3c510b99961093c42321529 (diff)
downloadbinary-block-editor-11460c1f56ed4939c8f0df0482059f5fecd289fa.tar.gz
binary-block-editor-11460c1f56ed4939c8f0df0482059f5fecd289fa.zip
0.1.2
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c20
1 files changed, 19 insertions, 1 deletions
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 <stdlib.h>
@@ -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;
OpenPOWER on IntegriCloud