@@ -176,7 +176,7 @@ base64 (unsigned int i)
i = 62; \
else if (ch == ',') \
i = 63; \
- else \
+ else if (ch == '-') \
{ \
/* Terminate base64 encoding. */ \
\
@@ -188,12 +188,14 @@ base64 (unsigned int i)
STANDARD_FROM_LOOP_ERR_HANDLER ((statep->__count = 0, 1)); \
} \
\
- if (ch == '-') \
- inptr++; \
+ inptr++; \
\
statep->__count = 0; \
continue; \
} \
+ else \
+ STANDARD_FROM_LOOP_ERR_HANDLER ((statep->__count = 0, 1)); \
+ /* Terminating '-' is required */ \
\
/* Concatenate the base64 integer i to the accumulator. */ \
shift = (statep->__count >> 3); \
@@ -354,8 +356,7 @@ base64 (unsigned int i)
\
if ((statep->__count & 0x18) >= 0x10) \
*outptr++ = base64 ((statep->__count >> 3) & ~3); \
- if (ismbase64 (ch)) \
- *outptr++ = '-'; \
+ *outptr++ = '-'; \
*outptr++ = (unsigned char) ch; \
statep->__count = 0; \
} \