X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/409a7ba772648e08302956e9bf37e04015d1bb0e..2fb5a4ce6348933b32ea709eae93a9f55809a092:/src/common/uri.cpp diff --git a/src/common/uri.cpp b/src/common/uri.cpp index 0d181449c1..584eaf37e1 100644 --- a/src/common/uri.cpp +++ b/src/common/uri.cpp @@ -117,7 +117,8 @@ wxChar wxURI::TranslateEscape(const wxChar* s) { wxASSERT_MSG(IsHex(*s) && IsHex(*(s+1)), wxT("Invalid escape!")); - return CharToHex(*s) * 0x10 + CharToHex(*++s); + //<<4 == 16 + return ( CharToHex(*s) << 4 ) | CharToHex(*++s); } wxString wxURI::Unescape(const wxString& uri) @@ -131,6 +132,8 @@ wxString wxURI::Unescape(const wxString& uri) new_uri += wxURI::TranslateEscape( &(uri.c_str()[i+1]) ); i += 2; } + else + new_uri += uri[i]; } return new_uri; @@ -1152,9 +1155,9 @@ bool wxURI::ParseIPvFuture(const wxChar*& uri) //static wxChar wxURI::CharToHex(const wxChar& c) { - if ((c >= wxT('A')) && (c <= wxT('Z'))) return c - wxT('A') + 0x0A; - if ((c >= wxT('a')) && (c <= wxT('z'))) return c - wxT('a') + 0x0a; - if ((c >= wxT('0')) && (c <= wxT('9'))) return c - wxT('0') + 0x00; + if ((c >= wxT('A')) && (c <= wxT('Z'))) return wxChar(c - wxT('A') + 0x0A); + if ((c >= wxT('a')) && (c <= wxT('z'))) return wxChar(c - wxT('a') + 0x0a); + if ((c >= wxT('0')) && (c <= wxT('9'))) return wxChar(c - wxT('0') + 0x00); return 0; }