// The size of the output buffer must not be less than
// 3/4 the size of the input buffer. For simplicity,
// make them the same size.
int CQuotedPrintable::Decode(LPCTSTR pSrc, LPTSTR pDst)
{
int nSrcLen;
nSrcLen=strlen(pSrc);
int nDstLen; // 输出的字符计数
int i;
i = 0;
nDstLen = 0;
while (i < nSrcLen)
{
if (strncmp(pSrc, "=\r\n", 3) == 0) // 软回车,跳过
{
pSrc += 3;
i += 3;
}
else
{
if (*pSrc == '=') // 是编码字节
{
sscanf(pSrc, "=%02X", pDst);
pDst++;
pSrc += 3;
i += 3;
}
else // 非编码字节
{
*pDst++ = (unsigned char)*pSrc++;
i++;
}