mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 06:41:26 +00:00
fix signedness and cleanup
This commit is contained in:
parent
ad184944d0
commit
2127ea784f
28
src/base32.c
28
src/base32.c
|
@ -23,24 +23,6 @@
|
|||
static const char cb32[] =
|
||||
"abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
/*
|
||||
6 2
|
||||
4 4
|
||||
2 6
|
||||
|
||||
3 -> 4
|
||||
*/
|
||||
|
||||
/*
|
||||
q[0]: 5 3
|
||||
q[1]: 2 5 1
|
||||
q[2]: 4 4
|
||||
q[3]: 1 5 2
|
||||
q[4]: 3 5
|
||||
|
||||
5 -> 8
|
||||
*/
|
||||
|
||||
int
|
||||
base32_encode(char **buf, size_t *buflen, const void *data, size_t size)
|
||||
{
|
||||
|
@ -95,14 +77,6 @@ pos(char c)
|
|||
return p - cb32;
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
|
||||
q[0]: 5 3
|
||||
q[1]: 2 5 1
|
||||
q[2]: 4 4
|
||||
q[3]: 1 5 2
|
||||
q[4]: 3 5
|
||||
*/
|
||||
|
||||
static int
|
||||
decode_token(const char *t, char *data)
|
||||
|
@ -170,7 +144,7 @@ base32_decode(void **buf, size_t *buflen, const char *str)
|
|||
|
||||
q = *buf;
|
||||
for (p = str; *p && strchr(cb32, *p); p += 8) {
|
||||
len = decode_token(p, q);
|
||||
len = decode_token(p, (char *) q);
|
||||
q += len;
|
||||
|
||||
if (len < 5)
|
||||
|
|
Loading…
Reference in a new issue