Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base64: fix assignment to wrong type #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ccan/base64/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ size_t base64_decoded_length(size_t srclen)
return ((srclen+3)/4*3);
}

int base64_decode_quartet_using_maps(const base64_maps_t *maps, char dest[3],
ssize_t base64_decode_quartet_using_maps(const base64_maps_t *maps, char dest[3],
const char src[4])
{
signed char a;
Expand All @@ -143,7 +143,7 @@ int base64_decode_quartet_using_maps(const base64_maps_t *maps, char dest[3],
}


int base64_decode_tail_using_maps(const base64_maps_t *maps, char dest[3],
ssize_t base64_decode_tail_using_maps(const base64_maps_t *maps, char dest[3],
const char * src, const size_t srclen)
{
char longsrc[4];
Expand Down Expand Up @@ -178,7 +178,7 @@ ssize_t base64_decode_using_maps(const base64_maps_t *maps,
{
ssize_t dest_offset = 0;
ssize_t i;
size_t more;
ssize_t more;

if (destlen < base64_decoded_length(srclen)) {
errno = EOVERFLOW;
Expand Down
10 changes: 5 additions & 5 deletions ccan/base64/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ ssize_t base64_decode_using_maps(const base64_maps_t *maps,
* @return Number of decoded bytes set in dest. -1 on error (and errno set)
* @note sets errno = EDOM if src contains invalid characters
*/
int base64_decode_quartet_using_maps(const base64_maps_t *maps,
char dest[3], const char src[4]);
ssize_t base64_decode_quartet_using_maps(const base64_maps_t *maps,
char dest[3], const char src[4]);

/**
* base64_decode_tail_using_maps - decode the final bytes of a base64 string using a specific alphabet
Expand All @@ -116,8 +116,8 @@ int base64_decode_quartet_using_maps(const base64_maps_t *maps,
* @note sets errno = EDOM if src contains invalid characters
* @note sets errno = EINVAL if src is an invalid base64 tail
*/
int base64_decode_tail_using_maps(const base64_maps_t *maps, char *dest,
const char *src, size_t srclen);
ssize_t base64_decode_tail_using_maps(const base64_maps_t *maps, char *dest,
const char *src, size_t srclen);


/* the rfc4648 functions: */
Expand Down Expand Up @@ -212,7 +212,7 @@ ssize_t base64_decode(char *dest, size_t destlen,
* @note sets errno = EDOM if src contains invalid characters
*/
static inline
int base64_decode_quartet(char dest[3], const char src[4])
ssize_t base64_decode_quartet(char dest[3], const char src[4])
{
return base64_decode_quartet_using_maps(&base64_maps_rfc4648,
dest, src);
Expand Down