Improve _base64_to_bin().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@737 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-05-05 09:03:07 +00:00
parent cc2df5487a
commit 5708fe1729

View File

@@ -200,14 +200,17 @@ static int to_block4(unsigned long *block, const char *source, int num) {
}
/* num = numbers of final bytes to be decoded */
static int _base64_to_bin(unsigned char dest[3], char *source,int num){
unsigned long block;
if(to_block4(&block,source,num))
return -1;
dest[0]=GET_A(block);
dest[1]=GET_B(block);
dest[2]=GET_C(block);
return 0;
static int _base64_to_bin(unsigned char dest[3], const char *source, int num) {
unsigned long block;
if (to_block4(&block, source, num) < 0) {
return -1;
}
dest[0] = GET_A(block);
dest[1] = GET_B(block);
dest[2] = GET_C(block);
return 0;
}
/* counts the number of "=" signs, and replace them by zeroes */