Adding upstream version 2.5.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
7819359ae2
commit
acf5b2ec4c
507 changed files with 19440 additions and 17258 deletions
|
@ -81,24 +81,24 @@ int base64_decode(const char *src, int srclen, unsigned char *dst)
|
|||
int i, bits = 0;
|
||||
unsigned char *bp = dst;
|
||||
|
||||
for (i = 0; i < srclen; i++) {
|
||||
const char *p = strchr(base64_table, src[i]);
|
||||
for (i = 0; i < srclen; i++) {
|
||||
const char *p = strchr(base64_table, src[i]);
|
||||
|
||||
if (src[i] == '=') {
|
||||
ac = (ac << 6);
|
||||
if (src[i] == '=') {
|
||||
ac = (ac << 6);
|
||||
bits += 6;
|
||||
if (bits >= 8)
|
||||
bits -= 8;
|
||||
continue;
|
||||
}
|
||||
if (p == NULL || src[i] == 0)
|
||||
return -EINVAL;
|
||||
ac = (ac << 6) | (p - base64_table);
|
||||
bits += 6;
|
||||
if (bits >= 8) {
|
||||
bits -= 8;
|
||||
*bp++ = (unsigned char)(ac >> bits);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!p || !src[i])
|
||||
return -EINVAL;
|
||||
ac = (ac << 6) | (p - base64_table);
|
||||
bits += 6;
|
||||
if (bits >= 8) {
|
||||
bits -= 8;
|
||||
*bp++ = (unsigned char)(ac >> bits);
|
||||
}
|
||||
}
|
||||
if (ac && ((1 << bits) - 1))
|
||||
return -EAGAIN;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue