X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/846978d7278b1b40102e2068d85236492ea6b82f..82a16d7e5e5c83e95a4caa7314de2dbfbd1debdc:/src/common/uri.cpp diff --git a/src/common/uri.cpp b/src/common/uri.cpp index d58c572fb9..f7351a56ac 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 (wxChar)( CharToHex(*s) * 0x10 + CharToHex(*++s) ); + //<<4 == 16 + return (wxChar)( 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; @@ -464,26 +467,28 @@ const wxChar* wxURI::ParseServer(const wxChar* uri) // IP-literal = "[" ( IPv6address / IPvFuture ) "]" if (*uri == wxT('[')) { - if (ParseIPv6address(++uri) && *uri == wxT(']')) + ++uri; //some compilers don't support *&ing a ++* + if (ParseIPv6address(uri) && *uri == wxT(']')) { ++uri; m_hostType = wxURI_IPV6ADDRESS; wxStringBufferLength theBuffer(m_server, uri - uricopy); - wxMemcpy(theBuffer, uricopy, uri-uricopy); + wxTmemcpy(theBuffer, uricopy, uri-uricopy); theBuffer.SetLength(uri-uricopy); } else { uri = uricopy; - if (ParseIPvFuture(++uri) && *uri == wxT(']')) + ++uri; //some compilers don't support *&ing a ++* + if (ParseIPvFuture(uri) && *uri == wxT(']')) { ++uri; m_hostType = wxURI_IPVFUTURE; wxStringBufferLength theBuffer(m_server, uri - uricopy); - wxMemcpy(theBuffer, uricopy, uri-uricopy); + wxTmemcpy(theBuffer, uricopy, uri-uricopy); theBuffer.SetLength(uri-uricopy); } else @@ -497,7 +502,7 @@ const wxChar* wxURI::ParseServer(const wxChar* uri) m_hostType = wxURI_IPV4ADDRESS; wxStringBufferLength theBuffer(m_server, uri - uricopy); - wxMemcpy(theBuffer, uricopy, uri-uricopy); + wxTmemcpy(theBuffer, uricopy, uri-uricopy); theBuffer.SetLength(uri-uricopy); } else @@ -591,7 +596,7 @@ const wxChar* wxURI::ParsePath(const wxChar* uri, bool bReference, bool bNormali { wxStringBufferLength theBuffer(m_path, m_path.length() + 1); #if wxUSE_STL - wxMemcpy(theBuffer, m_path.c_str(), m_path.length()+1); + wxTmemcpy(theBuffer, m_path.c_str(), m_path.length()+1); #endif Normalize(theBuffer, true); theBuffer.SetLength(wxStrlen(theBuffer)); @@ -631,7 +636,7 @@ const wxChar* wxURI::ParsePath(const wxChar* uri, bool bReference, bool bNormali { wxStringBufferLength theBuffer(m_path, m_path.length() + 1); #if wxUSE_STL - wxMemcpy(theBuffer, m_path.c_str(), m_path.length()+1); + wxTmemcpy(theBuffer, m_path.c_str(), m_path.length()+1); #endif Normalize(theBuffer); theBuffer.SetLength(wxStrlen(theBuffer)); @@ -1150,11 +1155,11 @@ bool wxURI::ParseIPvFuture(const wxChar*& uri) // --------------------------------------------------------------------------- //static -wxInt32 wxURI::CharToHex(const wxChar& c) +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; }