Fix return value of b64encode().

This commit is contained in:
Guus Sliepen 2014-04-06 22:46:06 +02:00
parent f134bd0c9c
commit d6734a2da4

View file

@ -112,14 +112,14 @@ static int b64encode_internal(const char *src, char *dst, int length, const char
dst[di + 1] = alphabet[triplet & 63]; triplet >>= 6; dst[di + 1] = alphabet[triplet & 63]; triplet >>= 6;
dst[di + 2] = alphabet[triplet]; dst[di + 2] = alphabet[triplet];
dst[di + 3] = 0; dst[di + 3] = 0;
length = di + 2; length = di + 3;
break; break;
case 1: case 1:
triplet = usrc[si]; triplet = usrc[si];
dst[di] = alphabet[triplet & 63]; triplet >>= 6; dst[di] = alphabet[triplet & 63]; triplet >>= 6;
dst[di + 1] = alphabet[triplet]; dst[di + 1] = alphabet[triplet];
dst[di + 2] = 0; dst[di + 2] = 0;
length = di + 1; length = di + 2;
break; break;
default: default:
dst[di] = 0; dst[di] = 0;