aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-10-21 17:34:36 +0000
committerWerner Koch <[email protected]>1998-10-21 17:34:36 +0000
commite309a875cb938dff76983d00552ebcc08a5e90c1 (patch)
treea10cbf247317e67fcb623d7c10dfa4b4c58edbfd /util
parentSnapshot release 0.4.2 (diff)
downloadgnupg-e309a875cb938dff76983d00552ebcc08a5e90c1.tar.gz
gnupg-e309a875cb938dff76983d00552ebcc08a5e90c1.zip
Epxerimenta support for GDBM keyings.
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog5
-rw-r--r--util/Makefile.am2
-rw-r--r--util/iobuf.c27
-rw-r--r--util/logger.c4
4 files changed, 33 insertions, 5 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 6904c9333..3c1dba658 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+Wed Oct 21 12:20:29 1998 Werner Koch ([email protected])
+
+ * util.c (iobuf_flush): autoincreasing of a temp. iobuf
+ (iobuf_temp_with_content): New.
+
Tue Oct 13 12:40:13 1998 Werner Koch ([email protected])
* util.c (.nofast): set this variable
diff --git a/util/Makefile.am b/util/Makefile.am
index eee154ed7..3f2f9a3d0 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl
noinst_LIBRARIES = libutil.a
diff --git a/util/iobuf.c b/util/iobuf.c
index e4c412444..e1b62cfc2 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -483,6 +483,18 @@ iobuf_temp()
return a;
}
+IOBUF
+iobuf_temp_with_content( const char *buffer, size_t length )
+{
+ IOBUF a;
+
+ a = iobuf_alloc(3, length );
+ memcpy( a->d.buf, buffer, length );
+ a->d.len = length;
+
+ return a;
+}
+
/****************
* Create a head iobuf for reading from a file
@@ -877,8 +889,19 @@ iobuf_flush(IOBUF a)
return 0;
/*log_debug("iobuf-%d.%d: flush\n", a->no, a->subno );*/
- if( a->usage == 3 )
- log_bug("temp buffer too short\n");
+ if( a->usage == 3 ) { /* must increase the size of the temp buffer */
+ char *newbuf;
+ size_t newsize = a->d.size + 8192;
+
+ log_debug("increasing temp iobuf from %lu to %lu\n",
+ (ulong)a->d.size, (ulong)newsize );
+ newbuf = m_alloc( newsize );
+ memcpy( newbuf, a->d.buf, a->d.len );
+ m_free(a->d.buf);
+ a->d.buf = newbuf;
+ a->d.size = newsize;
+ return 0;
+ }
else if( a->usage != 2 )
log_bug("flush on non-output iobuf\n");
else if( !a->filter )
diff --git a/util/logger.c b/util/logger.c
index 60f59da8a..8183abe5c 100644
--- a/util/logger.c
+++ b/util/logger.c
@@ -161,7 +161,7 @@ g10_log_bug( const char *fmt, ... )
va_list arg_ptr ;
putc('\n', stderr );
- print_prefix("Ooops: ");
+ print_prefix("Ohhhh jeeee: ");
va_start( arg_ptr, fmt ) ;
vfprintf(stderr,fmt,arg_ptr) ;
va_end(arg_ptr);
@@ -174,7 +174,7 @@ g10_log_bug( const char *fmt, ... )
void
g10_log_bug0( const char *file, int line, const char *func )
{
- log_bug(_("Ohhhh jeeee ... this is a bug (%s:%d:%s)\n"), file, line, func );
+ log_bug(_("... this is a bug (%s:%d:%s)\n"), file, line, func );
}
#else
void