fix base64 computation for strings whose length modulo 3 is 2 (patch 1665520; bug 1661616) [backport from HEAD]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-07 23:07:17 +00:00
parent 8059fb2713
commit bebb6b2f05
2 changed files with 2 additions and 1 deletions

View File

@@ -107,6 +107,7 @@ All:
- Implemented background colour in wxRichTextCtrl.
- Fixed crashes in helpview when opening a file.
- Fixed detection of number of processors under Linux 2.6
- Fixed Base64 computation in wxHTTP (p_michalczyk)
wxMSW

View File

@@ -139,7 +139,7 @@ wxString wxHTTP::GenerateAuthString(const wxString& user, const wxString& pass)
if (len == 1) {
buf << wxString::Format(wxT("%c="), base64[(from[0] << 4) & 0x30]);
} else {
buf << wxString::Format(wxT("%c%c"), base64[(from[0] << 4) & 0x30] + ((from[1] >> 4) & 0xf), base64[(from[1] << 2) & 0x3c]);
buf << wxString::Format(wxT("%c%c"), base64[((from[0] << 4) & 0x30) | ((from[1] >> 4) & 0xf)], base64[(from[1] << 2) & 0x3c]);
}
buf << wxString::Format(wxT("="));
}