2007-12-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Removed unnecessary string copy. Updated doc and corrected indentation.
	* src/Base64.cc
	
	* Release 0.12.0
pull/1/head
Tatsuhiro Tsujikawa 2007-12-08 16:55:44 +00:00
parent 059406ae50
commit 2fe11ac548
3 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,8 @@
2007-12-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Removed unnecessary string copy. Updated doc and corrected indentation.
* src/Base64.cc
* Release 0.12.0
2007-12-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

View File

@ -117,11 +117,8 @@ void Base64::removeNonBase64Chars(unsigned char*& nsrc,
*(temp+n++) = *s;
}
}
unsigned char* ret = new unsigned char[n];
memcpy(ret, temp, n);
delete [] temp;
nlength = n;
nsrc = ret;
nsrc = temp;
}
void Base64::decode(unsigned char*& result, size_t& rlength,

View File

@ -41,6 +41,11 @@ using namespace std;
class Base64
{
private:
/**
* Removes non base64 chars(including '=') from src, and results are
* stored in nsrc and its length is stored in nlength.
* Caller must delete nsrc.
*/
static void removeNonBase64Chars(unsigned char*& nsrc, size_t& nlength,
const unsigned char* src, size_t slength);