void CBase64::Encode(const PBYTE pBuffer, DWORD nBufLen) { SetDecodeBuffer(pBuffer, nBufLen); AllocEncode(nBufLen * 2); TempBucket Raw; DWORD nIndex = 0; while((nIndex + 3) <= nBufLen) { Raw.Clear(); memcpy(&Raw, m_pDBuffer + nIndex, 3); Raw.nSize = 3; _EncodeToBuffer(Raw, m_pEBuffer + m_nEDataLen); nIndex += 3; m_nEDataLen += 4; } if(nBufLen > nIndex) { Raw.Clear(); Raw.nSize = (BYTE) (nBufLen - nIndex); memcpy(&Raw, m_pDBuffer + nIndex, nBufLen - nIndex); _EncodeToBuffer(Raw, m_pEBuffer + m_nEDataLen); m_nEDataLen += 4; } }
void CBase64::Encode(const unsigned char* pBuffer, unsigned long nBufLen) { SetDecodeBuffer(pBuffer, nBufLen); AllocEncode(nBufLen * 2); TempBucket Raw; unsigned long nIndex = 0; while((nIndex + 3) <= nBufLen) { Raw.Clear(); ::CopyMemory(&Raw, m_pDBuffer + nIndex, 3); Raw.nSize = 3; _EncodeToBuffer(Raw, m_pEBuffer + m_nEDataLen); nIndex += 3; m_nEDataLen += 4; } if(nBufLen > nIndex) { Raw.Clear(); Raw.nSize = (unsigned char) (nBufLen - nIndex); ::CopyMemory(&Raw, m_pDBuffer + nIndex, nBufLen - nIndex); _EncodeToBuffer(Raw, m_pEBuffer + m_nEDataLen); m_nEDataLen += 4; } }
void CBase64::SetEncodeBuffer(const PBYTE pBuffer, DWORD nBufLen) { DWORD i = 0; AllocEncode(nBufLen); while(i < nBufLen) { if (!_IsBadMimeChar(pBuffer[i])) { m_pEBuffer[m_nEDataLen] = pBuffer[i]; m_nEDataLen++; } i++; } }
void CBase64::SetEncodeBuffer(const unsigned char* pBuffer, unsigned long nBufLen) { unsigned long i = 0; AllocEncode(nBufLen); while(i < nBufLen) { if(!_IsBadMimeChar(pBuffer[i])) { m_pEBuffer[m_nEDataLen] = pBuffer[i]; m_nEDataLen++; } i++; } }