mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-12 03:00:26 +09:00
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:
@@ -200,13 +200,16 @@ static int to_block4(unsigned long *block, const char *source, int num) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* num = numbers of final bytes to be decoded */
|
/* num = numbers of final bytes to be decoded */
|
||||||
static int _base64_to_bin(unsigned char dest[3], char *source,int num){
|
static int _base64_to_bin(unsigned char dest[3], const char *source, int num) {
|
||||||
unsigned long block;
|
unsigned long block;
|
||||||
if(to_block4(&block,source,num))
|
|
||||||
|
if (to_block4(&block, source, num) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
dest[0]=GET_A(block);
|
}
|
||||||
dest[1]=GET_B(block);
|
dest[0] = GET_A(block);
|
||||||
dest[2]=GET_C(block);
|
dest[1] = GET_B(block);
|
||||||
|
dest[2] = GET_C(block);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user