[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenetwork/libkdenetwork
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2002-12-16 10:40:57
[Download RAW message or body]

CVS commit by mutz: 

fix encoding of trailing whitespace at the end of a buffer that doesn't end in newline


  M +12 -5     kmime_codec_qp.cpp   1.9


--- kdenetwork/libkdenetwork/kmime_codec_qp.cpp  #1.8:1.9
@@ -78,4 +78,10 @@ protected:
     return ( ch > '~' || ch < ' ' && ch != '\t' || ch == '=' );
   }
+  bool needsEncodingAtEOL( uchar ch ) {
+    return ( ch == ' ' || ch == '\t' );
+  }
+  bool needsEncodingAtBOL( uchar ch ) {
+    return ( ch == 'F' || ch == '.' || ch == '-' );
+  }
   bool fillInputBuffer( const char* & scursor, const char * const send );
   bool processNextChar();
@@ -393,10 +399,11 @@ bool QuotedPrintableEncoder::processNext
   // Real processing goes here:
   mAccu = mInputBuffer[ mInputBufferReadCursor++ ];
-  if ( needsEncoding( mAccu ) || // always needs encoding or
-       mSawLineEnd && bufferFill == 1 // needs encoding at end of line
-       && ( mAccu == ' ' || mAccu == '\t' ) )
+  if ( needsEncoding( mAccu ) ) // always needs encoding or
     mAccuNeedsEncoding = Definitely;
-  else if ( mAccu == '-' || mAccu == 'F' || mAccu == '.' )
-    // needs encoding at beginning of line
+  else if ( ( mSawLineEnd || mFinishing )  // needs encoding at end of line
+            && bufferFill == 1             // or end of buffer
+            && needsEncodingAtEOL( mAccu ) )
+    mAccuNeedsEncoding = Definitely;
+  else if ( needsEncodingAtBOL( mAccu ) )
     mAccuNeedsEncoding = AtBOL;
   else


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic