diff options
author | maximius <none@none> | 2009-10-17 15:35:07 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-10-17 15:35:07 -0700 |
commit | 26b5e033ffde3d161382fc9addbfa99738379641 (patch) | |
tree | a344f369ca32945f787a02dee35c3dbe342bed7e /dep/src/sockets/Base64.cpp | |
parent | f21f47005dcb6b76e1abc9f35fbcd03eed191bff (diff) |
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget
--HG--
branch : trunk
Diffstat (limited to 'dep/src/sockets/Base64.cpp')
-rw-r--r-- | dep/src/sockets/Base64.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/dep/src/sockets/Base64.cpp b/dep/src/sockets/Base64.cpp index cb66b93af6f..a6a6992798c 100644 --- a/dep/src/sockets/Base64.cpp +++ b/dep/src/sockets/Base64.cpp @@ -4,42 +4,34 @@ **/ /* Copyright (C) 2004-2007 Anders Hedstrom - This library is made available under the terms of the GNU GPL. - If you would like to use this library in a closed-source application, a separate license agreement is available. For information about the closed-source license agreement for the C++ sockets library, please visit http://www.alhem.net/Sockets/license.html and/or email license@alhem.net. - This program is free software; you can redistribute it and/or modify it 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. - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "Base64.h" - #ifdef SOCKETS_NAMESPACE namespace SOCKETS_NAMESPACE { #endif - const char *Base64::bstr = "ABCDEFGHIJKLMNOPQ" "RSTUVWXYZabcdefgh" "ijklmnopqrstuvwxy" "z0123456789+/"; - const char Base64::rstr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -50,19 +42,16 @@ const char Base64::rstr[] = { 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0}; - Base64::Base64() { } - void Base64::encode(FILE *fil, std::string& output, bool add_crlf) { size_t remain; size_t i = 0; size_t o = 0; char input[4]; - output = ""; remain = fread(input,1,3,fil); while (remain > 0) @@ -94,18 +83,15 @@ void Base64::encode(FILE *fil, std::string& output, bool add_crlf) } } - void Base64::encode(const std::string& str_in, std::string& str_out, bool add_crlf) { encode(str_in.c_str(), str_in.size(), str_out, add_crlf); } - void Base64::encode(const char* input,size_t l,std::string& output, bool add_crlf) { size_t i = 0; size_t o = 0; - output = ""; while (i < l) { @@ -136,12 +122,10 @@ void Base64::encode(const char* input,size_t l,std::string& output, bool add_crl } } - void Base64::encode(const unsigned char* input,size_t l,std::string& output,bool add_crlf) { size_t i = 0; size_t o = 0; - output = ""; while (i < l) { @@ -172,12 +156,10 @@ void Base64::encode(const unsigned char* input,size_t l,std::string& output,bool } } - void Base64::decode(const std::string& input,std::string& output) { size_t i = 0; size_t l = input.size(); - output = ""; while (i < l) { @@ -205,13 +187,11 @@ void Base64::decode(const std::string& input,std::string& output) } } - void Base64::decode(const std::string& input, unsigned char *output, size_t& sz) { size_t i = 0; size_t l = input.size(); size_t j = 0; - while (i < l) { while (i < l && (input[i] == 13 || input[i] == 10)) @@ -251,7 +231,6 @@ void Base64::decode(const std::string& input, unsigned char *output, size_t& sz) sz = j; } - size_t Base64::decode_length(const std::string& str64) { if (str64.empty() || str64.size() % 4) @@ -264,10 +243,8 @@ size_t Base64::decode_length(const std::string& str64) return l; } - #ifdef SOCKETS_NAMESPACE } #endif - |