From e7e498efd9b2eb57a762ed26905271377a47659d Mon Sep 17 00:00:00 2001 From: Jordan Cristiano Date: Fri, 19 Jun 2015 19:36:13 -0400 Subject: [PATCH] Removed encode/decode helper structs --- external/libb64-1.2.1/include/b64/decode.h | 50 ------------------- external/libb64-1.2.1/include/b64/encode.h | 57 ---------------------- 2 files changed, 107 deletions(-) diff --git a/external/libb64-1.2.1/include/b64/decode.h b/external/libb64-1.2.1/include/b64/decode.h index 12b16ea..9fafa49 100644 --- a/external/libb64-1.2.1/include/b64/decode.h +++ b/external/libb64-1.2.1/include/b64/decode.h @@ -8,63 +8,13 @@ For details, see http://sourceforge.net/projects/libb64 #ifndef BASE64_DECODE_H #define BASE64_DECODE_H -#include - namespace base64 { extern "C" { #include "cdecode.h" } - - struct decoder - { - base64_decodestate _state; - int _buffersize; - - decoder(int buffersize_in = BUFFERSIZE) - : _buffersize(buffersize_in) - {} - - int decode(char value_in) - { - return base64_decode_value(value_in); - } - - int decode(const char* code_in, const int length_in, char* plaintext_out) - { - return base64_decode_block(code_in, length_in, plaintext_out, &_state); - } - - void decode(std::istream& istream_in, std::ostream& ostream_in) - { - base64_init_decodestate(&_state); - // - const int N = _buffersize; - char* code = new char[N]; - char* plaintext = new char[N]; - int codelength; - int plainlength; - - do - { - istream_in.read((char*)code, N); - codelength = istream_in.gcount(); - plainlength = decode(code, codelength, plaintext); - ostream_in.write((const char*)plaintext, plainlength); - } - while (istream_in.good() && codelength > 0); - // - base64_init_decodestate(&_state); - - delete [] code; - delete [] plaintext; - } - }; - } // namespace base64 - - #endif // BASE64_DECODE_H diff --git a/external/libb64-1.2.1/include/b64/encode.h b/external/libb64-1.2.1/include/b64/encode.h index 5d807d9..b2bc6a7 100644 --- a/external/libb64-1.2.1/include/b64/encode.h +++ b/external/libb64-1.2.1/include/b64/encode.h @@ -8,69 +8,12 @@ For details, see http://sourceforge.net/projects/libb64 #ifndef BASE64_ENCODE_H #define BASE64_ENCODE_H -#include - namespace base64 { extern "C" { #include "cencode.h" } - - struct encoder - { - base64_encodestate _state; - int _buffersize; - - encoder(int buffersize_in = BUFFERSIZE) - : _buffersize(buffersize_in) - {} - - int encode(char value_in) - { - return base64_encode_value(value_in); - } - - int encode(const char* code_in, const int length_in, char* plaintext_out) - { - return base64_encode_block(code_in, length_in, plaintext_out, &_state); - } - - int encode_end(char* plaintext_out) - { - return base64_encode_blockend(plaintext_out, &_state); - } - - void encode(std::istream& istream_in, std::ostream& ostream_in) - { - base64_init_encodestate(&_state); - // - const int N = _buffersize; - char* plaintext = new char[N]; - char* code = new char[2*N]; - int plainlength; - int codelength; - - do - { - istream_in.read(plaintext, N); - plainlength = istream_in.gcount(); - // - codelength = encode(plaintext, plainlength, code); - ostream_in.write(code, codelength); - } - while (istream_in.good() && plainlength > 0); - - codelength = encode_end(code); - ostream_in.write(code, codelength); - // - base64_init_encodestate(&_state); - - delete [] code; - delete [] plaintext; - } - }; - } // namespace base64 #endif // BASE64_ENCODE_H