From c0c2c58054923d506f61ce9a71d509b48a381211 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 18 Jun 2003 19:56:13 +0000 Subject: Finished the bulk of changes for gnupg 1.9. This included switching to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works. --- g10/textfilter.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'g10/textfilter.c') diff --git a/g10/textfilter.c b/g10/textfilter.c index 6f3fe1bbf..a3ea4b138 100644 --- a/g10/textfilter.c +++ b/g10/textfilter.c @@ -25,6 +25,7 @@ #include #include +#include "gpg.h" #include "errors.h" #include "iobuf.h" #include "memory.h" @@ -71,7 +72,7 @@ len_without_trailing_ws( byte *line, unsigned len ) static int -standard( text_filter_context_t *tfx, IOBUF a, +standard( text_filter_context_t *tfx, iobuf_t a, byte *buf, size_t size, size_t *ret_len) { int rc=0; @@ -120,7 +121,7 @@ standard( text_filter_context_t *tfx, IOBUF a, */ int text_filter( void *opaque, int control, - IOBUF a, byte *buf, size_t *ret_len) + iobuf_t a, byte *buf, size_t *ret_len) { size_t size = *ret_len; text_filter_context_t *tfx = opaque; @@ -133,7 +134,7 @@ text_filter( void *opaque, int control, if( tfx->truncated ) log_error(_("can't handle text lines longer than %d characters\n"), MAX_LINELEN ); - m_free( tfx->buffer ); + xfree ( tfx->buffer ); tfx->buffer = NULL; } else if( control == IOBUFCTRL_DESC ) @@ -147,7 +148,7 @@ text_filter( void *opaque, int control, * md is updated as required by rfc2440 */ int -copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, +copy_clearsig_text( iobuf_t out, iobuf_t inp, MD_HANDLE md, int escape_dash, int escape_from, int pgp2mode ) { unsigned maxlen; @@ -175,15 +176,15 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, /* update the message digest */ if( escape_dash ) { if( pending_lf ) { - md_putc( md, '\r' ); - md_putc( md, '\n' ); + gcry_md_putc( md, '\r' ); + gcry_md_putc( md, '\n' ); } - md_write( md, buffer, + gcry_md_write( md, buffer, len_without_trailing_chars( buffer, n, pgp2mode? " \r\n":" \t\r\n")); } else - md_write( md, buffer, n ); + gcry_md_write( md, buffer, n ); pending_lf = buffer[n-1] == '\n'; /* write the output */ @@ -224,7 +225,7 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md, if( !pending_lf ) { /* make sure that the file ends with a LF */ iobuf_writestr( out, LF ); if( !escape_dash ) - md_putc( md, '\n' ); + gcry_md_putc( md, '\n' ); } if( truncated ) -- cgit v1.2.3