fix base64 computation for strings whose length modulo 3 is 2 (patch 1665520; bug 1661616)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-03-07 23:07:16 +00:00
parent ccc8c01a11
commit 886f61cacb
2 changed files with 2 additions and 1 deletions

View File

@ -63,6 +63,7 @@ All:
- Added wxCONFIG_USE_SUBDIR flag to wxFileConfig (Giuseppe Bilotta).
- Added wxSearchCtrl::[Get|Set]DescriptiveText.
- 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("="));
}