X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2900bd1c815e119fb3ada94334011198ff3d3ce5..dbcbe229628c7667da2b6257198467d4f09ab28d:/src/unix/mimetype.cpp diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 5f86b8f068..6693d5bd88 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -299,10 +299,13 @@ static bool IsKnownUnimportantField(const wxString& field); // a) for "brief" format: // // b) for "expanded" format: -// type= \ -// desc="" \ +// type= BACKSLASH +// desc="" BACKSLASH // exts="" // +// (where BACKSLASH is a literal '\\' which we can't put here because cpp +// misinterprets it) +// // We try to autodetect the format of mime.types: if a non-comment line starts // with "type=" we assume the second format, otherwise the first one. @@ -1110,17 +1113,19 @@ wxString wxFileTypeImpl::GetExpandedCommand(const wxString & verb, const wxFileT return wxFileType::ExpandCommand(sTmp, params); } -bool wxFileTypeImpl::GetIcon(wxIcon *icon, wxString *iconFile /*= NULL */, - int *iconIndex /*= NULL*/) const +bool wxFileTypeImpl::GetIcon(wxIcon *icon, + wxString *iconFile /*= NULL */, + int *iconIndex /*= NULL*/) const { +#if wxUSE_GUI wxString sTmp; size_t i = 0; while ( (i < m_index.GetCount() ) && sTmp.IsEmpty() ) - { - sTmp = m_manager->m_aIcons[m_index[i]]; - i ++; - } + { + sTmp = m_manager->m_aIcons[m_index[i]]; + i ++; + } if ( sTmp.IsEmpty () ) return FALSE; wxIcon icn; @@ -1131,14 +1136,16 @@ bool wxFileTypeImpl::GetIcon(wxIcon *icon, wxString *iconFile /*= NULL */, icn = wxIcon(sTmp, wxBITMAP_TYPE_ANY); if ( icn.Ok() ) - { - *icon = icn; - if (iconFile) *iconFile = sTmp; - if (iconIndex) *iconIndex = 0; - return TRUE; - } - return FALSE; + { + *icon = icn; + if (iconFile) *iconFile = sTmp; + if (iconIndex) *iconIndex = 0; + return TRUE; } +#endif // wxUSE_GUI + + return FALSE; +} bool @@ -2199,7 +2206,7 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName, // the flags and field values on the current line bool needsterminal = FALSE, copiousoutput = FALSE; - wxMimeArrayString *entry; + wxMimeArrayString *entry = NULL; // suppress compiler warning wxString strType, strOpenCmd, @@ -2524,11 +2531,11 @@ bool wxMimeTypesManagerImpl::Unassociate(wxFileType *ft) else { WriteMimeInfo(nIndex, TRUE ); - m_aTypes.Remove (nIndex); - m_aEntries.Remove (nIndex); - m_aExtensions.Remove (nIndex); - m_aDescriptions.Remove (nIndex); - m_aIcons.Remove (nIndex); + m_aTypes.RemoveAt(nIndex); + m_aEntries.RemoveAt(nIndex); + m_aExtensions.RemoveAt(nIndex); + m_aDescriptions.RemoveAt(nIndex); + m_aIcons.RemoveAt(nIndex); } } // check data integrity