X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ea70037e0931bcf0895b6a3a453765919e2e1c1..9859d369b49e35a1cad0f760173e165f974fb6cb:/src/unix/mimetype.cpp diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 0cfb206480..a1b56f14d6 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -152,7 +152,7 @@ protected: virtual bool OnRead(const wxMBConv& WXUNUSED(conv)) { return wxTextFile::OnRead( - wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL)); + wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA)); } }; @@ -1425,14 +1425,27 @@ wxFileTypeImpl::SetCommand(const wxString& cmd, wxMimeTypeCommands *entry = new wxMimeTypeCommands(); entry->Add(verb + wxT("=") + cmd + wxT(" %s ")); - bool ok = true; + bool ok = false; size_t nCount = strTypes.GetCount(); for ( size_t i = 0; i < nCount; i++ ) { - if (!m_manager->DoAssociation(strTypes[i], strIcon, entry, strExtensions, strDesc)) - ok = false; + if ( m_manager->DoAssociation + ( + strTypes[i], + strIcon, + entry, + strExtensions, + strDesc + ) ) + { + // DoAssociation() took ownership of entry, don't delete it below + ok = true; + } } + if ( !ok ) + delete entry; + return ok; } @@ -1451,23 +1464,28 @@ bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int WXUNUSED(index) return false; wxMimeTypeCommands *entry = new wxMimeTypeCommands(); - bool ok = true; + bool ok = false; size_t nCount = strTypes.GetCount(); for ( size_t i = 0; i < nCount; i++ ) { - if ( !m_manager->DoAssociation - ( + if ( m_manager->DoAssociation + ( strTypes[i], strIcon, entry, strExtensions, strDesc - ) ) + ) ) { - ok = false; + // we don't need to free entry now, DoAssociation() took ownership + // of it + ok = true; } } + if ( !ok ) + delete entry; + return ok; } @@ -1512,9 +1530,11 @@ void wxMimeTypesManagerImpl::Initialize(int mailcapStyles, if (mailcapStyles & wxMAILCAP_GNOME) GetGnomeMimeInfo(sExtraDir); - // read KDE tables + // read KDE tables which are never installed on OpenVMS +#ifndef __VMS if (mailcapStyles & wxMAILCAP_KDE) GetKDEMimeInfo(sExtraDir); +#endif m_mailcapStylesInited |= mailcapStyles; } @@ -2745,8 +2765,8 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, if ( data.needsterminal ) { - data.cmdOpen.Printf(wxT("xterm -e sh -c '%s'"), - data.cmdOpen.c_str()); + data.cmdOpen.insert(0, wxT("xterm -e sh -c '")); + data.cmdOpen.append(wxT("'")); } if ( !data.cmdOpen.empty() )