/* convert 4 base64 bytes to 3 normal bytes */
v=*save;
i=*state;
- inptr = (const guchar *)in;
+
last[0] = last[1] = 0;
+
+ /* we use the sign in the state to determine if we got a padding character
+ in the previous sequence */
+ if (i < 0)
+ {
+ i = -i;
+ last[0] = '=';
+ }
+
+ inptr = (const guchar *)in;
while (inptr < inend)
{
c = *inptr++;
}
*save = v;
- *state = i;
+ *state = last[0] == '=' ? -i : i;
return outptr - out;
}
g_test_add_func ("/base64/decode-inplace", test_base64_decode_inplace);
g_test_add_func ("/base64/encode-decode", test_base64_encode_decode);
- /*
g_test_add_data_func ("/base64/incremental/smallblock/1", GINT_TO_POINTER(1),
test_base64_decode_smallblock);
g_test_add_data_func ("/base64/incremental/smallblock/2", GINT_TO_POINTER(2),
test_base64_decode_smallblock);
g_test_add_data_func ("/base64/incremental/smallblock/3", GINT_TO_POINTER(3),
test_base64_decode_smallblock);
- */
g_test_add_data_func ("/base64/incremental/smallblock/4", GINT_TO_POINTER(4),
test_base64_decode_smallblock);