# --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/kde31/kdenetwork31/kmime_codec_qp.cpp.patch # ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # --- ROCK-COPYRIGHT-NOTE-END --- Use of tainted arguments in exec is deprecated at /var/www/cgi-bin/cvsweb.cgi line 2043. =================================================================== RCS file: /home2/webcvs/mirror/kdepim/libkdenetwork/kmime_codec_qp.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -p -r1.12 -r1.13 --- kdepim/libkdenetwork/kmime_codec_qp.cpp 2003/07/26 14:51:52 1.12 +++ kdepim/libkdenetwork/kmime_codec_qp.cpp 2003/10/30 14:15:30 1.13 @@ -189,6 +189,20 @@ public: bool finish( char* & dcursor, const char * const dend ); }; +// this doesn't access any member variables, so it can be defined static +// but then we can't call it from virtual functions +static int QuotedPrintableDecoder_maxDecodedSizeFor( int insize, bool withCRLF ) { + // all chars unencoded: + int result = insize; + // but maybe all of them are \n and we need to make them \r\n :-o + if ( withCRLF ) + result += insize; + + // there might be an accu plus escape + result += 2; + + return result; +} Encoder * QuotedPrintableCodec::makeEncoder( bool withCRLF ) const { return new QuotedPrintableEncoder( withCRLF ); @@ -198,6 +212,10 @@ Decoder * QuotedPrintableCodec::makeDeco return new QuotedPrintableDecoder( withCRLF ); } +int QuotedPrintableCodec::maxDecodedSizeFor( int insize, bool withCRLF ) const { + return QuotedPrintableDecoder_maxDecodedSizeFor(insize, withCRLF); +} + Encoder * Rfc2047QEncodingCodec::makeEncoder( bool withCRLF ) const { return new Rfc2047QEncodingEncoder( withCRLF ); } @@ -206,6 +224,10 @@ Decoder * Rfc2047QEncodingCodec::makeDec return new QuotedPrintableDecoder( withCRLF, true ); } +int Rfc2047QEncodingCodec::maxDecodedSizeFor( int insize, bool withCRLF ) const { + return QuotedPrintableDecoder_maxDecodedSizeFor(insize, withCRLF); +} + Encoder * Rfc2231EncodingCodec::makeEncoder( bool withCRLF ) const { return new Rfc2047QEncodingEncoder( withCRLF, '%' ); } @@ -214,12 +236,14 @@ Decoder * Rfc2231EncodingCodec::makeDeco return new QuotedPrintableDecoder( withCRLF, true, '%' ); } +int Rfc2231EncodingCodec::maxDecodedSizeFor( int insize, bool withCRLF ) const { + return QuotedPrintableDecoder_maxDecodedSizeFor(insize, withCRLF); +} /********************************************************/ /********************************************************/ /********************************************************/ - bool QuotedPrintableDecoder::decode( const char* & scursor, const char * const send, char* & dcursor, const char * const dend ) { if ( mWithCRLF ) @@ -402,7 +426,7 @@ bool QuotedPrintableEncoder::processNext bufferFill += 16; assert( bufferFill >=0 && bufferFill <= 15 ); - + if ( !mFinishing && !mSawLineEnd && bufferFill < minBufferFillWithoutLineEnd ) return false; @@ -424,7 +448,7 @@ bool QuotedPrintableEncoder::processNext else // never needs encoding mAccuNeedsEncoding = Never; - + return true; } @@ -485,7 +509,7 @@ bool QuotedPrintableEncoder::encode( con // fill input buffer until eol has been reached or until the // buffer is full, whatever comes first: fillInputBuffer( scursor, send ); - + if ( processNextChar() ) // there was one... createOutputBuffer( dcursor, dend ); @@ -506,7 +530,7 @@ bool QuotedPrintableEncoder::encode( con if ( mOutputBufferCursor ) flushOutputBuffer( dcursor, dend ); return (scursor == send); - + } // encode bool QuotedPrintableEncoder::finish( char* & dcursor,