mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +09:00
base64: Reformat
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
committed by
Sahana Prasad
parent
8ed9f5e69b
commit
9ddde3803e
16
src/base64.c
16
src/base64.c
@@ -57,11 +57,12 @@ static int get_equals(char *string);
|
||||
* @returns A buffer containing the decoded string, NULL if something went
|
||||
* wrong (e.g. incorrect char).
|
||||
*/
|
||||
ssh_buffer base64_to_bin(const char *source) {
|
||||
ssh_buffer base64_to_bin(const char *source)
|
||||
{
|
||||
ssh_buffer buffer = NULL;
|
||||
unsigned char block[3];
|
||||
char *base64;
|
||||
char *ptr;
|
||||
char *base64 = NULL;
|
||||
char *ptr = NULL;
|
||||
size_t len;
|
||||
int equals;
|
||||
|
||||
@@ -179,7 +180,8 @@ error:
|
||||
} while(0)
|
||||
|
||||
/* Returns 0 if ok, -1 if not (ie invalid char into the stuff) */
|
||||
static int to_block4(unsigned long *block, const char *source, int num) {
|
||||
static int to_block4(unsigned long *block, const char *source, int num)
|
||||
{
|
||||
const char *ptr = NULL;
|
||||
unsigned int i;
|
||||
|
||||
@@ -207,7 +209,8 @@ 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], const char *source, int num) {
|
||||
static int _base64_to_bin(unsigned char dest[3], const char *source, int num)
|
||||
{
|
||||
unsigned long block;
|
||||
|
||||
if (to_block4(&block, source, num) < 0) {
|
||||
@@ -221,7 +224,8 @@ static int _base64_to_bin(unsigned char dest[3], const char *source, int num) {
|
||||
}
|
||||
|
||||
/* Count the number of "=" signs and replace them by zeroes */
|
||||
static int get_equals(char *string) {
|
||||
static int get_equals(char *string)
|
||||
{
|
||||
char *ptr = string;
|
||||
int num = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user