From 8551cdd3bbf66d8b7b0fea8aa1e0fbddd86bca47 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 29 Jul 2009 23:07:47 +0000 Subject: Decoding now skips whitespace sweet. --- src/base64.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/base64.cpp b/src/base64.cpp index b81d028..f6b8cce 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -83,8 +83,18 @@ size_t Bu::Base64::read( void *pBuf, size_t nBytes ) char buf[4]; while( sIn < nBytes ) { - if( rNext.read( buf, 4 ) == 0 ) - return sIn; + //if( rNext.read( buf, 4 ) == 0 ) + // return sIn; + for( int j = 0; j < 4; j++ ) + { + if( rNext.read( &buf[j], 1 ) == 0 ) + return sIn; + if( buf[j] == ' ' || buf[j] == '\t' || + buf[j] == '\n' || buf[j] == '\r' ) + { + j--; + } + } int iChars = 3; for( int j = 0; j < 4; j++ ) { -- cgit v1.2.3