Changeset 72119 in webkit


Ignore:
Timestamp:
Nov 16, 2010 10:44:46 AM (13 years ago)
Author:
eric.carlson@apple.com
Message:

2010-11-16 Eric Carlson <eric.carlson@apple.com>

Reviewed by John Sullivan.

getMIMEType(s)ForExtension should consult system mapping
https://bugs.webkit.org/show_bug.cgi?id=49497

No new tests possible.

  • platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Add the type returned by getMIMETypeForExtension. Put the result of mediaMIMETypeMap().get() in a local variable and test instead of calling constains() and then get(). (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Ditto.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r72117 r72119  
     12010-11-16  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        getMIMEType(s)ForExtension should consult system mapping
     6        https://bugs.webkit.org/show_bug.cgi?id=49497
     7
     8        No new tests possible.
     9
     10        * platform/MIMETypeRegistry.cpp:
     11        (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Add the type returned by getMIMETypeForExtension.
     12        Put the result of mediaMIMETypeMap().get() in a local variable and test instead of calling
     13        constains() and then get().
     14        (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Ditto.
     15
    1162010-11-16  Eric Carlson  <eric.carlson@apple.com>
    217
  • trunk/WebCore/platform/MIMETypeRegistry.cpp

    r70922 r72119  
    346346String MIMETypeRegistry::getMediaMIMETypeForExtension(const String& ext)
    347347{
    348     if (mediaMIMETypeMap().contains(ext))
    349         return (*mediaMIMETypeMap().get(ext))[0];
     348    // Look in the system-specific registry first.
     349    String type = getMIMETypeForExtension(ext);
     350    if (!type.isEmpty())
     351        return type;
     352
     353    Vector<String>* typeList = mediaMIMETypeMap().get(ext);
     354    if (typeList)
     355        return (*typeList)[0];
    350356   
    351357    return String();
     
    354360Vector<String> MIMETypeRegistry::getMediaMIMETypesForExtension(const String& ext)
    355361{
    356     if (mediaMIMETypeMap().contains(ext))
    357         return *mediaMIMETypeMap().get(ext);
    358 
     362    Vector<String>* typeList = mediaMIMETypeMap().get(ext);
     363    if (typeList)
     364        return *typeList;
     365
     366    // Only need to look in the system-specific registry if mediaMIMETypeMap() doesn't contain
     367    // the extension at all, because it always contains the system-specific type if the
     368    // extension is in the static mapping table.
     369    String type = getMIMETypeForExtension(ext);
     370    if (!type.isEmpty()) {
     371        Vector<String> typeList;
     372        typeList.append(type);
     373        return typeList;
     374    }
     375   
    359376    return Vector<String>();
    360377}
Note: See TracChangeset for help on using the changeset viewer.