summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-02-04 19:54:31 +0100
committerWerner Koch <wk@gnupg.org>1998-02-04 19:54:31 +0100
commit9886ad8098ea1a128e07be54eaf8f24d73795aa2 (patch)
tree22e597c9f6384b0399abd049c0fd1c64d3d623eb /include
parentFixed a few bugs (diff)
downloadgnupg2-9886ad8098ea1a128e07be54eaf8f24d73795aa2.tar.xz
gnupg2-9886ad8098ea1a128e07be54eaf8f24d73795aa2.zip
armor rewritten, but still buggy
Diffstat (limited to 'include')
-rw-r--r--include/iobuf.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/iobuf.h b/include/iobuf.h
index 81e23f267..e5ce81a3f 100644
--- a/include/iobuf.h
+++ b/include/iobuf.h
@@ -56,6 +56,12 @@ struct iobuf_struct {
const char *desc;
void *opaque; /* can be used to hold any information */
/* this value is copied to all instances */
+ struct {
+ size_t size; /* allocated size */
+ size_t start; /* number of invalid bytes at the begin of the buffer */
+ size_t len; /* currently filled to this size */
+ byte *buf;
+ } unget;
};
int iobuf_debug_mode;
@@ -88,6 +94,7 @@ int iobuf_writestr(IOBUF a, const char *buf );
int iobuf_write_temp( IOBUF a, IOBUF temp );
size_t iobuf_temp_to_buffer( IOBUF a, byte *buffer, size_t buflen );
+void iobuf_unget_and_close_temp( IOBUF a, IOBUF temp );
u32 iobuf_get_filelength( IOBUF a );
const char *iobuf_get_fname( IOBUF a );
@@ -106,6 +113,10 @@ int iobuf_in_block_mode( IOBUF a );
iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
#define iobuf_get_noeof(a) (iobuf_get((a))&0xff)
+/* use this if you have ungetted stuff */
+#define iobuf_get2(a) \
+ ( ( (a)->unget.buf || (a)->nlimit || (a)->d.start >= (a)->d.len )? \
+ iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
/* write a byte to the iobuf and return true on write error
* This macro does only write the low order byte