Patch implements using the Haiku MIME type data base as a fall back for unknown file extensions. The hard-coded MIME types have been sorted to resolve more frequenly used extensions quicker.
Created attachment 48299 [details] Patch makes MIMETypeRegistry fall back to use system data base on Haiku Patch against r54275.
Comment on attachment 48299 [details] Patch makes MIMETypeRegistry fall back to use system data base on Haiku The mime type lines used to be sorted alphabetically. Why change that? There is no performance benefit to your change. The CPU on my cellphone can execute a billion comparisons a second, so shortening the array walk by a few places is no perf savings. :)
Hi Eric, Would you accept this patch if the ordering/optimization of the list was changed back to how it was? Though I think you are being pretty strict here. Don't ports get some leeway in defining how their platform code works? Either way I think falling back to the Haiku MIME database is a very valid platform-specific feature we should make use of in our port. So I would hope you would accept a patch with those changes at least.
Created attachment 53112 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. Revised patch, also fixes string returned for unknown types, which other code relies on.
Comment on attachment 53112 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. r- for struct name change (and the fact that I can't get you to change it on landing). > 2010-04-10 Adam Barth <abarth@webkit.org> > > Unreviewed. Rename m_forceSandboxFlags to m_forcedSandoxFlags, as > Index: WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp > -static const ExtensionMap extensionMap [] = { > +static const ExtensionMap sExtensionMap[] = { Please don't change the name of this struct. WebKit doesn't use this style of notation for static const arrays. > + // Try system mime database Please add a "." > + String fakeFileName("filename."); > + fakeFileName.append(str); > + > + BMimeType type; > + if (BMimeType::GuessMimeType(fakeFileName.utf8().data(), &type) == B_OK) Mild concern about passing untrusted data (derived from ext) to system api, but since it is a a null terminated string, this appears fine.
Created attachment 53233 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. Revised patch after review. Thanks! Somehow I was under the wrong impression that the style guide said this about static variables, but was obviously mistaken.
Comment on attachment 53233 [details] [Haiku] Fall back to the system MIME database, return correct string for unknown types. Clearing flags on attachment: 53233 Committed r57513: <http://trac.webkit.org/changeset/57513>
All reviewed patches have been landed. Closing bug.