diff options
author | Werner Koch <[email protected]> | 2004-09-09 12:42:10 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2004-09-09 12:42:10 +0000 |
commit | 87e3264f77df4b2bdf976f066e82627f01b56732 (patch) | |
tree | a86d1a810efde12d886b141741937d6d60d7f0f6 | |
parent | (generate_photo_id): Use tty_printf and not just (diff) | |
download | gnupg-87e3264f77df4b2bdf976f066e82627f01b56732.tar.gz gnupg-87e3264f77df4b2bdf976f066e82627f01b56732.zip |
* photoid.c: Include ttyio.h.
* parse-packet.c (skip_rest): Removed. Changed all callers to use
the new iobuf_skip_reset. Orginal patch by Florian Weimer.
* iobuf.c (iobuf_skip_rest): New. Orginal patch by Florian
Weimer. Added new argument PARTIAL.
-rw-r--r-- | AUTHORS | 20 | ||||
-rw-r--r-- | g10/ChangeLog | 7 | ||||
-rw-r--r-- | g10/parse-packet.c | 37 | ||||
-rw-r--r-- | g10/photoid.c | 1 | ||||
-rw-r--r-- | include/iobuf.h | 3 | ||||
-rw-r--r-- | util/ChangeLog | 5 | ||||
-rw-r--r-- | util/iobuf.c | 37 |
7 files changed, 75 insertions, 35 deletions
@@ -11,7 +11,7 @@ Birger Langkjer <[email protected]> Translations [da] Daniel Resare <[email protected]> Translations [sv] -David Shaw <[email protected]> Assignment +David Shaw <[email protected]> Assigns past and future changes. (all in keyserver/, a lot of changes in g10/ see the ChangeLog, bug fixes here and there) @@ -20,6 +20,9 @@ Dokianakis Theofanis <[email protected]> Translations [el] Edmund GRIMLEY EVANS <[email protected]> Translations [eo] +Florian Weimer <[email protected]> Assigns past and future changes + (changed:g10/parse-packet.c, include/iobuf.h, util/iobuf.c) + Ga�l Qu�ri <[email protected]> Translations [fr] (fixed a lot of typos) @@ -35,7 +38,7 @@ Janusz Aleksander Urbanowicz <[email protected]> Translations [po] Magda Procha'zkova' <[email protected]> Translations [cs] -Michael Roth <[email protected]> Assignment +Michael Roth <[email protected]> Assigns changes. (wrote cipher/des.c., changes and bug fixes all over the place) Marco d'Itri <[email protected]> Translations [it] @@ -48,7 +51,8 @@ Niklas Hernaeus <[email protected]> Disclaimer Nilgun Belma Buguner <[email protected]> Translations [tr] -Nils Ellmenreich <nils 'at' infosun.fmi.uni-passau.de> Assignment +Nils Ellmenreich <nils 'at' infosun.fmi.uni-passau.de> + Assigns past and future changes (configure.in, cipher/rndlinux.c, FAQ) Paul Eggert <[email protected]> @@ -56,14 +60,14 @@ Paul Eggert <[email protected]> Pedro Morais <[email protected]> Translations [pt_PT] -R�mi Guyomarch <[email protected]> Assignment +R�mi Guyomarch <[email protected]> Assigns past and future changes. (g10/compress.c, g10/encr-data.c, g10/free-packet.c, g10/mdfilter.c, g10/plaintext.c, util/iobuf.c) -Stefan Bellon <[email protected]> Assignment +Stefan Bellon <[email protected]> Assigns past and future changes. (All patches to support RISC OS) -Timo Schulz <[email protected]> Assignment +Timo Schulz <[email protected]> Assigns past and future changes. (util/w32reg.c, g10/passphrase.c, g10/hkp.c) Tedi Heriyanto <[email protected]> Translations [id] @@ -77,7 +81,7 @@ Urko Lusa <[email protected]> Translations [es_ES] Walter Koch <[email protected]> Translations [de] -Werner Koch <[email protected]> Assignment +Werner Koch <[email protected]> Assigns GNU Privacy Guard and future changes. (started the whole thing) Yosiaki IIDA <[email protected]> Translations [ja] @@ -107,7 +111,7 @@ for GnuPG. The RPM specs file scripts/gnupg.spec has been contributed by several people. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/g10/ChangeLog b/g10/ChangeLog index 03b8b39dd..01f956bec 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2004-09-09 Werner Koch <[email protected]> + + * photoid.c: Include ttyio.h. + + * parse-packet.c (skip_rest): Removed. Changed all callers to use + the new iobuf_skip_reset. Orginal patch by Florian Weimer. + 2004-09-07 Werner Koch <[email protected]> * photoid.c (generate_photo_id): Use tty_printf and not just diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 8b3744af1..48035ad5d 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -50,7 +50,6 @@ static int copy_packet( IOBUF inp, IOBUF out, int pkttype, unsigned long pktlen, int partial ); static void skip_packet( IOBUF inp, int pkttype, unsigned long pktlen, int partial ); -static void skip_rest( IOBUF inp, unsigned long pktlen, int partial ); static void *read_rest( IOBUF inp, size_t pktlen, int partial ); static int parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ); @@ -434,7 +433,7 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos, && pkttype != PKT_PUBLIC_KEY && pkttype != PKT_SECRET_SUBKEY && pkttype != PKT_SECRET_KEY ) ) { - skip_rest(inp, pktlen, partial); + iobuf_skip_rest(inp, pktlen, partial); *skip = 1; rc = 0; goto leave; @@ -593,21 +592,7 @@ skip_packet( IOBUF inp, int pkttype, unsigned long pktlen, int partial ) return; } } - skip_rest(inp,pktlen,partial); -} - -static void -skip_rest( IOBUF inp, unsigned long pktlen, int partial ) -{ - if( partial ) { - while( iobuf_get(inp) != -1 ) - ; - } - else { - for( ; pktlen; pktlen-- ) - if( iobuf_get(inp) == -1 ) - break; - } + iobuf_skip_rest(inp,pktlen,partial); } @@ -722,7 +707,7 @@ parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) } leave: - skip_rest(inp, pktlen, 0); + iobuf_skip_rest(inp, pktlen, 0); return rc; } @@ -776,7 +761,7 @@ parse_pubkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) } leave: - skip_rest(inp, pktlen, 0); + iobuf_skip_rest(inp, pktlen, 0); return rc; } @@ -1427,7 +1412,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen, } leave: - skip_rest(inp, pktlen, 0); + iobuf_skip_rest(inp, pktlen, 0); return rc; } @@ -1465,7 +1450,7 @@ parse_onepass_sig( IOBUF inp, int pkttype, unsigned long pktlen, leave: - skip_rest(inp, pktlen, 0); + iobuf_skip_rest(inp, pktlen, 0); return rc; } @@ -1544,7 +1529,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen, } printf("\"\n"); } - skip_rest(inp, pktlen, 0); + iobuf_skip_rest(inp, pktlen, 0); return 0; } else if( version == 4 ) @@ -1876,7 +1861,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen, } leave: - skip_rest(inp, pktlen, 0); + iobuf_skip_rest(inp, pktlen, 0); return rc; } @@ -2111,7 +2096,7 @@ parse_trust( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt ) if( list_mode ) printf(":trust packet: empty\n"); } - skip_rest (inp, pktlen, 0); + iobuf_skip_rest (inp, pktlen, 0); } @@ -2236,7 +2221,7 @@ parse_encrypted( IOBUF inp, int pkttype, unsigned long pktlen, if( orig_pktlen && pktlen < 10 ) { /* actually this is blocksize+2 */ log_error("packet(%d) too short\n", pkttype); rc = G10ERR_INVALID_PACKET; - skip_rest(inp, pktlen, partial); + iobuf_skip_rest(inp, pktlen, partial); goto leave; } if( list_mode ) { @@ -2339,7 +2324,7 @@ parse_gpg_control( IOBUF inp, int pkttype, } putchar('\n'); } - skip_rest(inp,pktlen, 0); + iobuf_skip_rest(inp,pktlen, 0); return G10ERR_INVALID_PACKET; } diff --git a/g10/photoid.c b/g10/photoid.c index aa9607205..876543af3 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -39,6 +39,7 @@ #include "options.h" #include "main.h" #include "photoid.h" +#include "ttyio.h" /* Generate a new photo id packet, or return NULL if canceled */ PKT_user_id *generate_photo_id(PKT_public_key *pk) diff --git a/include/iobuf.h b/include/iobuf.h index dd7c91ca4..413650af8 100644 --- a/include/iobuf.h +++ b/include/iobuf.h @@ -26,7 +26,6 @@ #define DBG_IOBUF iobuf_debug_mode - #define IOBUFCTRL_INIT 1 #define IOBUFCTRL_FREE 2 #define IOBUFCTRL_UNDERFLOW 3 @@ -155,4 +154,6 @@ int iobuf_translate_file_handle ( int fd, int for_write ); #define iobuf_get_temp_length(a) ( (a)->d.len ) #define iobuf_is_temp(a) ( (a)->use == 3 ) +void iobuf_skip_rest (IOBUF a, unsigned long n, int partial); + #endif /*G10_IOBUF_H*/ diff --git a/util/ChangeLog b/util/ChangeLog index 63f73ea18..9b70ca6e1 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2004-09-09 Werner Koch <[email protected]> + + * iobuf.c (iobuf_skip_rest): New. Orginal patch by Florian + Weimer. Added new argument PARTIAL. + 2004-08-19 David Shaw <[email protected]> * http.c (insert_escapes): Fix encoding problem for non-URI-safe diff --git a/util/iobuf.c b/util/iobuf.c index a0fee5bd0..b00188bcf 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -2120,3 +2120,40 @@ translate_file_handle ( int fd, int for_write ) #endif return fd; } + + +void +iobuf_skip_rest(IOBUF a, unsigned long n, int partial) +{ + if ( partial ) { + for (;;) { + if (a->nofast || a->d.start >= a->d.len) { + if (iobuf_readbyte (a) == -1) { + break; + } + } else { + unsigned long count = a->d.len - a->d.start; + a->nbytes += count; + a->d.start = a->d.len; + } + } + } else { + unsigned long remaining = n; + while (remaining > 0) { + if (a->nofast || a->d.start >= a->d.len) { + if (iobuf_readbyte (a) == -1) { + break; + } + --remaining; + } else { + unsigned long count = a->d.len - a->d.start; + if (count > remaining) { + count = remaining; + } + a->nbytes += count; + a->d.start += count; + remaining -= count; + } + } + } +} |