X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c41dbc208516572b9afc53fe7c3f7246601dae53..53663be8a5ea8e1c6f178839209b67e8228e4642:/src/unix/mimetype.cpp diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 22d2b25d2b..1ef3b17521 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -644,14 +644,12 @@ void wxMimeTypesManagerImpl::LoadGnomeDataFromKeyFile(const wxString& filename, void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& filename) { wxTextFile textfile(filename); -#if defined(__WXGTK20__) && wxUSE_UNICODE - if ( !textfile.Open( wxConvUTF8) ) -#else if ( !textfile.Open() ) -#endif return; - wxLogTrace(TRACE_MIME, wxT("--- Opened Gnome file %s ---"), - filename.c_str()); + + wxLogTrace(TRACE_MIME, + wxT("--- Opened Gnome file %s ---"), + filename.c_str()); // values for the entry being parsed wxString curMimeType, curExtList; @@ -680,8 +678,9 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file // end of the entry if ( !!curMimeType && !!curExtList ) { - wxLogTrace(TRACE_MIME, wxT("--- At end of Gnome file finding mimetype %s ---"), - curMimeType.c_str()); + wxLogTrace(TRACE_MIME, + wxT("--- At end of Gnome file finding mimetype %s ---"), + curMimeType.c_str()); AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString); } @@ -703,20 +702,20 @@ void wxMimeTypesManagerImpl::LoadGnomeMimeTypesFromMimeFile(const wxString& file // this is a field=value ling pc++; // skip leading TAB - static const int lenField = 4; // strlen("ext:") - if ( wxStrncmp(pc, wxT("ext:"), lenField) == 0 ) + static const int lenField = 5; // strlen("ext: ") + if ( wxStrncmp(pc, wxT("ext: "), lenField) == 0 ) { - // skip ' ' which follows and take everything left until the end - // of line - curExtList = pc + lenField + 1; + // skip it and take everything left until the end of line + curExtList = pc + lenField; } //else: some other field, we don't care } else { // this is the start of the new section - wxLogTrace(TRACE_MIME, wxT("--- In Gnome file finding mimetype %s ---"), - curMimeType.c_str()); + wxLogTrace(TRACE_MIME, + wxT("--- In Gnome file finding mimetype %s ---"), + curMimeType.c_str()); if (! curMimeType.empty()) AddMimeTypeInfo(curMimeType, curExtList, wxEmptyString); @@ -1821,7 +1820,8 @@ int wxMimeTypesManagerImpl::AddToMimeData(const wxString& strType, m_aEntries.Add(entry ? entry : new wxMimeTypeCommands); // change nIndex so we can use it below to add the extensions - nIndex = m_aExtensions.Add(wxEmptyString); + m_aExtensions.Add(wxEmptyString); + nIndex = m_aExtensions.size(); m_aDescriptions.Add(strDesc); }