]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/mimetype.cpp
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / src / unix / mimetype.cpp
index 20b96b5c21ba32a35a6ecf1c7d4d668ae6677a41..e85d76f28e95ac87a5dbbb3c5a5543eedafd93a9 100644 (file)
@@ -141,24 +141,8 @@ public:
         wxString sTmp = GetLine(i).AfterFirst(wxT('='));
         return sTmp;
     }
         wxString sTmp = GetLine(i).AfterFirst(wxT('='));
         return sTmp;
     }
-
-protected:
-    // we override this virtual method because we want to always use UTF-8
-    // conversion allowing for invalid characters as MIME information files
-    // often contain lines in different encodings and can't be read using any
-    // single conversion in Unicode build, so we just try to read what we can
-    // suing the most common encoding (UTF-8 is almost ubiquitous nowadays) and
-    // ignore the rest
-    virtual bool OnRead(const wxMBConv& WXUNUSED(conv))
-    {
-        return wxTextFile::OnRead(
-                    wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA));
-    }
 };
 
 };
 
-// in case we're compiling in non-GUI mode
-class WXDLLEXPORT wxIcon;
-
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
@@ -1019,7 +1003,7 @@ void wxMimeTypesManagerImpl::LoadKDEApp(const wxString& filename)
     wxStringTokenizer tokenizer(mimetypes, _T(";"));
     while(tokenizer.HasMoreTokens()) {
         wxString mimetype = tokenizer.GetNextToken().Lower();
     wxStringTokenizer tokenizer(mimetypes, _T(";"));
     while(tokenizer.HasMoreTokens()) {
         wxString mimetype = tokenizer.GetNextToken().Lower();
-        int nIndex = m_aTypes.Index(mimetype);
+        nIndex = m_aTypes.Index(mimetype);
         if(nIndex != wxNOT_FOUND) { // is this a known MIME type?
             wxMimeTypeCommands* entry = m_aEntries[nIndex];
             entry->AddOrReplaceVerb(wxT("open"), sCmd);
         if(nIndex != wxNOT_FOUND) { // is this a known MIME type?
             wxMimeTypeCommands* entry = m_aEntries[nIndex];
             entry->AddOrReplaceVerb(wxT("open"), sCmd);
@@ -1367,14 +1351,15 @@ size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs,
 
 bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
 {
 
 bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
 {
-    wxString strExtensions = m_manager->GetExtension(m_index[0]);
+    const wxString strExtensions = m_manager->GetExtension(m_index[0]);
     extensions.Empty();
 
     // one extension in the space or comma-delimited list
     wxString strExt;
     extensions.Empty();
 
     // one extension in the space or comma-delimited list
     wxString strExt;
-    for ( const wxChar *p = strExtensions; /* nothing */; p++ )
+    wxString::const_iterator end = strExtensions.end();
+    for ( wxString::const_iterator p = strExtensions.begin(); /* nothing */; ++p )
     {
     {
-        if ( *p == wxT(' ') || *p == wxT(',') || *p == wxT('\0') )
+        if ( p == end || *p == wxT(' ') || *p == wxT(',') )
         {
             if ( !strExt.empty() )
             {
         {
             if ( !strExt.empty() )
             {
@@ -1384,7 +1369,7 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
             //else: repeated spaces
             // (shouldn't happen, but it's not that important if it does happen)
 
             //else: repeated spaces
             // (shouldn't happen, but it's not that important if it does happen)
 
-            if ( *p == wxT('\0') )
+            if ( p == end )
                 break;
         }
         else if ( *p == wxT('.') )
                 break;
         }
         else if ( *p == wxT('.') )
@@ -2488,8 +2473,7 @@ wxMimeTypesManagerImpl::ProcessOtherMailcapField(MailcapLineData& data,
     }
 
     // is this something of the form foo=bar?
     }
 
     // is this something of the form foo=bar?
-    const wxChar *pEq = wxStrchr(curField, wxT('='));
-    if ( pEq != NULL )
+    if ( curField.find('=') != wxString::npos )
     {
         // split "LHS = RHS" in 2
         wxString lhs = curField.BeforeFirst(wxT('=')),
     {
         // split "LHS = RHS" in 2
         wxString lhs = curField.BeforeFirst(wxT('=')),
@@ -2613,8 +2597,7 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
             Field_Type,
             Field_OpenCmd,
             Field_Other
             Field_Type,
             Field_OpenCmd,
             Field_Other
-        }
-        currentToken = Field_Type;
+        } currentToken = Field_Type;
 
         // the flags and field values on the current line
         MailcapLineData data;
 
         // the flags and field values on the current line
         MailcapLineData data;