Micro optimization in wxInternetFSHandler::OpenFile()
Avoid copying the content type string unnecessarily and avoid even calling GetContentType() in the first place in case of an error.
This commit is contained in:
@@ -105,7 +105,6 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
|
||||
if (url.GetError() == wxURL_NOERR)
|
||||
{
|
||||
wxInputStream *s = url.GetInputStream();
|
||||
wxString content = url.GetProtocol().GetContentType();
|
||||
if (s)
|
||||
{
|
||||
wxString tmpfile =
|
||||
@@ -120,6 +119,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
|
||||
// Content-Type header, as defined by the RFC 2045, has the form of
|
||||
// "type/subtype" optionally followed by (multiple) "; parameter"
|
||||
// and we need just the MIME type here.
|
||||
const wxString& content = url.GetProtocol().GetContentType();
|
||||
wxString mimetype = content.BeforeFirst(';');
|
||||
mimetype.Trim();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user