aboutsummaryrefslogtreecommitdiff
path: root/src/base64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/base64.cpp')
-rw-r--r--src/base64.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/base64.cpp b/src/base64.cpp
index c9a6b59..be5fe8d 100644
--- a/src/base64.cpp
+++ b/src/base64.cpp
@@ -1,5 +1,7 @@
1#include "bu/base64.h" 1#include "bu/base64.h"
2 2
3namespace Bu { subExceptionDef( Base64Exception ) }
4
3const char Bu::Base64::tblEnc[65] = { 5const char Bu::Base64::tblEnc[65] = {
4 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 6 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
5}; 7};
@@ -106,7 +108,15 @@ size_t Bu::Base64::read( void *pBuf, size_t nBytes )
106 for( int j = 0; j < 4; j++ ) 108 for( int j = 0; j < 4; j++ )
107 { 109 {
108 if( rNext.read( &buf[j], 1 ) == 0 ) 110 if( rNext.read( &buf[j], 1 ) == 0 )
111 {
112 if( rNext.isEOS() )
113 {
114 iChars = 0;
115 bEosIn = true;
116 throw Base64Exception("Premature end of stream detected while decoding Base64 data.");
117 }
109 return sIn; 118 return sIn;
119 }
110 if( buf[j] == ' ' || buf[j] == '\t' || 120 if( buf[j] == ' ' || buf[j] == '\t' ||
111 buf[j] == '\n' || buf[j] == '\r' ) 121 buf[j] == '\n' || buf[j] == '\r' )
112 { 122 {