<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[214338] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/214338">214338</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2017-03-24 01:21:21 -0700 (Fri, 24 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
https://bugs.webkit.org/show_bug.cgi?id=170001

Reviewed by Michael Catanzaro.

.:

* Source/CMakeLists.txt: Compile xdgmime if USE_XDGMIME is ON.
* Source/cmake/OptionsGTK.cmake: Set USE_XDGMIME to ON.

Source/ThirdParty:

Add xdgmime to ThirdParty.

* xdgmime/CMakeLists.txt: Added.
* xdgmime/README: Added.
* xdgmime/README.webkit: Added.
* xdgmime/src/xdgmime.c: Added.
* xdgmime/src/xdgmime.h: Added.
* xdgmime/src/xdgmimealias.c: Added.
* xdgmime/src/xdgmimealias.h: Added.
* xdgmime/src/xdgmimecache.c: Added.
* xdgmime/src/xdgmimecache.h: Added.
* xdgmime/src/xdgmimeglob.c: Added.
* xdgmime/src/xdgmimeglob.h: Added.
* xdgmime/src/xdgmimeicon.c: Added.
* xdgmime/src/xdgmimeicon.h: Added.
* xdgmime/src/xdgmimeint.c: Added.
* xdgmime/src/xdgmimeint.h: Added.
* xdgmime/src/xdgmimemagic.c: Added.
* xdgmime/src/xdgmimemagic.h: Added.
* xdgmime/src/xdgmimeparent.c: Added.
* xdgmime/src/xdgmimeparent.h: Added.

Source/WebCore:

The XDG implementation could be used by any port where shared-mime-info is expected to be available. It also
improves the current GTK+ implementation that is based on a very small map of mime types and extensions.

* CMakeLists.txt:
* PlatformGTK.cmake:
* platform/xdg/MIMETypeRegistryXdg.cpp: Renamed from Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp.
(WebCore::MIMETypeRegistry::getMIMETypeForExtension):
(WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):

Tools:

Ignore style of xdgmime sources.

* Scripts/webkitpy/tool/steps/checkstyle.py:

LayoutTests:

Remove platform specific expectations of two test because now we do the same as other wk2 ports.

* platform/gtk/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkChangeLog">trunk/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkSourceCMakeListstxt">trunk/Source/CMakeLists.txt</a></li>
<li><a href="#trunkSourceThirdPartyChangeLog">trunk/Source/ThirdParty/ChangeLog</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimec">trunk/Source/ThirdParty/xdgmime/src/xdgmime.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeh">trunk/Source/ThirdParty/xdgmime/src/xdgmime.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimealiasc">trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimealiash">trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimecachec">trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimecacheh">trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeglobc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeglobh">trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeiconc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeiconh">trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeintc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeinth">trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimemagicc">trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimemagich">trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeparentc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeparenth">trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.h</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourcecmakeOptionsGTKcmake">trunk/Source/cmake/OptionsGTK.cmake</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpystylecheckerpy">trunk/Tools/Scripts/webkitpy/style/checker.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/platform/xdg/</li>
<li><a href="#trunkSourceWebCoreplatformxdgMIMETypeRegistryXdgcpp">trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgtkMIMETypeRegistryGtkcpp">trunk/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimec">trunk/Source/ThirdParty/xdgmime/src/xdgmime.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeh">trunk/Source/ThirdParty/xdgmime/src/xdgmime.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimecachec">trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimecacheh">trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeglobc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeglobh">trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeiconc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeiconh">trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeintc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeinth">trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimemagicc">trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimemagich">trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.h</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeparentc">trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.c</a></li>
<li><a href="#trunkSourceThirdPartyxdgmimesrcxdgmimeparenth">trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/ChangeLog (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ChangeLog        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/ChangeLog        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-03-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
+        https://bugs.webkit.org/show_bug.cgi?id=170001
+
+        Reviewed by Michael Catanzaro.
+
+        * Source/CMakeLists.txt: Compile xdgmime if USE_XDGMIME is ON.
+        * Source/cmake/OptionsGTK.cmake: Set USE_XDGMIME to ON.
+
</ins><span class="cx"> 2017-03-10  Per Arne Vollan  &lt;pvollan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed Win64 build fix. FTL is not ready to be turned on yet.
</span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/LayoutTests/ChangeLog        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-03-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
+        https://bugs.webkit.org/show_bug.cgi?id=170001
+
+        Reviewed by Michael Catanzaro.
+
+        Remove platform specific expectations of two test because now we do the same as other wk2 ports.
+
+        * platform/gtk/TestExpectations:
+
</ins><span class="cx"> 2017-03-23  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Revert r213712, caused iPad PLT regression
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -3520,10 +3520,6 @@
</span><span class="cx"> fast/scrolling/rtl-scrollbars-alternate-body-dir-attr-does-not-update-scrollbar-placement-2.html [ Pass ]
</span><span class="cx"> webkit.org/b/156437 fast/scrolling/rtl-scrollbars-listbox-scroll.html [ ImageOnlyFailure Pass ]
</span><span class="cx"> 
</span><del>-# https://bugs.webkit.org/show_bug.cgi?id=156612
-http/tests/security/contentSecurityPolicy/embed-redirect-blocked3.html [ Pass ]
-http/tests/security/contentSecurityPolicy/object-redirect-blocked3.html [ Pass ]
-
</del><span class="cx"> # We don't support emoji genders, but half the reftests pass anyway.
</span><span class="cx"> fast/text/emoji-gender-2-3.html [ Pass ]
</span><span class="cx"> fast/text/emoji-gender-2-4.html [ Pass ]
</span></span></pre></div>
<a id="trunkSourceCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/CMakeLists.txt (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/CMakeLists.txt        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/CMakeLists.txt        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -22,6 +22,10 @@
</span><span class="cx">     add_subdirectory(ThirdParty/woff2)
</span><span class="cx"> endif ()
</span><span class="cx"> 
</span><ins>+if (USE_XDGMIME)
+    add_subdirectory(ThirdParty/xdgmime)
+endif ()
+
</ins><span class="cx"> if (ENABLE_WEBCORE)
</span><span class="cx">     add_subdirectory(WebCore)
</span><span class="cx"> endif ()
</span></span></pre></div>
<a id="trunkSourceThirdPartyChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ChangeLog (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ChangeLog        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/ChangeLog        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -1,5 +1,34 @@
</span><span class="cx"> 2017-03-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
+        https://bugs.webkit.org/show_bug.cgi?id=170001
+
+        Reviewed by Michael Catanzaro.
+
+        Add xdgmime to ThirdParty.
+
+        * xdgmime/CMakeLists.txt: Added.
+        * xdgmime/README: Added.
+        * xdgmime/README.webkit: Added.
+        * xdgmime/src/xdgmime.c: Added.
+        * xdgmime/src/xdgmime.h: Added.
+        * xdgmime/src/xdgmimealias.c: Added.
+        * xdgmime/src/xdgmimealias.h: Added.
+        * xdgmime/src/xdgmimecache.c: Added.
+        * xdgmime/src/xdgmimecache.h: Added.
+        * xdgmime/src/xdgmimeglob.c: Added.
+        * xdgmime/src/xdgmimeglob.h: Added.
+        * xdgmime/src/xdgmimeicon.c: Added.
+        * xdgmime/src/xdgmimeicon.h: Added.
+        * xdgmime/src/xdgmimeint.c: Added.
+        * xdgmime/src/xdgmimeint.h: Added.
+        * xdgmime/src/xdgmimemagic.c: Added.
+        * xdgmime/src/xdgmimemagic.h: Added.
+        * xdgmime/src/xdgmimeparent.c: Added.
+        * xdgmime/src/xdgmimeparent.h: Added.
+
+2017-03-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
</ins><span class="cx">         Unreviewed. Add stubs for xdgmime sources to ThirdParty.
</span><span class="cx"> 
</span><span class="cx">         This is in preparation for bug #170001, to try to bypass the SVN hook that doesn't allow to commit source files
</span></span></pre></div>
<a id="trunkSourceThirdPartyxdgmimesrcxdgmimec"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmime.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmime.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmime.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,947 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmime.c: XDG Mime Spec mime resolver.  Based on version 0.11 of the spec.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ * 
+ * Copyright (C) 2003,2004  Red Hat, Inc.
+ * Copyright (C) 2003,2004  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &quot;xdgmime.h&quot;
+#include &quot;xdgmimeint.h&quot;
+#include &quot;xdgmimeglob.h&quot;
+#include &quot;xdgmimemagic.h&quot;
+#include &quot;xdgmimealias.h&quot;
+#include &quot;xdgmimeicon.h&quot;
+#include &quot;xdgmimeparent.h&quot;
+#include &quot;xdgmimecache.h&quot;
+#include &lt;stdio.h&gt;
+#include &lt;string.h&gt;
+#include &lt;sys/stat.h&gt;
+#include &lt;sys/types.h&gt;
+#include &lt;sys/time.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;assert.h&gt;
+
+typedef struct XdgDirTimeList XdgDirTimeList;
+typedef struct XdgCallbackList XdgCallbackList;
+
+static int need_reread = TRUE;
+static time_t last_stat_time = 0;
+
+static XdgGlobHash *global_hash = NULL;
+static XdgMimeMagic *global_magic = NULL;
+static XdgAliasList *alias_list = NULL;
+static XdgParentList *parent_list = NULL;
+static XdgDirTimeList *dir_time_list = NULL;
+static XdgCallbackList *callback_list = NULL;
+static XdgIconList *icon_list = NULL;
+static XdgIconList *generic_icon_list = NULL;
+
+XdgMimeCache **_caches = NULL;
+static int n_caches = 0;
+
+const char xdg_mime_type_unknown[] = &quot;application/octet-stream&quot;;
+const char xdg_mime_type_empty[] = &quot;application/x-zerosize&quot;;
+const char xdg_mime_type_textplain[] = &quot;text/plain&quot;;
+
+
+enum
+{
+  XDG_CHECKED_UNCHECKED,
+  XDG_CHECKED_VALID,
+  XDG_CHECKED_INVALID
+};
+
+struct XdgDirTimeList
+{
+  time_t mtime;
+  char *directory_name;
+  int checked;
+  XdgDirTimeList *next;
+};
+
+struct XdgCallbackList
+{
+  XdgCallbackList *next;
+  XdgCallbackList *prev;
+  int              callback_id;
+  XdgMimeCallback  callback;
+  void            *data;
+  XdgMimeDestroy   destroy;
+};
+
+/* Function called by xdg_run_command_on_dirs.  If it returns TRUE, further
+ * directories aren't looked at */
+typedef int (*XdgDirectoryFunc) (const char *directory,
+                                 void       *user_data);
+
+static void
+xdg_dir_time_list_add (char   *file_name, 
+                       time_t  mtime)
+{
+  XdgDirTimeList *list;
+
+  for (list = dir_time_list; list; list = list-&gt;next) 
+    {
+      if (strcmp (list-&gt;directory_name, file_name) == 0)
+        {
+          free (file_name);
+          return;
+        }
+    }
+  
+  list = calloc (1, sizeof (XdgDirTimeList));
+  list-&gt;checked = XDG_CHECKED_UNCHECKED;
+  list-&gt;directory_name = file_name;
+  list-&gt;mtime = mtime;
+  list-&gt;next = dir_time_list;
+  dir_time_list = list;
+}

+static void
+xdg_dir_time_list_free (XdgDirTimeList *list)
+{
+  XdgDirTimeList *next;
+
+  while (list)
+    {
+      next = list-&gt;next;
+      free (list-&gt;directory_name);
+      free (list);
+      list = next;
+    }
+}
+
+static int
+xdg_mime_init_from_directory (const char *directory)
+{
+  char *file_name;
+  struct stat st;
+
+  assert (directory != NULL);
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/mime.cache&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/mime.cache&quot;);
+  if (stat (file_name, &amp;st) == 0)
+    {
+      XdgMimeCache *cache = _xdg_mime_cache_new_from_file (file_name);
+
+      if (cache != NULL)
+        {
+          xdg_dir_time_list_add (file_name, st.st_mtime);
+
+          _caches = realloc (_caches, sizeof (XdgMimeCache *) * (n_caches + 2));
+          _caches[n_caches] = cache;
+          _caches[n_caches + 1] = NULL;
+          n_caches++;
+
+          return FALSE;
+        }
+    }
+  free (file_name);
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/globs2&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/globs2&quot;);
+  if (stat (file_name, &amp;st) == 0)
+    {
+      _xdg_mime_glob_read_from_file (global_hash, file_name, TRUE);
+      xdg_dir_time_list_add (file_name, st.st_mtime);
+    }
+  else
+    {
+      free (file_name);
+      file_name = malloc (strlen (directory) + strlen (&quot;/mime/globs&quot;) + 1);
+      strcpy (file_name, directory); strcat (file_name, &quot;/mime/globs&quot;);
+      if (stat (file_name, &amp;st) == 0)
+        {
+          _xdg_mime_glob_read_from_file (global_hash, file_name, FALSE);
+          xdg_dir_time_list_add (file_name, st.st_mtime);
+        }
+      else
+        {
+          free (file_name);
+        }
+    }
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/magic&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/magic&quot;);
+  if (stat (file_name, &amp;st) == 0)
+    {
+      _xdg_mime_magic_read_from_file (global_magic, file_name);
+      xdg_dir_time_list_add (file_name, st.st_mtime);
+    }
+  else
+    {
+      free (file_name);
+    }
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/aliases&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/aliases&quot;);
+  _xdg_mime_alias_read_from_file (alias_list, file_name);
+  free (file_name);
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/subclasses&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/subclasses&quot;);
+  _xdg_mime_parent_read_from_file (parent_list, file_name);
+  free (file_name);
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/icons&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/icons&quot;);
+  _xdg_mime_icon_read_from_file (icon_list, file_name);
+  free (file_name);
+
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/generic-icons&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/generic-icons&quot;);
+  _xdg_mime_icon_read_from_file (generic_icon_list, file_name);
+  free (file_name);
+
+  return FALSE; /* Keep processing */
+}
+
+/* Runs a command on all the directories in the search path */
+static void
+xdg_run_command_on_dirs (XdgDirectoryFunc  func,
+                         void             *user_data)
+{
+  const char *xdg_data_home;
+  const char *xdg_data_dirs;
+  const char *ptr;
+
+  xdg_data_home = getenv (&quot;XDG_DATA_HOME&quot;);
+  if (xdg_data_home)
+    {
+      if ((func) (xdg_data_home, user_data))
+        return;
+    }
+  else
+    {
+      const char *home;
+
+      home = getenv (&quot;HOME&quot;);
+      if (home != NULL)
+        {
+          char *guessed_xdg_home;
+          int stop_processing;
+
+          guessed_xdg_home = malloc (strlen (home) + strlen (&quot;/.local/share/&quot;) + 1);
+          strcpy (guessed_xdg_home, home);
+          strcat (guessed_xdg_home, &quot;/.local/share/&quot;);
+          stop_processing = (func) (guessed_xdg_home, user_data);
+          free (guessed_xdg_home);
+
+          if (stop_processing)
+            return;
+        }
+    }
+
+  xdg_data_dirs = getenv (&quot;XDG_DATA_DIRS&quot;);
+  if (xdg_data_dirs == NULL)
+    xdg_data_dirs = &quot;/usr/local/share/:/usr/share/&quot;;
+
+  ptr = xdg_data_dirs;
+
+  while (*ptr != '\000')
+    {
+      const char *end_ptr;
+      char *dir;
+      int len;
+      int stop_processing;
+
+      end_ptr = ptr;
+      while (*end_ptr != ':' &amp;&amp; *end_ptr != '\000')
+        end_ptr ++;
+
+      if (end_ptr == ptr)
+        {
+          ptr++;
+          continue;
+        }
+
+      if (*end_ptr == ':')
+        len = end_ptr - ptr;
+      else
+        len = end_ptr - ptr + 1;
+      dir = malloc (len + 1);
+      strncpy (dir, ptr, len);
+      dir[len] = '\0';
+      stop_processing = (func) (dir, user_data);
+      free (dir);
+
+      if (stop_processing)
+        return;
+
+      ptr = end_ptr;
+    }
+}
+
+/* Checks file_path to make sure it has the same mtime as last time it was
+ * checked.  If it has a different mtime, or if the file doesn't exist, it
+ * returns FALSE.
+ *
+ * FIXME: This doesn't protect against permission changes.
+ */
+static int
+xdg_check_file (const char *file_path,
+                int        *exists)
+{
+  struct stat st;
+
+  /* If the file exists */
+  if (stat (file_path, &amp;st) == 0)
+    {
+      XdgDirTimeList *list;
+
+      if (exists)
+        *exists = TRUE;
+
+      for (list = dir_time_list; list; list = list-&gt;next)
+        {
+          if (! strcmp (list-&gt;directory_name, file_path))
+            {
+              if (st.st_mtime == list-&gt;mtime)
+                list-&gt;checked = XDG_CHECKED_VALID;
+              else 
+                list-&gt;checked = XDG_CHECKED_INVALID;
+
+              return (list-&gt;checked != XDG_CHECKED_VALID);
+            }
+        }
+      return TRUE;
+    }
+
+  if (exists)
+    *exists = FALSE;
+
+  return FALSE;
+}
+
+static int
+xdg_check_dir (const char *directory,
+               int        *invalid_dir_list)
+{
+  int invalid, exists;
+  char *file_name;
+
+  assert (directory != NULL);
+
+  /* Check the mime.cache file */
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/mime.cache&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/mime.cache&quot;);
+  invalid = xdg_check_file (file_name, &amp;exists);
+  free (file_name);
+  if (invalid)
+    {
+      *invalid_dir_list = TRUE;
+      return TRUE;
+    }
+  else if (exists)
+    {
+      return FALSE;
+    }
+
+  /* Check the globs file */
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/globs&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/globs&quot;);
+  invalid = xdg_check_file (file_name, NULL);
+  free (file_name);
+  if (invalid)
+    {
+      *invalid_dir_list = TRUE;
+      return TRUE;
+    }
+
+  /* Check the magic file */
+  file_name = malloc (strlen (directory) + strlen (&quot;/mime/magic&quot;) + 1);
+  strcpy (file_name, directory); strcat (file_name, &quot;/mime/magic&quot;);
+  invalid = xdg_check_file (file_name, NULL);
+  free (file_name);
+  if (invalid)
+    {
+      *invalid_dir_list = TRUE;
+      return TRUE;
+    }
+
+  return FALSE; /* Keep processing */
+}
+
+/* Walks through all the mime files stat()ing them to see if they've changed.
+ * Returns TRUE if they have. */
+static int
+xdg_check_dirs (void)
+{
+  XdgDirTimeList *list;
+  int invalid_dir_list = FALSE;
+
+  for (list = dir_time_list; list; list = list-&gt;next)
+    list-&gt;checked = XDG_CHECKED_UNCHECKED;
+
+  xdg_run_command_on_dirs ((XdgDirectoryFunc) xdg_check_dir,
+                           &amp;invalid_dir_list);
+
+  if (invalid_dir_list)
+    return TRUE;
+
+  for (list = dir_time_list; list; list = list-&gt;next)
+    {
+      if (list-&gt;checked != XDG_CHECKED_VALID)
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+/* We want to avoid stat()ing on every single mime call, so we only look for
+ * newer files every 5 seconds.  This will return TRUE if we need to reread the
+ * mime data from disk.
+ */
+static int
+xdg_check_time_and_dirs (void)
+{
+  struct timeval tv;
+  time_t current_time;
+  int retval = FALSE;
+
+  gettimeofday (&amp;tv, NULL);
+  current_time = tv.tv_sec;
+
+  if (current_time &gt;= last_stat_time + 5)
+    {
+      retval = xdg_check_dirs ();
+      last_stat_time = current_time;
+    }
+
+  return retval;
+}
+
+/* Called in every public function.  It reloads the hash function if need be.
+ */
+static void
+xdg_mime_init (void)
+{
+  if (xdg_check_time_and_dirs ())
+    {
+      xdg_mime_shutdown ();
+    }
+
+  if (need_reread)
+    {
+      global_hash = _xdg_glob_hash_new ();
+      global_magic = _xdg_mime_magic_new ();
+      alias_list = _xdg_mime_alias_list_new ();
+      parent_list = _xdg_mime_parent_list_new ();
+      icon_list = _xdg_mime_icon_list_new ();
+      generic_icon_list = _xdg_mime_icon_list_new ();
+
+      xdg_run_command_on_dirs ((XdgDirectoryFunc) xdg_mime_init_from_directory,
+                               NULL);
+
+      need_reread = FALSE;
+    }
+}
+
+const char *
+xdg_mime_get_mime_type_for_data (const void *data,
+                                 size_t      len,
+                                 int        *result_prio)
+{
+  const char *mime_type;
+
+  if (len == 0)
+    {
+      *result_prio = 100;
+      return XDG_MIME_TYPE_EMPTY;
+    }
+
+  xdg_mime_init ();
+
+  if (_caches)
+    mime_type = _xdg_mime_cache_get_mime_type_for_data (data, len, result_prio);
+  else
+    mime_type = _xdg_mime_magic_lookup_data (global_magic, data, len, result_prio, NULL, 0);
+
+  if (mime_type)
+    return mime_type;
+
+  return _xdg_binary_or_text_fallback(data, len);
+}
+
+const char *
+xdg_mime_get_mime_type_for_file (const char  *file_name,
+                                 struct stat *statbuf)
+{
+  const char *mime_type;
+  /* currently, only a few globs occur twice, and none
+   * more often, so 5 seems plenty.
+   */
+  const char *mime_types[5];
+  FILE *file;
+  unsigned char *data;
+  int max_extent;
+  int bytes_read;
+  struct stat buf;
+  const char *base_name;
+  int n;
+
+  if (file_name == NULL)
+    return NULL;
+  if (! _xdg_utf8_validate (file_name))
+    return NULL;
+
+  xdg_mime_init ();
+
+  if (_caches)
+    return _xdg_mime_cache_get_mime_type_for_file (file_name, statbuf);
+
+  base_name = _xdg_get_base_name (file_name);
+  n = _xdg_glob_hash_lookup_file_name (global_hash, base_name, mime_types, 5);
+
+  if (n == 1)
+    return mime_types[0];
+
+  if (!statbuf)
+    {
+      if (stat (file_name, &amp;buf) != 0)
+        return XDG_MIME_TYPE_UNKNOWN;
+
+      statbuf = &amp;buf;
+    }
+
+  if (!S_ISREG (statbuf-&gt;st_mode))
+    return XDG_MIME_TYPE_UNKNOWN;
+
+  /* FIXME: Need to make sure that max_extent isn't totally broken.  This could
+   * be large and need getting from a stream instead of just reading it all
+   * in. */
+  max_extent = _xdg_mime_magic_get_buffer_extents (global_magic);
+  data = malloc (max_extent);
+  if (data == NULL)
+    return XDG_MIME_TYPE_UNKNOWN;
+        
+  file = fopen (file_name, &quot;r&quot;);
+  if (file == NULL)
+    {
+      free (data);
+      return XDG_MIME_TYPE_UNKNOWN;
+    }
+
+  bytes_read = fread (data, 1, max_extent, file);
+  if (ferror (file))
+    {
+      free (data);
+      fclose (file);
+      return XDG_MIME_TYPE_UNKNOWN;
+    }
+
+  mime_type = _xdg_mime_magic_lookup_data (global_magic, data, bytes_read, NULL,
+                                           mime_types, n);
+
+  free (data);
+  fclose (file);
+
+  if (mime_type)
+    return mime_type;
+
+  return _xdg_binary_or_text_fallback(data, bytes_read);
+}
+
+const char *
+xdg_mime_get_mime_type_from_file_name (const char *file_name)
+{
+  const char *mime_type;
+
+  xdg_mime_init ();
+
+  if (_caches)
+    return _xdg_mime_cache_get_mime_type_from_file_name (file_name);
+
+  if (_xdg_glob_hash_lookup_file_name (global_hash, file_name, &amp;mime_type, 1))
+    return mime_type;
+  else
+    return XDG_MIME_TYPE_UNKNOWN;
+}
+
+int
+xdg_mime_get_mime_types_from_file_name (const char *file_name,
+                                        const char  *mime_types[],
+                                        int          n_mime_types)
+{
+  xdg_mime_init ();
+  
+  if (_caches)
+    return _xdg_mime_cache_get_mime_types_from_file_name (file_name, mime_types, n_mime_types);
+  
+  return _xdg_glob_hash_lookup_file_name (global_hash, file_name, mime_types, n_mime_types);
+}
+
+int
+xdg_mime_is_valid_mime_type (const char *mime_type)
+{
+  /* FIXME: We should make this a better test
+   */
+  return _xdg_utf8_validate (mime_type);
+}
+
+void
+xdg_mime_shutdown (void)
+{
+  XdgCallbackList *list;
+
+  /* FIXME: Need to make this (and the whole library) thread safe */
+  if (dir_time_list)
+    {
+      xdg_dir_time_list_free (dir_time_list);
+      dir_time_list = NULL;
+    }
+        
+  if (global_hash)
+    {
+      _xdg_glob_hash_free (global_hash);
+      global_hash = NULL;
+    }
+  if (global_magic)
+    {
+      _xdg_mime_magic_free (global_magic);
+      global_magic = NULL;
+    }
+
+  if (alias_list)
+    {
+      _xdg_mime_alias_list_free (alias_list);
+      alias_list = NULL;
+    }
+
+  if (parent_list)
+    {
+      _xdg_mime_parent_list_free (parent_list);
+      parent_list = NULL;
+    }
+
+  if (icon_list)
+    {
+      _xdg_mime_icon_list_free (icon_list);
+      icon_list = NULL;
+    }
+
+  if (generic_icon_list)
+    {
+      _xdg_mime_icon_list_free (generic_icon_list);
+      generic_icon_list = NULL;
+    }
+  
+  if (_caches)
+    {
+      int i;
+
+      for (i = 0; i &lt; n_caches; i++)
+        _xdg_mime_cache_unref (_caches[i]);
+      free (_caches);
+      _caches = NULL;
+      n_caches = 0;
+    }
+
+  for (list = callback_list; list; list = list-&gt;next)
+    (list-&gt;callback) (list-&gt;data);
+
+  need_reread = TRUE;
+}
+
+int
+xdg_mime_get_max_buffer_extents (void)
+{
+  xdg_mime_init ();
+  
+  if (_caches)
+    return _xdg_mime_cache_get_max_buffer_extents ();
+
+  return _xdg_mime_magic_get_buffer_extents (global_magic);
+}
+
+const char *
+_xdg_mime_unalias_mime_type (const char *mime_type)
+{
+  const char *lookup;
+
+  if (_caches)
+    return _xdg_mime_cache_unalias_mime_type (mime_type);
+
+  if ((lookup = _xdg_mime_alias_list_lookup (alias_list, mime_type)) != NULL)
+    return lookup;
+
+  return mime_type;
+}
+
+const char *
+xdg_mime_unalias_mime_type (const char *mime_type)
+{
+  xdg_mime_init ();
+
+  return _xdg_mime_unalias_mime_type (mime_type);
+}
+
+int
+_xdg_mime_mime_type_equal (const char *mime_a,
+                           const char *mime_b)
+{
+  const char *unalias_a, *unalias_b;
+
+  unalias_a = _xdg_mime_unalias_mime_type (mime_a);
+  unalias_b = _xdg_mime_unalias_mime_type (mime_b);
+
+  if (strcmp (unalias_a, unalias_b) == 0)
+    return 1;
+
+  return 0;
+}
+
+int
+xdg_mime_mime_type_equal (const char *mime_a,
+                          const char *mime_b)
+{
+  xdg_mime_init ();
+
+  return _xdg_mime_mime_type_equal (mime_a, mime_b);
+}
+
+int
+xdg_mime_media_type_equal (const char *mime_a,
+                           const char *mime_b)
+{
+  char *sep;
+
+  sep = strchr (mime_a, '/');
+  
+  if (sep &amp;&amp; strncmp (mime_a, mime_b, sep - mime_a + 1) == 0)
+    return 1;
+
+  return 0;
+}
+
+#if 1
+static int
+xdg_mime_is_super_type (const char *mime)
+{
+  int length;
+  const char *type;
+
+  length = strlen (mime);
+  type = &amp;(mime[length - 2]);
+
+  if (strcmp (type, &quot;/*&quot;) == 0)
+    return 1;
+
+  return 0;
+}
+#endif
+
+int
+_xdg_mime_mime_type_subclass (const char *mime,
+                              const char *base)
+{
+  const char *umime, *ubase;
+  const char **parents;
+
+  if (_caches)
+    return _xdg_mime_cache_mime_type_subclass (mime, base);
+
+  umime = _xdg_mime_unalias_mime_type (mime);
+  ubase = _xdg_mime_unalias_mime_type (base);
+
+  if (strcmp (umime, ubase) == 0)
+    return 1;
+
+#if 1  
+  /* Handle supertypes */
+  if (xdg_mime_is_super_type (ubase) &amp;&amp;
+      xdg_mime_media_type_equal (umime, ubase))
+    return 1;
+#endif
+
+  /*  Handle special cases text/plain and application/octet-stream */
+  if (strcmp (ubase, &quot;text/plain&quot;) == 0 &amp;&amp; 
+      strncmp (umime, &quot;text/&quot;, 5) == 0)
+    return 1;
+
+  if (strcmp (ubase, &quot;application/octet-stream&quot;) == 0)
+    return 1;
+  
+  parents = _xdg_mime_parent_list_lookup (parent_list, umime);
+  for (; parents &amp;&amp; *parents; parents++)
+    {
+      if (_xdg_mime_mime_type_subclass (*parents, ubase))
+        return 1;
+    }
+
+  return 0;
+}
+
+int
+xdg_mime_mime_type_subclass (const char *mime,
+                             const char *base)
+{
+  xdg_mime_init ();
+
+  return _xdg_mime_mime_type_subclass (mime, base);
+}
+
+char **
+xdg_mime_list_mime_parents (const char *mime)
+{
+  const char **parents;
+  char **result;
+  int i, n;
+
+  if (_caches)
+    return _xdg_mime_cache_list_mime_parents (mime);
+
+  parents = xdg_mime_get_mime_parents (mime);
+
+  if (!parents)
+    return NULL;
+
+  for (i = 0; parents[i]; i++) ;
+  
+  n = (i + 1) * sizeof (char *);
+  result = (char **) malloc (n);
+  memcpy (result, parents, n);
+
+  return result;
+}
+
+const char **
+xdg_mime_get_mime_parents (const char *mime)
+{
+  const char *umime;
+
+  xdg_mime_init ();
+
+  umime = _xdg_mime_unalias_mime_type (mime);
+
+  return _xdg_mime_parent_list_lookup (parent_list, umime);
+}
+
+void 
+xdg_mime_dump (void)
+{
+  xdg_mime_init();
+
+  printf (&quot;*** ALIASES ***\n\n&quot;);
+  _xdg_mime_alias_list_dump (alias_list);
+  printf (&quot;\n*** PARENTS ***\n\n&quot;);
+  _xdg_mime_parent_list_dump (parent_list);
+  printf (&quot;\n*** CACHE ***\n\n&quot;);
+  _xdg_glob_hash_dump (global_hash);
+  printf (&quot;\n*** GLOBS ***\n\n&quot;);
+  _xdg_glob_hash_dump (global_hash);
+  printf (&quot;\n*** GLOBS REVERSE TREE ***\n\n&quot;);
+  _xdg_mime_cache_glob_dump ();
+}
+
+
+/* Registers a function to be called every time the mime database reloads its files
+ */
+int
+xdg_mime_register_reload_callback (XdgMimeCallback  callback,
+                                   void            *data,
+                                   XdgMimeDestroy   destroy)
+{
+  XdgCallbackList *list_el;
+  static int callback_id = 1;
+
+  /* Make a new list element */
+  list_el = calloc (1, sizeof (XdgCallbackList));
+  list_el-&gt;callback_id = callback_id;
+  list_el-&gt;callback = callback;
+  list_el-&gt;data = data;
+  list_el-&gt;destroy = destroy;
+  list_el-&gt;next = callback_list;
+  if (list_el-&gt;next)
+    list_el-&gt;next-&gt;prev = list_el;
+
+  callback_list = list_el;
+  callback_id ++;
+
+  return callback_id - 1;
+}
+
+void
+xdg_mime_remove_callback (int callback_id)
+{
+  XdgCallbackList *list;
+
+  for (list = callback_list; list; list = list-&gt;next)
+    {
+      if (list-&gt;callback_id == callback_id)
+        {
+          if (list-&gt;next)
+            list-&gt;next = list-&gt;prev;
+
+          if (list-&gt;prev)
+            list-&gt;prev-&gt;next = list-&gt;next;
+          else
+            callback_list = list-&gt;next;
+
+          /* invoke the destroy handler */
+          (list-&gt;destroy) (list-&gt;data);
+          free (list);
+          return;
+        }
+    }
+}
+
+const char *
+xdg_mime_get_icon (const char *mime)
+{
+  xdg_mime_init ();
+  
+  if (_caches)
+    return _xdg_mime_cache_get_icon (mime);
+
+  return _xdg_mime_icon_list_lookup (icon_list, mime);
+}
+
+const char *
+xdg_mime_get_generic_icon (const char *mime)
+{
+  xdg_mime_init ();
+  
+  if (_caches)
+    return _xdg_mime_cache_get_generic_icon (mime);
+
+  return _xdg_mime_icon_list_lookup (generic_icon_list, mime);
+}
+
+int
+xdg_mime_get_simple_globs (const char *mime,
+                           char       *globs[],
+                           int         n_globs)
+{
+  xdg_mime_init ();
+
+  if (_caches)
+    return _xdg_mime_cache_get_simple_globs (mime, globs, n_globs);
+
+  return _xdg_glob_hash_get_simple_globs (global_hash, mime, globs, n_globs);
+}
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmime.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmime.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmime.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmime.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,137 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmime.h: XDG Mime Spec mime resolver.  Based on version 0.11 of the spec.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ * 
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __XDG_MIME_H__
+#define __XDG_MIME_H__
+
+#include &lt;stdlib.h&gt;
+#include &lt;sys/stat.h&gt;
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif /* __cplusplus */
+
+#ifdef XDG_PREFIX
+#define XDG_ENTRY(func) _XDG_ENTRY2(XDG_PREFIX,func)
+#define _XDG_ENTRY2(prefix,func) _XDG_ENTRY3(prefix,func)
+#define _XDG_ENTRY3(prefix,func) prefix##_##func
+
+#define XDG_RESERVED_ENTRY(func) _XDG_RESERVED_ENTRY2(XDG_PREFIX,func)
+#define _XDG_RESERVED_ENTRY2(prefix,func) _XDG_RESERVED_ENTRY3(prefix,func)
+#define _XDG_RESERVED_ENTRY3(prefix,func) _##prefix##_##func
+#endif
+
+typedef void (*XdgMimeCallback) (void *user_data);
+typedef void (*XdgMimeDestroy)  (void *user_data);
+
+  
+#ifdef XDG_PREFIX
+#define xdg_mime_get_mime_type_for_data       XDG_ENTRY(get_mime_type_for_data)
+#define xdg_mime_get_mime_type_for_file       XDG_ENTRY(get_mime_type_for_file)
+#define xdg_mime_get_mime_type_from_file_name XDG_ENTRY(get_mime_type_from_file_name)
+#define xdg_mime_get_mime_types_from_file_name XDG_ENTRY(get_mime_types_from_file_name)
+#define xdg_mime_is_valid_mime_type           XDG_ENTRY(is_valid_mime_type)
+#define xdg_mime_mime_type_equal              XDG_ENTRY(mime_type_equal)
+#define xdg_mime_media_type_equal             XDG_ENTRY(media_type_equal)
+#define xdg_mime_mime_type_subclass           XDG_ENTRY(mime_type_subclass)
+#define xdg_mime_get_mime_parents             XDG_ENTRY(get_mime_parents)
+#define xdg_mime_list_mime_parents            XDG_ENTRY(list_mime_parents)
+#define xdg_mime_unalias_mime_type            XDG_ENTRY(unalias_mime_type)
+#define xdg_mime_get_max_buffer_extents       XDG_ENTRY(get_max_buffer_extents)
+#define xdg_mime_shutdown                     XDG_ENTRY(shutdown)
+#define xdg_mime_dump                         XDG_ENTRY(dump)
+#define xdg_mime_register_reload_callback     XDG_ENTRY(register_reload_callback)
+#define xdg_mime_remove_callback              XDG_ENTRY(remove_callback)
+#define xdg_mime_type_unknown                 XDG_ENTRY(type_unknown)
+#define xdg_mime_type_empty                   XDG_ENTRY(type_empty)
+#define xdg_mime_type_textplain               XDG_ENTRY(type_textplain)
+#define xdg_mime_get_icon                     XDG_ENTRY(get_icon)
+#define xdg_mime_get_generic_icon             XDG_ENTRY(get_generic_icon)
+#define xdg_mime_get_simple_globs             XDG_ENTRY(get_simple_globs)
+
+#define _xdg_mime_mime_type_equal             XDG_RESERVED_ENTRY(mime_type_equal)
+#define _xdg_mime_mime_type_subclass          XDG_RESERVED_ENTRY(mime_type_subclass)
+#define _xdg_mime_unalias_mime_type           XDG_RESERVED_ENTRY(unalias_mime_type)  
+#endif
+
+extern const char xdg_mime_type_unknown[];
+extern const char xdg_mime_type_empty[];
+extern const char xdg_mime_type_textplain[];
+#define XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown
+#define XDG_MIME_TYPE_EMPTY xdg_mime_type_empty
+#define XDG_MIME_TYPE_TEXTPLAIN xdg_mime_type_textplain
+
+const char  *xdg_mime_get_mime_type_for_data       (const void *data,
+                                                    size_t      len,
+                                                    int        *result_prio);
+const char  *xdg_mime_get_mime_type_for_file       (const char *file_name,
+                                                    struct stat *statbuf);
+const char  *xdg_mime_get_mime_type_from_file_name (const char *file_name);
+int          xdg_mime_get_mime_types_from_file_name(const char *file_name,
+                                                    const char *mime_types[],
+                                                    int         n_mime_types);
+int          xdg_mime_is_valid_mime_type           (const char *mime_type);
+int          xdg_mime_mime_type_equal              (const char *mime_a,
+                                                    const char *mime_b);
+int          xdg_mime_media_type_equal             (const char *mime_a,
+                                                    const char *mime_b);
+int          xdg_mime_mime_type_subclass           (const char *mime_a,
+                                                    const char *mime_b);
+  /* xdg_mime_get_mime_parents() is deprecated since it does
+   * not work correctly with caches. Use xdg_mime_list_parents() 
+   * instead, but notice that that function expects you to free
+   * the array it returns. 
+   */
+const char **xdg_mime_get_mime_parents                   (const char *mime);
+char **      xdg_mime_list_mime_parents                   (const char *mime);
+const char  *xdg_mime_unalias_mime_type                   (const char *mime);
+const char  *xdg_mime_get_icon                     (const char *mime);
+const char  *xdg_mime_get_generic_icon             (const char *mime);
+int          xdg_mime_get_simple_globs             (const char *mime,
+                                                    char       *globs[],
+                                                    int         n_globs);
+int          xdg_mime_get_max_buffer_extents       (void);
+void         xdg_mime_shutdown                     (void);
+void         xdg_mime_dump                         (void);
+int          xdg_mime_register_reload_callback     (XdgMimeCallback  callback,
+                                                    void            *data,
+                                                    XdgMimeDestroy   destroy);
+void         xdg_mime_remove_callback              (int              callback_id);
+
+   /* Private versions of functions that don't call xdg_mime_init () */
+int          _xdg_mime_mime_type_equal             (const char *mime_a,
+                                                    const char *mime_b);
+int          _xdg_mime_mime_type_subclass          (const char *mime,
+                                                    const char *base);
+const char  *_xdg_mime_unalias_mime_type           (const char *mime);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __XDG_MIME_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmime.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimealiasc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,184 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimealias.c: Private file.  Datastructure for storing the aliases.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2004  Red Hat, Inc.
+ * Copyright (C) 2004  Matthias Clasen &lt;mclasen@redhat.com&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &quot;xdgmimealias.h&quot;
+#include &quot;xdgmimeint.h&quot;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;assert.h&gt;
+#include &lt;string.h&gt;
+#include &lt;fnmatch.h&gt;
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+typedef struct XdgAlias XdgAlias;
+
+struct XdgAlias 
+{
+  char *alias;
+  char *mime_type;
+};
+
+struct XdgAliasList
+{
+  struct XdgAlias *aliases;
+  int n_aliases;
+};
+
+XdgAliasList *
+_xdg_mime_alias_list_new (void)
+{
+  XdgAliasList *list;
+
+  list = malloc (sizeof (XdgAliasList));
+
+  list-&gt;aliases = NULL;
+  list-&gt;n_aliases = 0;
+
+  return list;
+}
+
+void         
+_xdg_mime_alias_list_free (XdgAliasList *list)
+{
+  int i;
+
+  if (list-&gt;aliases)
+    {
+      for (i = 0; i &lt; list-&gt;n_aliases; i++)
+        {
+          free (list-&gt;aliases[i].alias);
+          free (list-&gt;aliases[i].mime_type);
+        }
+      free (list-&gt;aliases);
+    }
+  free (list);
+}
+
+static int
+alias_entry_cmp (const void *v1, const void *v2)
+{
+  return strcmp (((XdgAlias *)v1)-&gt;alias, ((XdgAlias *)v2)-&gt;alias);
+}
+
+const char  *
+_xdg_mime_alias_list_lookup (XdgAliasList *list,
+                             const char   *alias)
+{
+  XdgAlias *entry;
+  XdgAlias key;
+
+  if (list-&gt;n_aliases &gt; 0)
+    {
+      key.alias = (char *)alias;
+      key.mime_type = NULL;
+
+      entry = bsearch (&amp;key, list-&gt;aliases, list-&gt;n_aliases,
+                       sizeof (XdgAlias), alias_entry_cmp);
+      if (entry)
+        return entry-&gt;mime_type;
+    }
+
+  return NULL;
+}
+
+void
+_xdg_mime_alias_read_from_file (XdgAliasList *list,
+                                const char   *file_name)
+{
+  FILE *file;
+  char line[255];
+  int alloc;
+
+  file = fopen (file_name, &quot;r&quot;);
+
+  if (file == NULL)
+    return;
+
+  /* FIXME: Not UTF-8 safe.  Doesn't work if lines are greater than 255 chars.
+   * Blah */
+  alloc = list-&gt;n_aliases + 16;
+  list-&gt;aliases = realloc (list-&gt;aliases, alloc * sizeof (XdgAlias));
+  while (fgets (line, 255, file) != NULL)
+    {
+      char *sep;
+      if (line[0] == '#')
+        continue;
+
+      sep = strchr (line, ' ');
+      if (sep == NULL)
+        continue;
+      *(sep++) = '\000';
+      sep[strlen (sep) -1] = '\000';
+      if (list-&gt;n_aliases == alloc)
+        {
+          alloc &lt;&lt;= 1;
+          list-&gt;aliases = realloc (list-&gt;aliases, 
+                                   alloc * sizeof (XdgAlias));
+        }
+      list-&gt;aliases[list-&gt;n_aliases].alias = strdup (line);
+      list-&gt;aliases[list-&gt;n_aliases].mime_type = strdup (sep);
+      list-&gt;n_aliases++;
+    }
+  list-&gt;aliases = realloc (list-&gt;aliases, 
+                           list-&gt;n_aliases * sizeof (XdgAlias));
+
+  fclose (file);  
+  
+  if (list-&gt;n_aliases &gt; 1)
+    qsort (list-&gt;aliases, list-&gt;n_aliases, 
+           sizeof (XdgAlias), alias_entry_cmp);
+}
+
+
+void
+_xdg_mime_alias_list_dump (XdgAliasList *list)
+{
+  int i;
+
+  if (list-&gt;aliases)
+    {
+      for (i = 0; i &lt; list-&gt;n_aliases; i++)
+        {
+          printf (&quot;%s %s\n&quot;, 
+                  list-&gt;aliases[i].alias,
+                  list-&gt;aliases[i].mime_type);
+        }
+    }
+}
+
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyxdgmimesrcxdgmimealiash"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimealias.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimealias.h: Private file.  Datastructure for storing the aliases.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2004  Red Hat, Inc.
+ * Copyright (C) 200  Matthias Clasen &lt;mclasen@redhat.com&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_ALIAS_H__
+#define __XDG_MIME_ALIAS_H__
+
+#include &quot;xdgmime.h&quot;
+
+typedef struct XdgAliasList XdgAliasList;
+
+#ifdef XDG_PREFIX
+#define _xdg_mime_alias_read_from_file        XDG_RESERVED_ENTRY(alias_read_from_file)
+#define _xdg_mime_alias_list_new              XDG_RESERVED_ENTRY(alias_list_new)
+#define _xdg_mime_alias_list_free             XDG_RESERVED_ENTRY(alias_list_free)
+#define _xdg_mime_alias_list_lookup           XDG_RESERVED_ENTRY(alias_list_lookup)
+#define _xdg_mime_alias_list_dump             XDG_RESERVED_ENTRY(alias_list_dump)
+#endif
+
+void          _xdg_mime_alias_read_from_file (XdgAliasList *list,
+                                              const char   *file_name);
+XdgAliasList *_xdg_mime_alias_list_new       (void);
+void          _xdg_mime_alias_list_free      (XdgAliasList *list);
+const char   *_xdg_mime_alias_list_lookup    (XdgAliasList *list,
+                                              const char  *alias);
+void          _xdg_mime_alias_list_dump      (XdgAliasList *list);
+
+#endif /* __XDG_MIME_ALIAS_H__ */
</ins></span></pre></div>
<a id="trunkSourceThirdPartyxdgmimesrcxdgmimecachec"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,1149 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimealias.c: Private file.  mmappable caches for mime data
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2005  Matthias Clasen &lt;mclasen@redhat.com&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+
+#include &lt;fcntl.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;errno.h&gt;
+#include &lt;fnmatch.h&gt;
+#include &lt;assert.h&gt;
+
+#include &lt;netinet/in.h&gt; /* for ntohl/ntohs */
+
+#ifdef HAVE_MMAP
+#include &lt;sys/mman.h&gt;
+#else
+#warning Building xdgmime without MMAP support. Binary &quot;mime.cache&quot; files will not be used.
+#endif
+
+#include &lt;sys/stat.h&gt;
+#include &lt;sys/types.h&gt;
+
+#include &quot;xdgmimecache.h&quot;
+#include &quot;xdgmimeint.h&quot;
+
+#ifndef MAX
+#define MAX(a,b) ((a) &gt; (b) ? (a) : (b))
+#endif
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+#ifndef _O_BINARY
+#define _O_BINARY 0
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *) -1)
+#endif
+
+#define MAJOR_VERSION 1
+#define MINOR_VERSION_MIN 1
+#define MINOR_VERSION_MAX 2
+
+struct _XdgMimeCache
+{
+  int ref_count;
+  int minor;
+
+  size_t  size;
+  char   *buffer;
+};
+
+#define GET_UINT16(cache,offset) (ntohs(*(xdg_uint16_t*)((cache) + (offset))))
+#define GET_UINT32(cache,offset) (ntohl(*(xdg_uint32_t*)((cache) + (offset))))
+
+XdgMimeCache *
+_xdg_mime_cache_ref (XdgMimeCache *cache)
+{
+  cache-&gt;ref_count++;
+  return cache;
+}
+
+void
+_xdg_mime_cache_unref (XdgMimeCache *cache)
+{
+  cache-&gt;ref_count--;
+
+  if (cache-&gt;ref_count == 0)
+    {
+#ifdef HAVE_MMAP
+      munmap (cache-&gt;buffer, cache-&gt;size);
+#endif
+      free (cache);
+    }
+}
+
+XdgMimeCache *
+_xdg_mime_cache_new_from_file (const char *file_name)
+{
+  XdgMimeCache *cache = NULL;
+
+#ifdef HAVE_MMAP
+  int fd = -1;
+  struct stat st;
+  char *buffer = NULL;
+  int minor;
+
+  /* Open the file and map it into memory */
+  do
+    fd = open (file_name, O_RDONLY|_O_BINARY, 0);
+  while (fd == -1 &amp;&amp; errno == EINTR);
+
+  if (fd &lt; 0)
+    return NULL;
+  
+  if (fstat (fd, &amp;st) &lt; 0 || st.st_size &lt; 4)
+    goto done;
+
+  buffer = (char *) mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+
+  if (buffer == MAP_FAILED)
+    goto done;
+
+  minor = GET_UINT16 (buffer, 2);
+  /* Verify version */
+  if (GET_UINT16 (buffer, 0) != MAJOR_VERSION ||
+      (minor &lt; MINOR_VERSION_MIN ||
+       minor &gt; MINOR_VERSION_MAX))
+    {
+      munmap (buffer, st.st_size);
+
+      goto done;
+    }
+  
+  cache = (XdgMimeCache *) malloc (sizeof (XdgMimeCache));
+  cache-&gt;minor = minor;
+  cache-&gt;ref_count = 1;
+  cache-&gt;buffer = buffer;
+  cache-&gt;size = st.st_size;
+
+ done:
+  if (fd != -1)
+    close (fd);
+
+#endif  /* HAVE_MMAP */
+
+  return cache;
+}
+
+static int
+cache_magic_matchlet_compare_to_data (XdgMimeCache *cache, 
+                                      xdg_uint32_t  offset,
+                                      const void   *data,
+                                      size_t        len)
+{
+  xdg_uint32_t range_start = GET_UINT32 (cache-&gt;buffer, offset);
+  xdg_uint32_t range_length = GET_UINT32 (cache-&gt;buffer, offset + 4);
+  xdg_uint32_t data_length = GET_UINT32 (cache-&gt;buffer, offset + 12);
+  xdg_uint32_t data_offset = GET_UINT32 (cache-&gt;buffer, offset + 16);
+  xdg_uint32_t mask_offset = GET_UINT32 (cache-&gt;buffer, offset + 20);
+  
+  int i, j;
+
+  for (i = range_start; i &lt; range_start + range_length; i++)
+    {
+      int valid_matchlet = TRUE;
+      
+      if (i + data_length &gt; len)
+        return FALSE;
+
+      if (mask_offset)
+        {
+          for (j = 0; j &lt; data_length; j++)
+            {
+              if ((((unsigned char *)cache-&gt;buffer)[data_offset + j] &amp; ((unsigned char *)cache-&gt;buffer)[mask_offset + j]) !=
+                  ((((unsigned char *) data)[j + i]) &amp; ((unsigned char *)cache-&gt;buffer)[mask_offset + j]))
+                {
+                  valid_matchlet = FALSE;
+                  break;
+                }
+            }
+        }
+      else
+        {
+          valid_matchlet = memcmp(cache-&gt;buffer + data_offset, data + i, data_length) == 0;
+        }
+
+      if (valid_matchlet)
+        return TRUE;
+    }
+  
+  return FALSE;  
+}
+
+static int
+cache_magic_matchlet_compare (XdgMimeCache *cache, 
+                              xdg_uint32_t  offset,
+                              const void   *data,
+                              size_t        len)
+{
+  xdg_uint32_t n_children = GET_UINT32 (cache-&gt;buffer, offset + 24);
+  xdg_uint32_t child_offset = GET_UINT32 (cache-&gt;buffer, offset + 28);
+
+  int i;
+  
+  if (cache_magic_matchlet_compare_to_data (cache, offset, data, len))
+    {
+      if (n_children == 0)
+        return TRUE;
+      
+      for (i = 0; i &lt; n_children; i++)
+        {
+          if (cache_magic_matchlet_compare (cache, child_offset + 32 * i,
+                                            data, len))
+            return TRUE;
+        }
+    }
+  
+  return FALSE;  
+}
+
+static const char *
+cache_magic_compare_to_data (XdgMimeCache *cache, 
+                             xdg_uint32_t  offset,
+                             const void   *data, 
+                             size_t        len, 
+                             int          *prio)
+{
+  xdg_uint32_t priority = GET_UINT32 (cache-&gt;buffer, offset);
+  xdg_uint32_t mimetype_offset = GET_UINT32 (cache-&gt;buffer, offset + 4);
+  xdg_uint32_t n_matchlets = GET_UINT32 (cache-&gt;buffer, offset + 8);
+  xdg_uint32_t matchlet_offset = GET_UINT32 (cache-&gt;buffer, offset + 12);
+
+  int i;
+
+  for (i = 0; i &lt; n_matchlets; i++)
+    {
+      if (cache_magic_matchlet_compare (cache, matchlet_offset + i * 32, 
+                                        data, len))
+        {
+          *prio = priority;
+          
+          return cache-&gt;buffer + mimetype_offset;
+        }
+    }
+
+  return NULL;
+}
+
+static const char *
+cache_magic_lookup_data (XdgMimeCache *cache, 
+                         const void   *data, 
+                         size_t        len, 
+                         int          *prio,
+                         const char   *mime_types[],
+                         int           n_mime_types)
+{
+  xdg_uint32_t list_offset;
+  xdg_uint32_t n_entries;
+  xdg_uint32_t offset;
+
+  int j, n;
+
+  *prio = 0;
+
+  list_offset = GET_UINT32 (cache-&gt;buffer, 24);
+  n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+  offset = GET_UINT32 (cache-&gt;buffer, list_offset + 8);
+  
+  for (j = 0; j &lt; n_entries; j++)
+    {
+      const char *match;
+
+      match = cache_magic_compare_to_data (cache, offset + 16 * j, 
+                                           data, len, prio);
+      if (match)
+        return match;
+      else
+        {
+          xdg_uint32_t mimetype_offset;
+          const char *non_match;
+          
+          mimetype_offset = GET_UINT32 (cache-&gt;buffer, offset + 16 * j + 4);
+          non_match = cache-&gt;buffer + mimetype_offset;
+
+          for (n = 0; n &lt; n_mime_types; n++)
+            {
+              if (mime_types[n] &amp;&amp; 
+                  _xdg_mime_mime_type_equal (mime_types[n], non_match))
+                mime_types[n] = NULL;
+            }
+        }
+    }
+
+  return NULL;
+}
+
+static const char *
+cache_alias_lookup (const char *alias)
+{
+  const char *ptr;
+  int i, min, max, mid, cmp;
+
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 4);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+      xdg_uint32_t offset;
+
+      min = 0; 
+      max = n_entries - 1;
+      while (max &gt;= min) 
+        {
+          mid = (min + max) / 2;
+
+          offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * mid);
+          ptr = cache-&gt;buffer + offset;
+          cmp = strcmp (ptr, alias);
+          
+          if (cmp &lt; 0)
+            min = mid + 1;
+          else if (cmp &gt; 0)
+            max = mid - 1;
+          else
+            {
+              offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * mid + 4);
+              return cache-&gt;buffer + offset;
+            }
+        }
+    }
+
+  return NULL;
+}
+
+typedef struct {
+  const char *mime;
+  int weight;
+} MimeWeight;
+
+static int
+cache_glob_lookup_literal (const char *file_name,
+                           const char *mime_types[],
+                           int         n_mime_types,
+                           int         case_sensitive_check)
+{
+  const char *ptr;
+  int i, min, max, mid, cmp;
+
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 12);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+      xdg_uint32_t offset;
+
+      min = 0; 
+      max = n_entries - 1;
+      while (max &gt;= min) 
+        {
+          mid = (min + max) / 2;
+
+          offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 12 * mid);
+          ptr = cache-&gt;buffer + offset;
+          cmp = strcmp (ptr, file_name);
+
+          if (cmp &lt; 0)
+            min = mid + 1;
+          else if (cmp &gt; 0)
+            max = mid - 1;
+          else
+            {
+              int weight = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 12 * mid + 8);
+              int case_sensitive = weight &amp; 0x100;
+              weight = weight &amp; 0xff;
+
+              if (case_sensitive_check || !case_sensitive)
+                {
+                  offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 12 * mid + 4);
+                  mime_types[0] = (const char *)(cache-&gt;buffer + offset);
+
+                  return 1;
+                }
+              return 0;
+            }
+        }
+    }
+
+  return 0;
+}
+
+static int
+cache_glob_lookup_fnmatch (const char *file_name,
+                           MimeWeight  mime_types[],
+                           int         n_mime_types,
+                           int         case_sensitive_check)
+{
+  const char *mime_type;
+  const char *ptr;
+
+  int i, j, n;
+
+  n = 0;
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 20);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+
+      for (j = 0; j &lt; n_entries &amp;&amp; n &lt; n_mime_types; j++)
+        {
+          xdg_uint32_t offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 12 * j);
+          xdg_uint32_t mimetype_offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 12 * j + 4);
+          int weight = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 12 * j + 8);
+          int case_sensitive = weight &amp; 0x100;
+          weight = weight &amp; 0xff;
+          ptr = cache-&gt;buffer + offset;
+          mime_type = cache-&gt;buffer + mimetype_offset;
+          if (case_sensitive_check || !case_sensitive)
+            {
+              /* FIXME: Not UTF-8 safe */
+              if (fnmatch (ptr, file_name, 0) == 0)
+                {
+                  mime_types[n].mime = mime_type;
+                  mime_types[n].weight = weight;
+                  n++;
+                }
+            }
+        }
+
+      if (n &gt; 0)
+        return n;
+    }
+  
+  return 0;
+}
+
+static int
+cache_glob_node_lookup_suffix (XdgMimeCache  *cache,
+                               xdg_uint32_t   n_entries,
+                               xdg_uint32_t   offset,
+                               const char    *file_name,
+                               int            len,
+                               int            case_sensitive_check,
+                               MimeWeight     mime_types[],
+                               int            n_mime_types)
+{
+  xdg_unichar_t character;
+  xdg_unichar_t match_char;
+  xdg_uint32_t mimetype_offset;
+  xdg_uint32_t n_children;
+  xdg_uint32_t child_offset; 
+  int weight;
+  int case_sensitive;
+
+  int min, max, mid, n, i;
+
+  character = file_name[len - 1];
+
+  assert (character != 0);
+
+  min = 0;
+  max = n_entries - 1;
+  while (max &gt;= min)
+    {
+      mid = (min + max) /  2;
+      match_char = GET_UINT32 (cache-&gt;buffer, offset + 12 * mid);
+      if (match_char &lt; character)
+        min = mid + 1;
+      else if (match_char &gt; character)
+        max = mid - 1;
+      else 
+        {
+          len--;
+          n = 0;
+          n_children = GET_UINT32 (cache-&gt;buffer, offset + 12 * mid + 4);
+          child_offset = GET_UINT32 (cache-&gt;buffer, offset + 12 * mid + 8);
+      
+          if (len &gt; 0)
+            {
+              n = cache_glob_node_lookup_suffix (cache, 
+                                                 n_children, child_offset,
+                                                 file_name, len, 
+                                                 case_sensitive_check,
+                                                 mime_types,
+                                                 n_mime_types);
+            }
+          if (n == 0)
+            {
+              i = 0;
+              while (n &lt; n_mime_types &amp;&amp; i &lt; n_children)
+                {
+                  match_char = GET_UINT32 (cache-&gt;buffer, child_offset + 12 * i);
+                  if (match_char != 0)
+                    break;
+
+                  mimetype_offset = GET_UINT32 (cache-&gt;buffer, child_offset + 12 * i + 4);
+                  weight = GET_UINT32 (cache-&gt;buffer, child_offset + 12 * i + 8);
+                  case_sensitive = weight &amp; 0x100;
+                  weight = weight &amp; 0xff;
+
+                  if (case_sensitive_check || !case_sensitive)
+                    {
+                      mime_types[n].mime = cache-&gt;buffer + mimetype_offset;
+                      mime_types[n].weight = weight;
+                      n++;
+                    }
+                  i++;
+                }
+            }
+          return n;
+        }
+    }
+  return 0;
+}
+
+static int
+cache_glob_lookup_suffix (const char *file_name,
+                          int         len,
+                          int         ignore_case,
+                          MimeWeight  mime_types[],
+                          int         n_mime_types)
+{
+  int i, n;
+
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 16);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+      xdg_uint32_t offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4);
+
+      n = cache_glob_node_lookup_suffix (cache, 
+                                         n_entries, offset, 
+                                         file_name, len,
+                                         ignore_case,
+                                         mime_types,
+                                         n_mime_types);
+      if (n &gt; 0)
+        return n;
+    }
+
+  return 0;
+}
+
+static int compare_mime_weight (const void *a, const void *b)
+{
+  const MimeWeight *aa = (const MimeWeight *)a;
+  const MimeWeight *bb = (const MimeWeight *)b;
+
+  return bb-&gt;weight - aa-&gt;weight;
+}
+
+#define ISUPPER(c)                ((c) &gt;= 'A' &amp;&amp; (c) &lt;= 'Z')
+static char *
+ascii_tolower (const char *str)
+{
+  char *p, *lower;
+
+  lower = strdup (str);
+  p = lower;
+  while (*p != 0)
+    {
+      char c = *p;
+      *p++ = ISUPPER (c) ? c - 'A' + 'a' : c;
+    }
+  return lower;
+}
+
+static int
+cache_glob_lookup_file_name (const char *file_name, 
+                             const char *mime_types[],
+                             int         n_mime_types)
+{
+  int n;
+  MimeWeight mimes[10];
+  int n_mimes = 10;
+  int i;
+  int len;
+  char *lower_case;
+
+  assert (file_name != NULL &amp;&amp; n_mime_types &gt; 0);
+
+  /* First, check the literals */
+
+  lower_case = ascii_tolower (file_name);
+
+  n = cache_glob_lookup_literal (lower_case, mime_types, n_mime_types, FALSE);
+  if (n &gt; 0)
+    {
+      free (lower_case);
+      return n;
+    }
+
+  n = cache_glob_lookup_literal (file_name, mime_types, n_mime_types, TRUE);
+  if (n &gt; 0)
+    {
+      free (lower_case);
+      return n;
+    }
+
+  len = strlen (file_name);
+  n = cache_glob_lookup_suffix (lower_case, len, FALSE, mimes, n_mimes);
+  if (n == 0)
+    n = cache_glob_lookup_suffix (file_name, len, TRUE, mimes, n_mimes);
+
+  /* Last, try fnmatch */
+  if (n == 0)
+    n = cache_glob_lookup_fnmatch (lower_case, mimes, n_mimes, FALSE);
+  if (n == 0)
+    n = cache_glob_lookup_fnmatch (file_name, mimes, n_mimes, TRUE);
+
+  free (lower_case);
+
+  qsort (mimes, n, sizeof (MimeWeight), compare_mime_weight);
+
+  if (n_mime_types &lt; n)
+    n = n_mime_types;
+
+  for (i = 0; i &lt; n; i++)
+    mime_types[i] = mimes[i].mime;
+
+  return n;
+}
+
+int
+_xdg_mime_cache_get_max_buffer_extents (void)
+{
+  xdg_uint32_t offset;
+  xdg_uint32_t max_extent;
+  int i;
+
+  max_extent = 0;
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+
+      offset = GET_UINT32 (cache-&gt;buffer, 24);
+      max_extent = MAX (max_extent, GET_UINT32 (cache-&gt;buffer, offset + 4));
+    }
+
+  return max_extent;
+}
+
+static const char *
+cache_get_mime_type_for_data (const void *data,
+                              size_t      len,
+                              int        *result_prio,
+                              const char *mime_types[],
+                              int         n_mime_types)
+{
+  const char *mime_type;
+  int i, n, priority;
+
+  priority = 0;
+  mime_type = NULL;
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+
+      int prio;
+      const char *match;
+
+      match = cache_magic_lookup_data (cache, data, len, &amp;prio, 
+                                       mime_types, n_mime_types);
+      if (prio &gt; priority)
+        {
+          priority = prio;
+          mime_type = match;
+        }
+    }
+
+  if (result_prio)
+    *result_prio = priority;
+
+  if (priority &gt; 0)
+    {
+      /* Pick glob-result R where mime_type inherits from R */
+      for (n = 0; n &lt; n_mime_types; n++)
+        {
+          if (mime_types[n] &amp;&amp; _xdg_mime_cache_mime_type_subclass(mime_types[n], mime_type))
+              return mime_types[n];
+        }
+
+      /* Return magic match */
+      return mime_type;
+    }
+
+  /* Pick first glob result, as fallback */
+  for (n = 0; n &lt; n_mime_types; n++)
+    {
+      if (mime_types[n])
+        return mime_types[n];
+    }
+
+  return NULL;
+}
+
+const char *
+_xdg_mime_cache_get_mime_type_for_data (const void *data,
+                                        size_t      len,
+                                        int        *result_prio)
+{
+  return cache_get_mime_type_for_data (data, len, result_prio, NULL, 0);
+}
+
+const char *
+_xdg_mime_cache_get_mime_type_for_file (const char  *file_name,
+                                        struct stat *statbuf)
+{
+  const char *mime_type;
+  const char *mime_types[10];
+  FILE *file;
+  unsigned char *data;
+  int max_extent;
+  int bytes_read;
+  struct stat buf;
+  const char *base_name;
+  int n;
+
+  if (file_name == NULL)
+    return NULL;
+
+  if (! _xdg_utf8_validate (file_name))
+    return NULL;
+
+  base_name = _xdg_get_base_name (file_name);
+  n = cache_glob_lookup_file_name (base_name, mime_types, 10);
+
+  if (n == 1)
+    return mime_types[0];
+
+  if (!statbuf)
+    {
+      if (stat (file_name, &amp;buf) != 0)
+        return XDG_MIME_TYPE_UNKNOWN;
+
+      statbuf = &amp;buf;
+    }
+
+  if (statbuf-&gt;st_size == 0)
+    return XDG_MIME_TYPE_EMPTY;
+
+  if (!S_ISREG (statbuf-&gt;st_mode))
+    return XDG_MIME_TYPE_UNKNOWN;
+
+  /* FIXME: Need to make sure that max_extent isn't totally broken.  This could
+   * be large and need getting from a stream instead of just reading it all
+   * in. */
+  max_extent = _xdg_mime_cache_get_max_buffer_extents ();
+  data = malloc (max_extent);
+  if (data == NULL)
+    return XDG_MIME_TYPE_UNKNOWN;
+        
+  file = fopen (file_name, &quot;r&quot;);
+  if (file == NULL)
+    {
+      free (data);
+      return XDG_MIME_TYPE_UNKNOWN;
+    }
+
+  bytes_read = fread (data, 1, max_extent, file);
+  if (ferror (file))
+    {
+      free (data);
+      fclose (file);
+      return XDG_MIME_TYPE_UNKNOWN;
+    }
+
+  mime_type = cache_get_mime_type_for_data (data, bytes_read, NULL,
+                                            mime_types, n);
+
+  if (!mime_type)
+    mime_type = _xdg_binary_or_text_fallback(data, bytes_read);
+
+  free (data);
+  fclose (file);
+
+  return mime_type;
+}
+
+const char *
+_xdg_mime_cache_get_mime_type_from_file_name (const char *file_name)
+{
+  const char *mime_type;
+
+  if (cache_glob_lookup_file_name (file_name, &amp;mime_type, 1))
+    return mime_type;
+  else
+    return XDG_MIME_TYPE_UNKNOWN;
+}
+
+int
+_xdg_mime_cache_get_mime_types_from_file_name (const char *file_name,
+                                               const char  *mime_types[],
+                                               int          n_mime_types)
+{
+  return cache_glob_lookup_file_name (file_name, mime_types, n_mime_types);
+}
+
+#if 1
+static int
+is_super_type (const char *mime)
+{
+  int length;
+  const char *type;
+
+  length = strlen (mime);
+  type = &amp;(mime[length - 2]);
+
+  if (strcmp (type, &quot;/*&quot;) == 0)
+    return 1;
+
+  return 0;
+}
+#endif
+
+int
+_xdg_mime_cache_mime_type_subclass (const char *mime,
+                                    const char *base)
+{
+  const char *umime, *ubase;
+
+  int i, j, min, max, med, cmp;
+  
+  umime = _xdg_mime_cache_unalias_mime_type (mime);
+  ubase = _xdg_mime_cache_unalias_mime_type (base);
+
+  if (strcmp (umime, ubase) == 0)
+    return 1;
+
+  /* We really want to handle text/ * in GtkFileFilter, so we just
+   * turn on the supertype matching
+   */
+#if 1
+  /* Handle supertypes */
+  if (is_super_type (ubase) &amp;&amp;
+      xdg_mime_media_type_equal (umime, ubase))
+    return 1;
+#endif
+
+  /*  Handle special cases text/plain and application/octet-stream */
+  if (strcmp (ubase, &quot;text/plain&quot;) == 0 &amp;&amp; 
+      strncmp (umime, &quot;text/&quot;, 5) == 0)
+    return 1;
+
+  if (strcmp (ubase, &quot;application/octet-stream&quot;) == 0)
+    return 1;

+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+      
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 8);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+      xdg_uint32_t offset, n_parents, parent_offset;
+
+      min = 0; 
+      max = n_entries - 1;
+      while (max &gt;= min)
+        {
+          med = (min + max)/2;
+          
+          offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * med);
+          cmp = strcmp (cache-&gt;buffer + offset, umime);
+          if (cmp &lt; 0)
+            min = med + 1;
+          else if (cmp &gt; 0)
+            max = med - 1;
+          else
+            {
+              offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * med + 4);
+              n_parents = GET_UINT32 (cache-&gt;buffer, offset);
+              
+              for (j = 0; j &lt; n_parents; j++)
+                {
+                  parent_offset = GET_UINT32 (cache-&gt;buffer, offset + 4 + 4 * j);
+                  if (_xdg_mime_cache_mime_type_subclass (cache-&gt;buffer + parent_offset, ubase))
+                    return 1;
+                }
+
+              break;
+            }
+        }
+    }
+
+  return 0;
+}
+
+const char *
+_xdg_mime_cache_unalias_mime_type (const char *mime)
+{
+  const char *lookup;
+  
+  lookup = cache_alias_lookup (mime);
+  
+  if (lookup)
+    return lookup;
+  
+  return mime;  
+}
+
+char **
+_xdg_mime_cache_list_mime_parents (const char *mime)
+{
+  int i, j, k, l, p;
+  char *all_parents[128]; /* we'll stop at 128 */ 
+  char **result;
+
+  mime = xdg_mime_unalias_mime_type (mime);
+
+  p = 0;
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+  
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 8);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+
+      for (j = 0; j &lt; n_entries; j++)
+        {
+          xdg_uint32_t mimetype_offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * j);
+          xdg_uint32_t parents_offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * j + 4);
+
+          if (strcmp (cache-&gt;buffer + mimetype_offset, mime) == 0)
+            {
+              xdg_uint32_t parent_mime_offset;
+              xdg_uint32_t n_parents = GET_UINT32 (cache-&gt;buffer, parents_offset);
+
+              for (k = 0; k &lt; n_parents &amp;&amp; p &lt; 127; k++)
+                {
+                  parent_mime_offset = GET_UINT32 (cache-&gt;buffer, parents_offset + 4 + 4 * k);
+
+                  /* Don't add same parent multiple times.
+                   * This can happen for instance if the same type is listed in multiple directories
+                   */
+                  for (l = 0; l &lt; p; l++)
+                    {
+                      if (strcmp (all_parents[l], cache-&gt;buffer + parent_mime_offset) == 0)
+                        break;
+                    }
+
+                  if (l == p)
+                    all_parents[p++] = cache-&gt;buffer + parent_mime_offset;
+                }
+
+              break;
+            }
+        }
+    }
+  all_parents[p++] = NULL;
+  
+  result = (char **) malloc (p * sizeof (char *));
+  memcpy (result, all_parents, p * sizeof (char *));
+
+  return result;
+}
+
+static const char *
+cache_lookup_icon (const char *mime, int header)
+{
+  const char *ptr;
+  int i, min, max, mid, cmp;
+
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, header);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+      xdg_uint32_t offset;
+
+      min = 0; 
+      max = n_entries - 1;
+      while (max &gt;= min) 
+        {
+          mid = (min + max) / 2;
+
+          offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * mid);
+          ptr = cache-&gt;buffer + offset;
+          cmp = strcmp (ptr, mime);
+         
+          if (cmp &lt; 0)
+            min = mid + 1;
+          else if (cmp &gt; 0)
+            max = mid - 1;
+          else
+            {
+              offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4 + 8 * mid + 4);
+              return cache-&gt;buffer + offset;
+            }
+        }
+    }
+
+  return NULL;
+}
+
+const char *
+_xdg_mime_cache_get_generic_icon (const char *mime)
+{
+  return cache_lookup_icon (mime, 36);
+}
+
+const char *
+_xdg_mime_cache_get_icon (const char *mime)
+{
+  return cache_lookup_icon (mime, 32);
+}
+
+static int
+get_simple_globs (XdgMimeCache  *cache,
+                  const char    *mime,
+                  char          *globs[],
+                  int            n_globs,
+                  xdg_uint32_t   offset,
+                  int           *n,
+                  xdg_unichar_t *prefix,
+                  int            depth)
+{
+  xdg_unichar_t character = GET_UINT32 (cache-&gt;buffer, offset);
+  xdg_uint32_t n_children;
+  xdg_uint32_t child_offset;
+  int i;
+
+  if (*n &gt;= n_globs)
+    return FALSE;
+
+  if (character == 0)
+    {
+      xdg_uint32_t mime_offset = GET_UINT32 (cache-&gt;buffer, offset + 4);
+
+      if (strcasecmp (cache-&gt;buffer + mime_offset, mime) == 0) {
+        globs[*n] = malloc (depth * sizeof (char));
+        for (i = 0; i &lt; depth; i++)
+          globs[*n][depth - i - 1] = prefix[i];
+        globs[*n][depth] = '\0';
+
+        (*n)++;
+      }
+
+      return *n &lt; n_globs;
+    }
+
+  prefix[depth] = character;
+  n_children = GET_UINT32 (cache-&gt;buffer, offset + 4);
+  child_offset = GET_UINT32 (cache-&gt;buffer, offset + 8);
+  for (i = 0; i &lt; n_children; i++)
+    {
+      if (!get_simple_globs (cache, mime, globs, n_globs, child_offset + 12 * i, n, prefix, depth + 1))
+        return FALSE;
+    }
+
+  return *n &lt; n_globs;
+}
+
+int
+_xdg_mime_cache_get_simple_globs (const char *mime,
+                                  char       *globs[],
+                                  int         n_globs)
+{
+  int i, j, n;
+  xdg_unichar_t prefix[25];
+
+  mime = xdg_mime_unalias_mime_type (mime);
+
+  n = 0;
+  for (i = 0; _caches[i]; i++)
+    {
+      XdgMimeCache *cache = _caches[i];
+      xdg_uint32_t list_offset = GET_UINT32 (cache-&gt;buffer, 16);
+      xdg_uint32_t n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+      xdg_uint32_t offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4);
+
+      for (j = 0; j &lt; n_entries &amp;&amp; n &lt; n_globs; j++)
+        {
+          if (!get_simple_globs (cache, mime, globs, n_globs, offset + 12 * j, &amp;n, prefix, 0))
+            break;
+        }
+
+      if (n &gt; 0)
+        return n;
+    }
+
+  return 0;
+}
+
+static void
+dump_glob_node (XdgMimeCache *cache,
+                xdg_uint32_t  offset,
+                int           depth)
+{
+  xdg_unichar_t character;
+  xdg_uint32_t mime_offset;
+  xdg_uint32_t n_children;
+  xdg_uint32_t child_offset;
+  int i;
+
+  character = GET_UINT32 (cache-&gt;buffer, offset);
+  mime_offset = GET_UINT32 (cache-&gt;buffer, offset + 4);
+  n_children = GET_UINT32 (cache-&gt;buffer, offset + 8);
+  child_offset = GET_UINT32 (cache-&gt;buffer, offset + 12);
+  for (i = 0; i &lt; depth; i++)
+    printf (&quot; &quot;);
+  printf (&quot;%c&quot;, character);
+  if (mime_offset)
+    printf (&quot; - %s&quot;, cache-&gt;buffer + mime_offset);
+  printf (&quot;\n&quot;);
+  if (child_offset)
+  {
+    for (i = 0; i &lt; n_children; i++)
+      dump_glob_node (cache, child_offset + 20 * i, depth + 1);
+  }
+}
+
+void
+_xdg_mime_cache_glob_dump (void)
+{
+  int i, j;
+  for (i = 0; _caches[i]; i++)
+  {
+    XdgMimeCache *cache = _caches[i];
+    xdg_uint32_t list_offset;
+    xdg_uint32_t n_entries;
+    xdg_uint32_t offset;
+    list_offset = GET_UINT32 (cache-&gt;buffer, 16);
+    n_entries = GET_UINT32 (cache-&gt;buffer, list_offset);
+    offset = GET_UINT32 (cache-&gt;buffer, list_offset + 4);
+    for (j = 0; j &lt; n_entries; j++)
+            dump_glob_node (cache, offset + 20 * j, 0);
+  }
+}
+
+
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimecacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimecache.h: Private file.  Datastructure for mmapped caches.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2005  Matthias Clasen &lt;mclasen@redhat.com&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_CACHE_H__
+#define __XDG_MIME_CACHE_H__
+
+#include &quot;xdgmime.h&quot;
+
+typedef struct _XdgMimeCache XdgMimeCache;
+
+#ifdef XDG_PREFIX
+#define _xdg_mime_cache_new_from_file                 XDG_RESERVED_ENTRY(cache_new_from_file)
+#define _xdg_mime_cache_ref                           XDG_RESERVED_ENTRY(cache_ref)
+#define _xdg_mime_cache_unref                         XDG_RESERVED_ENTRY(cache_unref)
+#define _xdg_mime_cache_get_max_buffer_extents        XDG_RESERVED_ENTRY(cache_get_max_buffer_extents)
+#define _xdg_mime_cache_get_mime_type_for_data        XDG_RESERVED_ENTRY(cache_get_mime_type_for_data)
+#define _xdg_mime_cache_get_mime_type_for_file        XDG_RESERVED_ENTRY(cache_get_mime_type_for_file)
+#define _xdg_mime_cache_get_mime_type_from_file_name  XDG_RESERVED_ENTRY(cache_get_mime_type_from_file_name)
+#define _xdg_mime_cache_get_mime_types_from_file_name XDG_RESERVED_ENTRY(cache_get_mime_types_from_file_name)
+#define _xdg_mime_cache_list_mime_parents             XDG_RESERVED_ENTRY(cache_list_mime_parents)
+#define _xdg_mime_cache_mime_type_subclass            XDG_RESERVED_ENTRY(cache_mime_type_subclass)
+#define _xdg_mime_cache_unalias_mime_type             XDG_RESERVED_ENTRY(cache_unalias_mime_type)
+#define _xdg_mime_cache_get_icon                      XDG_RESERVED_ENTRY(cache_get_icon)
+#define _xdg_mime_cache_get_generic_icon              XDG_RESERVED_ENTRY(cache_get_generic_icon)
+#define _xdg_mime_cache_get_simple_globs              XDG_RESERVED_ENTRY(cache_get_simple_globs)
+#define _xdg_mime_cache_glob_dump                     XDG_RESERVED_ENTRY(cache_glob_dump)
+#endif
+
+extern XdgMimeCache **_caches;
+
+XdgMimeCache *_xdg_mime_cache_new_from_file (const char   *file_name);
+XdgMimeCache *_xdg_mime_cache_ref           (XdgMimeCache *cache);
+void          _xdg_mime_cache_unref         (XdgMimeCache *cache);
+
+
+const char  *_xdg_mime_cache_get_mime_type_for_data       (const void *data,
+                                                            size_t      len,
+                                                           int        *result_prio);
+const char  *_xdg_mime_cache_get_mime_type_for_file       (const char  *file_name,
+                                                           struct stat *statbuf);
+int          _xdg_mime_cache_get_mime_types_from_file_name (const char *file_name,
+                                                            const char  *mime_types[],
+                                                            int          n_mime_types);
+const char  *_xdg_mime_cache_get_mime_type_from_file_name (const char *file_name);
+int          _xdg_mime_cache_is_valid_mime_type           (const char *mime_type);
+int          _xdg_mime_cache_mime_type_equal              (const char *mime_a,
+                                                           const char *mime_b);
+int          _xdg_mime_cache_media_type_equal             (const char *mime_a,
+                                                           const char *mime_b);
+int          _xdg_mime_cache_mime_type_subclass           (const char *mime_a,
+                                                           const char *mime_b);
+char       **_xdg_mime_cache_list_mime_parents                  (const char *mime);
+const char  *_xdg_mime_cache_unalias_mime_type            (const char *mime);
+int          _xdg_mime_cache_get_max_buffer_extents       (void);
+const char  *_xdg_mime_cache_get_icon                     (const char *mime);
+const char  *_xdg_mime_cache_get_generic_icon             (const char *mime);
+int          _xdg_mime_cache_get_simple_globs             (const char *mime,
+                                                           char       *globs[],
+                                                           int         n_globs);
+void         _xdg_mime_cache_glob_dump                    (void);
+
+#endif /* __XDG_MIME_CACHE_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimecache.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeglobc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,752 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeglob.c: Private file.  Datastructure for storing the globs.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &quot;xdgmimeglob.h&quot;
+#include &quot;xdgmimeint.h&quot;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;assert.h&gt;
+#include &lt;string.h&gt;
+#include &lt;fnmatch.h&gt;
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+typedef struct XdgGlobHashNode XdgGlobHashNode;
+typedef struct XdgGlobList XdgGlobList;
+
+struct XdgGlobHashNode
+{
+  xdg_unichar_t character;
+  const char *mime_type;
+  int weight;
+  int case_sensitive;
+  XdgGlobHashNode *next;
+  XdgGlobHashNode *child;
+};
+struct XdgGlobList
+{
+  const char *data;
+  const char *mime_type;
+  int weight;
+  int case_sensitive;
+  XdgGlobList *next;
+};
+
+struct XdgGlobHash
+{
+  XdgGlobList *literal_list;
+  XdgGlobHashNode *simple_node;
+  XdgGlobList *full_list;
+};
+
+
+/* XdgGlobList
+ */
+static XdgGlobList *
+_xdg_glob_list_new (void)
+{
+  XdgGlobList *new_element;
+
+  new_element = calloc (1, sizeof (XdgGlobList));
+
+  return new_element;
+}
+
+/* Frees glob_list and all of it's children */
+static void
+_xdg_glob_list_free (XdgGlobList *glob_list)
+{
+  XdgGlobList *ptr, *next;
+
+  ptr = glob_list;
+
+  while (ptr != NULL)
+    {
+      next = ptr-&gt;next;
+
+      if (ptr-&gt;data)
+        free ((void *) ptr-&gt;data);
+      if (ptr-&gt;mime_type)
+        free ((void *) ptr-&gt;mime_type);
+      free (ptr);
+
+      ptr = next;
+    }
+}
+
+static XdgGlobList *
+_xdg_glob_list_append (XdgGlobList *glob_list,
+                       void        *data,
+                       const char  *mime_type,
+                       int          weight,
+                       int          case_sensitive)
+{
+  XdgGlobList *new_element;
+  XdgGlobList *tmp_element;
+
+  tmp_element = glob_list;
+  while (tmp_element != NULL)
+    {
+      if (strcmp (tmp_element-&gt;data, data) == 0 &amp;&amp;
+          strcmp (tmp_element-&gt;mime_type, mime_type) == 0)
+        return glob_list;
+
+      tmp_element = tmp_element-&gt;next;
+    }
+
+  new_element = _xdg_glob_list_new ();
+  new_element-&gt;data = data;
+  new_element-&gt;mime_type = mime_type;
+  new_element-&gt;weight = weight;
+  new_element-&gt;case_sensitive = case_sensitive;
+  if (glob_list == NULL)
+    return new_element;
+
+  tmp_element = glob_list;
+  while (tmp_element-&gt;next != NULL)
+    tmp_element = tmp_element-&gt;next;
+
+  tmp_element-&gt;next = new_element;
+
+  return glob_list;
+}
+
+/* XdgGlobHashNode
+ */
+
+static XdgGlobHashNode *
+_xdg_glob_hash_node_new (void)
+{
+  XdgGlobHashNode *glob_hash_node;
+
+  glob_hash_node = calloc (1, sizeof (XdgGlobHashNode));
+
+  return glob_hash_node;
+}
+
+static void
+_xdg_glob_hash_node_dump (XdgGlobHashNode *glob_hash_node,
+                          int depth)
+{
+  int i;
+  for (i = 0; i &lt; depth; i++)
+    printf (&quot; &quot;);
+
+  printf (&quot;%c&quot;, (char)glob_hash_node-&gt;character);
+  if (glob_hash_node-&gt;mime_type)
+    printf (&quot; - %s %d\n&quot;, glob_hash_node-&gt;mime_type, glob_hash_node-&gt;weight);
+  else
+    printf (&quot;\n&quot;);
+  if (glob_hash_node-&gt;child)
+    _xdg_glob_hash_node_dump (glob_hash_node-&gt;child, depth + 1);
+  if (glob_hash_node-&gt;next)
+    _xdg_glob_hash_node_dump (glob_hash_node-&gt;next, depth);
+}
+
+static XdgGlobHashNode *
+_xdg_glob_hash_insert_ucs4 (XdgGlobHashNode *glob_hash_node,
+                            xdg_unichar_t   *text,
+                            const char      *mime_type,
+                            int              weight,
+                            int              case_sensitive)
+{
+  XdgGlobHashNode *node;
+  xdg_unichar_t character;
+
+  character = text[0];
+
+  if ((glob_hash_node == NULL) ||
+      (character &lt; glob_hash_node-&gt;character))
+    {
+      node = _xdg_glob_hash_node_new ();
+      node-&gt;character = character;
+      node-&gt;next = glob_hash_node;
+      glob_hash_node = node;
+    }
+  else if (character == glob_hash_node-&gt;character)
+    {
+      node = glob_hash_node;
+    }
+  else
+    {
+      XdgGlobHashNode *prev_node;
+      int found_node = FALSE;
+
+      /* Look for the first character of text in glob_hash_node, and insert it if we
+       * have to.*/
+      prev_node = glob_hash_node;
+      node = prev_node-&gt;next;
+
+      while (node != NULL)
+        {
+          if (character &lt; node-&gt;character)
+            {
+              node = _xdg_glob_hash_node_new ();
+              node-&gt;character = character;
+              node-&gt;next = prev_node-&gt;next;
+              prev_node-&gt;next = node;
+
+              found_node = TRUE;
+              break;
+            }
+          else if (character == node-&gt;character)
+            {
+              found_node = TRUE;
+              break;
+            }
+          prev_node = node;
+          node = node-&gt;next;
+        }
+
+      if (! found_node)
+        {
+          node = _xdg_glob_hash_node_new ();
+          node-&gt;character = character;
+          node-&gt;next = prev_node-&gt;next;
+          prev_node-&gt;next = node;
+        }
+    }
+
+  text++;
+  if (*text == 0)
+    {
+      if (node-&gt;mime_type)
+        {
+          if (strcmp (node-&gt;mime_type, mime_type) != 0)
+            {
+              XdgGlobHashNode *child;
+              int found_node = FALSE;
+
+              child = node-&gt;child;
+              while (child &amp;&amp; child-&gt;character == 0)
+                {
+                  if (strcmp (child-&gt;mime_type, mime_type) == 0)
+                    {
+                      found_node = TRUE;
+                      break;
+                    }
+                  child = child-&gt;next;
+                }
+
+              if (!found_node)
+                {
+                  child = _xdg_glob_hash_node_new ();
+                  child-&gt;character = 0;
+                  child-&gt;mime_type = strdup (mime_type);
+                  child-&gt;weight = weight;
+                  child-&gt;case_sensitive = case_sensitive;
+                  child-&gt;child = NULL;
+                  child-&gt;next = node-&gt;child;
+                  node-&gt;child = child;
+                }
+            }
+        }
+      else
+        {
+          node-&gt;mime_type = strdup (mime_type);
+          node-&gt;weight = weight;
+          node-&gt;case_sensitive = case_sensitive;
+        }
+    }
+  else
+    {
+      node-&gt;child = _xdg_glob_hash_insert_ucs4 (node-&gt;child, text, mime_type, weight, case_sensitive);
+    }
+  return glob_hash_node;
+}
+
+/* glob must be valid UTF-8 */
+static XdgGlobHashNode *
+_xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
+                            const char      *text,
+                            const char      *mime_type,
+                            int              weight,
+                            int              case_sensitive)
+{
+  XdgGlobHashNode *node;
+  xdg_unichar_t *unitext;
+  int len;
+
+  unitext = _xdg_convert_to_ucs4 (text, &amp;len);
+  _xdg_reverse_ucs4 (unitext, len);
+  node = _xdg_glob_hash_insert_ucs4 (glob_hash_node, unitext, mime_type, weight, case_sensitive);
+  free (unitext);
+  return node;
+}
+
+typedef struct {
+  const char *mime;
+  int weight;
+} MimeWeight;
+
+static int
+_xdg_glob_hash_node_lookup_file_name (XdgGlobHashNode *glob_hash_node,
+                                      const char      *file_name,
+                                      int              len,
+                                      int              case_sensitive_check,
+                                      MimeWeight       mime_types[],
+                                      int              n_mime_types)
+{
+  int n;
+  XdgGlobHashNode *node;
+  xdg_unichar_t character;
+
+  if (glob_hash_node == NULL)
+    return 0;
+
+  character = file_name[len - 1];
+
+  for (node = glob_hash_node; node &amp;&amp; character &gt;= node-&gt;character; node = node-&gt;next)
+    {
+      if (character == node-&gt;character)
+        {
+          len--;
+          n = 0;
+          if (len &gt; 0) 
+            {
+              n = _xdg_glob_hash_node_lookup_file_name (node-&gt;child,
+                                                        file_name,
+                                                        len,
+                                                        case_sensitive_check,
+                                                        mime_types,
+                                                        n_mime_types);
+            }
+          if (n == 0)
+            {
+              if (node-&gt;mime_type &amp;&amp;
+                  (case_sensitive_check ||
+                   !node-&gt;case_sensitive))
+                {
+                  mime_types[n].mime = node-&gt;mime_type;
+                  mime_types[n].weight = node-&gt;weight;
+                  n++; 
+                }
+              node = node-&gt;child;
+              while (n &lt; n_mime_types &amp;&amp; node &amp;&amp; node-&gt;character == 0)
+                {
+                  if (node-&gt;mime_type &amp;&amp;
+                      (case_sensitive_check ||
+                       !node-&gt;case_sensitive))
+                    {
+                      mime_types[n].mime = node-&gt;mime_type;
+                      mime_types[n].weight = node-&gt;weight;
+                      n++;
+                    }
+                  node = node-&gt;next;
+                }
+            }
+          return n;
+        }
+    }
+
+  return 0;
+}
+
+static int compare_mime_weight (const void *a, const void *b)
+{
+  const MimeWeight *aa = (const MimeWeight *)a;
+  const MimeWeight *bb = (const MimeWeight *)b;
+
+  return bb-&gt;weight - aa-&gt;weight;
+}
+
+#define ISUPPER(c)                ((c) &gt;= 'A' &amp;&amp; (c) &lt;= 'Z')
+static char *
+ascii_tolower (const char *str)
+{
+  char *p, *lower;
+
+  lower = strdup (str);
+  p = lower;
+  while (*p != 0)
+    {
+      char c = *p;
+      *p++ = ISUPPER (c) ? c - 'A' + 'a' : c;
+    }
+  return lower;
+}
+
+int
+_xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
+                                 const char  *file_name,
+                                 const char  *mime_types[],
+                                 int          n_mime_types)
+{
+  XdgGlobList *list;
+  int i, n;
+  MimeWeight mimes[10];
+  int n_mimes = 10;
+  int len;
+  char *lower_case;
+
+  /* First, check the literals */
+
+  assert (file_name != NULL &amp;&amp; n_mime_types &gt; 0);
+
+  n = 0;
+
+  lower_case = ascii_tolower (file_name);
+
+  for (list = glob_hash-&gt;literal_list; list; list = list-&gt;next)
+    {
+      if (strcmp ((const char *)list-&gt;data, file_name) == 0)
+        {
+          mime_types[0] = list-&gt;mime_type;
+          free (lower_case);
+          return 1;
+        }
+    }
+
+  for (list = glob_hash-&gt;literal_list; list; list = list-&gt;next)
+    {
+      if (!list-&gt;case_sensitive &amp;&amp;
+          strcmp ((const char *)list-&gt;data, lower_case) == 0)
+        {
+          mime_types[0] = list-&gt;mime_type;
+          free (lower_case);
+          return 1;
+        }
+    }
+
+
+  len = strlen (file_name);
+  n = _xdg_glob_hash_node_lookup_file_name (glob_hash-&gt;simple_node, lower_case, len, FALSE,
+                                            mimes, n_mimes);
+  if (n == 0)
+    n = _xdg_glob_hash_node_lookup_file_name (glob_hash-&gt;simple_node, file_name, len, TRUE,
+                                              mimes, n_mimes);
+
+  if (n == 0)
+    {
+      for (list = glob_hash-&gt;full_list; list &amp;&amp; n &lt; n_mime_types; list = list-&gt;next)
+        {
+          if (fnmatch ((const char *)list-&gt;data, file_name, 0) == 0)
+            {
+              mimes[n].mime = list-&gt;mime_type;
+              mimes[n].weight = list-&gt;weight;
+              n++;
+            }
+        }
+    }
+  free (lower_case);
+
+  qsort (mimes, n, sizeof (MimeWeight), compare_mime_weight);
+
+  if (n_mime_types &lt; n)
+    n = n_mime_types;
+
+  for (i = 0; i &lt; n; i++)
+    mime_types[i] = mimes[i].mime;
+
+  return n;
+}
+
+static int
+get_simple_globs (XdgGlobHashNode *glob_hash_node,
+                  const char      *mime,
+                  char            *globs[],
+                  int              n_globs,
+                  int             *n,
+                  xdg_unichar_t   *prefix,
+                  int              depth)
+{
+  if (*n &gt;= n_globs)
+    return FALSE;
+
+  prefix[depth] = glob_hash_node-&gt;character;
+
+  if (glob_hash_node-&gt;mime_type)
+    {
+      if (strcasecmp (glob_hash_node-&gt;mime_type, mime) == 0)
+        {
+          int i;
+
+          globs[*n] = malloc (depth * sizeof (char));
+          for (i = 0; i &lt; depth; i++)
+            globs[*n][depth - i - 1] = prefix[i];
+          globs[*n][depth] = '\0';
+
+          (*n)++;
+        }
+    }
+
+  if (glob_hash_node-&gt;child)
+    {
+      if (!get_simple_globs (glob_hash_node-&gt;child, mime, globs, n_globs, n, prefix, depth + 1))
+        return FALSE;
+    }
+
+  if (glob_hash_node-&gt;next)
+    {
+      if (!get_simple_globs (glob_hash_node-&gt;next, mime, globs, n_globs, n, prefix, depth))
+        return FALSE;
+    }
+
+  return *n &lt; n_globs;
+}
+
+int
+_xdg_glob_hash_get_simple_globs (XdgGlobHash *glob_hash,
+                                 const char  *mime,
+                                 char        *globs[],
+                                 int          n_globs)
+{
+  xdg_unichar_t prefix[25];
+  int n;
+
+  if (!glob_hash || glob_hash-&gt;simple_node == NULL)
+    return 0;
+
+  n = 0;
+  get_simple_globs (glob_hash-&gt;simple_node, xdg_mime_unalias_mime_type (mime), globs, n_globs, &amp;n, prefix, 0);
+
+  return n;
+}
+
+
+/* XdgGlobHash
+ */
+
+XdgGlobHash *
+_xdg_glob_hash_new (void)
+{
+  XdgGlobHash *glob_hash;
+
+  glob_hash = calloc (1, sizeof (XdgGlobHash));
+
+  return glob_hash;
+}
+
+
+static void
+_xdg_glob_hash_free_nodes (XdgGlobHashNode *node)
+{
+  if (node)
+    {
+      if (node-&gt;child)
+       _xdg_glob_hash_free_nodes (node-&gt;child);
+      if (node-&gt;next)
+       _xdg_glob_hash_free_nodes (node-&gt;next);
+      if (node-&gt;mime_type)
+        free ((void *) node-&gt;mime_type);
+      free (node);
+    }
+}
+
+void
+_xdg_glob_hash_free (XdgGlobHash *glob_hash)
+{
+  _xdg_glob_list_free (glob_hash-&gt;literal_list);
+  _xdg_glob_list_free (glob_hash-&gt;full_list);
+  _xdg_glob_hash_free_nodes (glob_hash-&gt;simple_node);
+  free (glob_hash);
+}
+
+XdgGlobType
+_xdg_glob_determine_type (const char *glob)
+{
+  const char *ptr;
+  int maybe_in_simple_glob = FALSE;
+  int first_char = TRUE;
+
+  ptr = glob;
+
+  while (*ptr != '\0')
+    {
+      if (*ptr == '*' &amp;&amp; first_char)
+        maybe_in_simple_glob = TRUE;
+      else if (*ptr == '\\' || *ptr == '[' || *ptr == '?' || *ptr == '*')
+          return XDG_GLOB_FULL;
+
+      first_char = FALSE;
+      ptr = _xdg_utf8_next_char (ptr);
+    }
+  if (maybe_in_simple_glob)
+    return XDG_GLOB_SIMPLE;
+  else
+    return XDG_GLOB_LITERAL;
+}
+
+/* glob must be valid UTF-8 */
+void
+_xdg_glob_hash_append_glob (XdgGlobHash *glob_hash,
+                            const char  *glob,
+                            const char  *mime_type,
+                            int          weight,
+                            int          case_sensitive)
+{
+  XdgGlobType type;
+
+  assert (glob_hash != NULL);
+  assert (glob != NULL);
+
+  type = _xdg_glob_determine_type (glob);
+
+  switch (type)
+    {
+    case XDG_GLOB_LITERAL:
+      glob_hash-&gt;literal_list = _xdg_glob_list_append (glob_hash-&gt;literal_list, strdup (glob), strdup (mime_type), weight, case_sensitive);
+      break;
+    case XDG_GLOB_SIMPLE:
+      glob_hash-&gt;simple_node = _xdg_glob_hash_insert_text (glob_hash-&gt;simple_node, glob + 1, mime_type, weight, case_sensitive);
+      break;
+    case XDG_GLOB_FULL:
+      glob_hash-&gt;full_list = _xdg_glob_list_append (glob_hash-&gt;full_list, strdup (glob), strdup (mime_type), weight, case_sensitive);
+      break;
+    }
+}
+
+void
+_xdg_glob_hash_dump (XdgGlobHash *glob_hash)
+{
+  XdgGlobList *list;
+  printf (&quot;LITERAL STRINGS\n&quot;);
+  if (!glob_hash || glob_hash-&gt;literal_list == NULL)
+    {
+      printf (&quot;    None\n&quot;);
+    }
+  else
+    {
+      for (list = glob_hash-&gt;literal_list; list; list = list-&gt;next)
+        printf (&quot;    %s - %s %d\n&quot;, (char *)list-&gt;data, list-&gt;mime_type, list-&gt;weight);
+    }
+  printf (&quot;\nSIMPLE GLOBS\n&quot;);
+  if (!glob_hash || glob_hash-&gt;simple_node == NULL)
+    {
+      printf (&quot;    None\n&quot;);
+    }
+  else
+    {
+      _xdg_glob_hash_node_dump (glob_hash-&gt;simple_node, 4);
+    }
+
+  printf (&quot;\nFULL GLOBS\n&quot;);
+  if (!glob_hash || glob_hash-&gt;full_list == NULL)
+    {
+      printf (&quot;    None\n&quot;);
+    }
+  else
+    {
+      for (list = glob_hash-&gt;full_list; list; list = list-&gt;next)
+        printf (&quot;    %s - %s %d\n&quot;, (char *)list-&gt;data, list-&gt;mime_type, list-&gt;weight);
+    }
+}
+
+
+void
+_xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash,
+                               const char  *file_name,
+                               int          version_two)
+{
+  FILE *glob_file;
+  char line[255];
+  char *p;
+
+  glob_file = fopen (file_name, &quot;r&quot;);
+
+  if (glob_file == NULL)
+    return;
+
+  /* FIXME: Not UTF-8 safe.  Doesn't work if lines are greater than 255 chars.
+   * Blah */
+  while (fgets (line, 255, glob_file) != NULL)
+    {
+      char *colon;
+      char *mimetype, *glob, *end;
+      int weight;
+      int case_sensitive;
+
+      if (line[0] == '#' || line[0] == 0)
+        continue;
+
+      end = line + strlen(line) - 1;
+      if (*end == '\n')
+        *end = 0;
+
+      p = line;
+      if (version_two)
+        {
+          colon = strchr (p, ':');
+          if (colon == NULL)
+            continue;
+          *colon = 0;
+          weight = atoi (p);
+          p = colon + 1;
+        }
+      else
+        weight = 50;
+
+      colon = strchr (p, ':');
+      if (colon == NULL)
+        continue;
+      *colon = 0;
+
+      mimetype = p;
+      p = colon + 1;
+      glob = p;
+      case_sensitive = FALSE;
+
+      colon = strchr (p, ':');
+      if (version_two &amp;&amp; colon != NULL)
+        {
+          char *flag;
+
+          /* We got flags */
+          *colon = 0;
+          p = colon + 1;
+
+          /* Flags end at next colon */
+          colon = strchr (p, ':');
+          if (colon != NULL)
+            *colon = 0;
+
+          flag = strstr (p, &quot;cs&quot;);
+          if (flag != NULL &amp;&amp;
+              /* Start or after comma */
+              (flag == p ||
+               flag[-1] == ',') &amp;&amp;
+              /* ends with comma or end of string */
+              (flag[2] == 0 ||
+               flag[2] == ','))
+            case_sensitive = TRUE;
+        }
+
+      _xdg_glob_hash_append_glob (glob_hash, glob, mimetype, weight, case_sensitive);
+    }
+
+  fclose (glob_file);
+}
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeglobh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeglob.h: Private file.  Datastructure for storing the globs.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_GLOB_H__
+#define __XDG_MIME_GLOB_H__
+
+#include &quot;xdgmime.h&quot;
+
+typedef struct XdgGlobHash XdgGlobHash;
+
+typedef enum
+{
+  XDG_GLOB_LITERAL, /* Makefile */
+  XDG_GLOB_SIMPLE,  /* *.gif */
+  XDG_GLOB_FULL     /* x*.[ch] */
+} XdgGlobType;
+
+  
+#ifdef XDG_PREFIX
+#define _xdg_mime_glob_read_from_file         XDG_RESERVED_ENTRY(glob_read_from_file)
+#define _xdg_glob_hash_new                    XDG_RESERVED_ENTRY(hash_new)
+#define _xdg_glob_hash_free                   XDG_RESERVED_ENTRY(hash_free)
+#define _xdg_glob_hash_lookup_file_name       XDG_RESERVED_ENTRY(hash_lookup_file_name)
+#define _xdg_glob_hash_get_simple_globs       XDG_RESERVED_ENTRY(hash_get_simple_globs)
+#define _xdg_glob_hash_append_glob            XDG_RESERVED_ENTRY(hash_append_glob)
+#define _xdg_glob_determine_type              XDG_RESERVED_ENTRY(determine_type)
+#define _xdg_glob_hash_dump                   XDG_RESERVED_ENTRY(hash_dump)
+#endif
+
+void         _xdg_mime_glob_read_from_file   (XdgGlobHash *glob_hash,
+                                              const char  *file_name,
+                                              int          version_two);
+XdgGlobHash *_xdg_glob_hash_new              (void);
+void         _xdg_glob_hash_free             (XdgGlobHash *glob_hash);
+int          _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
+                                              const char  *text,
+                                              const char  *mime_types[],
+                                              int          n_mime_types);
+int          _xdg_glob_hash_get_simple_globs (XdgGlobHash *glob_hash,
+                                              const char  *mime,
+                                              char        *globs[],
+                                              int          n_globs);
+void         _xdg_glob_hash_append_glob      (XdgGlobHash *glob_hash,
+                                              const char  *glob,
+                                              const char  *mime_type,
+                                              int          weight,
+                                              int          case_sensitive);
+XdgGlobType  _xdg_glob_determine_type        (const char  *glob);
+void         _xdg_glob_hash_dump             (XdgGlobHash *glob_hash);
+
+#endif /* __XDG_MIME_GLOB_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeglob.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeiconc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,183 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeicon.c: Private file.  Datastructure for storing the aliases.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2008  Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &quot;xdgmimeicon.h&quot;
+#include &quot;xdgmimeint.h&quot;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;assert.h&gt;
+#include &lt;string.h&gt;
+#include &lt;fnmatch.h&gt;
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+typedef struct XdgIcon XdgIcon;
+
+struct XdgIcon 
+{
+  char *mime_type;
+  char *icon_name;
+};
+
+struct XdgIconList
+{
+  struct XdgIcon *icons;
+  int n_icons;
+};
+
+XdgIconList *
+_xdg_mime_icon_list_new (void)
+{
+  XdgIconList *list;
+
+  list = malloc (sizeof (XdgIconList));
+
+  list-&gt;icons = NULL;
+  list-&gt;n_icons = 0;
+
+  return list;
+}
+
+void         
+_xdg_mime_icon_list_free (XdgIconList *list)
+{
+  int i;
+
+  if (list-&gt;icons)
+    {
+      for (i = 0; i &lt; list-&gt;n_icons; i++)
+        {
+          free (list-&gt;icons[i].mime_type);
+          free (list-&gt;icons[i].icon_name);
+        }
+      free (list-&gt;icons);
+    }
+  free (list);
+}
+
+static int
+icon_entry_cmp (const void *v1, const void *v2)
+{
+  return strcmp (((XdgIcon *)v1)-&gt;mime_type, ((XdgIcon *)v2)-&gt;mime_type);
+}
+
+const char  *
+_xdg_mime_icon_list_lookup (XdgIconList *list,
+                            const char  *mime_type)
+{
+  XdgIcon *entry;
+  XdgIcon key;
+
+  if (list-&gt;n_icons &gt; 0)
+    {
+      key.mime_type = (char *)mime_type;
+      key.icon_name = NULL;
+
+      entry = bsearch (&amp;key, list-&gt;icons, list-&gt;n_icons,
+                       sizeof (XdgIcon), icon_entry_cmp);
+      if (entry)
+        return entry-&gt;icon_name;
+    }
+
+  return NULL;
+}
+
+void
+_xdg_mime_icon_read_from_file (XdgIconList *list,
+                               const char   *file_name)
+{
+  FILE *file;
+  char line[255];
+  int alloc;
+
+  file = fopen (file_name, &quot;r&quot;);
+
+  if (file == NULL)
+    return;
+
+  /* FIXME: Not UTF-8 safe.  Doesn't work if lines are greater than 255 chars.
+   * Blah */
+  alloc = list-&gt;n_icons + 16;
+  list-&gt;icons = realloc (list-&gt;icons, alloc * sizeof (XdgIcon));
+  while (fgets (line, 255, file) != NULL)
+    {
+      char *sep;
+      if (line[0] == '#')
+        continue;
+
+      sep = strchr (line, ':');
+      if (sep == NULL)
+        continue;
+      *(sep++) = '\000';
+      sep[strlen (sep) -1] = '\000';
+      if (list-&gt;n_icons == alloc)
+        {
+          alloc &lt;&lt;= 1;
+          list-&gt;icons = realloc (list-&gt;icons, 
+                                   alloc * sizeof (XdgIcon));
+        }
+      list-&gt;icons[list-&gt;n_icons].mime_type = strdup (line);
+      list-&gt;icons[list-&gt;n_icons].icon_name = strdup (sep);
+      list-&gt;n_icons++;
+    }
+  list-&gt;icons = realloc (list-&gt;icons, 
+                           list-&gt;n_icons * sizeof (XdgIcon));
+
+  fclose (file);  
+  
+  if (list-&gt;n_icons &gt; 1)
+    qsort (list-&gt;icons, list-&gt;n_icons, 
+           sizeof (XdgIcon), icon_entry_cmp);
+}
+
+
+void
+_xdg_mime_icon_list_dump (XdgIconList *list)
+{
+  int i;
+
+  if (list-&gt;icons)
+    {
+      for (i = 0; i &lt; list-&gt;n_icons; i++)
+        {
+          printf (&quot;%s %s\n&quot;, 
+                  list-&gt;icons[i].mime_type,
+                  list-&gt;icons[i].icon_name);
+        }
+    }
+}
+
+
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeiconh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeicon.h: Private file.  Datastructure for storing the aliases.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2008  Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_ICON_H__
+#define __XDG_MIME_ICON_H__
+
+#include &quot;xdgmime.h&quot;
+
+typedef struct XdgIconList XdgIconList;
+
+#ifdef XDG_PREFIX
+#define _xdg_mime_icon_read_from_file        XDG_ENTRY(icon_read_from_file)
+#define _xdg_mime_icon_list_new              XDG_ENTRY(icon_list_new)
+#define _xdg_mime_icon_list_free             XDG_ENTRY(icon_list_free)
+#define _xdg_mime_icon_list_lookup           XDG_ENTRY(icon_list_lookup)
+#define _xdg_mime_icon_list_dump             XDG_ENTRY(icon_list_dump)
+#endif
+
+void          _xdg_mime_icon_read_from_file (XdgIconList *list,
+                                            const char   *file_name);
+XdgIconList  *_xdg_mime_icon_list_new       (void);
+void          _xdg_mime_icon_list_free      (XdgIconList *list);
+const char   *_xdg_mime_icon_list_lookup    (XdgIconList *list,
+                                             const char  *mime);
+void          _xdg_mime_icon_list_dump      (XdgIconList *list);
+
+#endif /* __XDG_MIME_ICON_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeicon.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeintc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,206 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeint.c: Internal defines and functions.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &quot;xdgmimeint.h&quot;
+#include &lt;ctype.h&gt;
+#include &lt;string.h&gt;
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+static const char _xdg_utf8_skip_data[256] = {
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+const char * const _xdg_utf8_skip = _xdg_utf8_skip_data;
+
+
+
+/* Returns the number of unprocessed characters. */
+xdg_unichar_t
+_xdg_utf8_to_ucs4(const char *source)
+{
+  xdg_unichar_t ucs32;
+  if( ! ( *source &amp; 0x80 ) )
+    {
+      ucs32 = *source;
+    }
+  else
+    {
+      int bytelength = 0;
+      xdg_unichar_t result;
+      if ( ! (*source &amp; 0x40) )
+        {
+          ucs32 = *source;
+        }
+      else
+        {
+          if ( ! (*source &amp; 0x20) )
+            {
+              result = *source++ &amp; 0x1F;
+              bytelength = 2;
+            }
+          else if ( ! (*source &amp; 0x10) )
+            {
+              result = *source++ &amp; 0x0F;
+              bytelength = 3;
+            }
+          else if ( ! (*source &amp; 0x08) )
+            {
+              result = *source++ &amp; 0x07;
+              bytelength = 4;
+            }
+          else if ( ! (*source &amp; 0x04) )
+            {
+              result = *source++ &amp; 0x03;
+              bytelength = 5;
+            }
+          else if ( ! (*source &amp; 0x02) )
+            {
+              result = *source++ &amp; 0x01;
+              bytelength = 6;
+            }
+          else
+            {
+              result = *source++;
+              bytelength = 1;
+            }
+
+          for ( bytelength --; bytelength &gt; 0; bytelength -- )
+            {
+              result &lt;&lt;= 6;
+              result |= *source++ &amp; 0x3F;
+            }
+          ucs32 = result;
+        }
+    }
+  return ucs32;
+}
+
+
+/* hullo.  this is great code.  don't rewrite it */
+
+xdg_unichar_t
+_xdg_ucs4_to_lower (xdg_unichar_t source)
+{
+  /* FIXME: Do a real to_upper sometime */
+  /* CaseFolding-3.2.0.txt has a table of rules. */
+  if ((source &amp; 0xFF) == source)
+    return (xdg_unichar_t) tolower ((unsigned char) source);
+  return source;
+}
+
+int
+_xdg_utf8_validate (const char *source)
+{
+  /* FIXME: actually write */
+  return TRUE;
+}
+
+const char *
+_xdg_get_base_name (const char *file_name)
+{
+  const char *base_name;
+
+  if (file_name == NULL)
+    return NULL;
+
+  base_name = strrchr (file_name, '/');
+
+  if (base_name == NULL)
+    return file_name;
+  else
+    return base_name + 1;
+}
+
+xdg_unichar_t *
+_xdg_convert_to_ucs4 (const char *source, int *len)
+{
+  xdg_unichar_t *out;
+  int i;
+  const char *p;
+
+  out = malloc (sizeof (xdg_unichar_t) * (strlen (source) + 1));
+
+  p = source;
+  i = 0;
+  while (*p) 
+    {
+      out[i++] = _xdg_utf8_to_ucs4 (p);
+      p = _xdg_utf8_next_char (p); 
+    }
+  out[i] = 0;
+  *len = i;

+  return out;
+}
+
+void
+_xdg_reverse_ucs4 (xdg_unichar_t *source, int len)
+{
+  xdg_unichar_t c;
+  int i;
+
+  for (i = 0; i &lt; len - i - 1; i++) 
+    {
+      c = source[i]; 
+      source[i] = source[len - i - 1];
+      source[len - i - 1] = c;
+    }
+}
+
+const char *
+_xdg_binary_or_text_fallback(const void *data, size_t len)
+{
+  unsigned char *chardata;
+  int i;
+
+  chardata = (unsigned char *) data;
+  for (i = 0; i &lt; 32 &amp;&amp; i &lt; len; ++i)
+    {
+       if (chardata[i] &lt; 32 &amp;&amp; chardata[i] != 9 &amp;&amp; chardata[i] != 10 &amp;&amp; chardata[i] != 13)
+         return XDG_MIME_TYPE_UNKNOWN; /* binary data */
+    }
+
+  return XDG_MIME_TYPE_TEXTPLAIN;
+}
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeinth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeint.h: Internal defines and functions.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_INT_H__
+#define __XDG_MIME_INT_H__
+
+#include &quot;xdgmime.h&quot;
+
+
+#ifndef        FALSE
+#define        FALSE (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE (!FALSE)
+#endif
+
+/* FIXME: Needs to be configure check */
+typedef unsigned int   xdg_unichar_t;
+typedef unsigned char  xdg_uchar8_t;
+typedef unsigned short xdg_uint16_t;
+typedef unsigned int   xdg_uint32_t;
+
+#ifdef XDG_PREFIX
+#define _xdg_utf8_skip       XDG_RESERVED_ENTRY(utf8_skip)
+#define _xdg_utf8_to_ucs4    XDG_RESERVED_ENTRY(utf8_to_ucs4)
+#define _xdg_ucs4_to_lower   XDG_RESERVED_ENTRY(ucs4_to_lower)
+#define _xdg_utf8_validate   XDG_RESERVED_ENTRY(utf8_validate)
+#define _xdg_get_base_name   XDG_RESERVED_ENTRY(get_base_name)
+#define _xdg_convert_to_ucs4 XDG_RESERVED_ENTRY(convert_to_ucs4)
+#define _xdg_reverse_ucs4    XDG_RESERVED_ENTRY(reverse_ucs4)
+#endif
+
+#define SWAP_BE16_TO_LE16(val) (xdg_uint16_t)(((xdg_uint16_t)(val) &lt;&lt; 8)|((xdg_uint16_t)(val) &gt;&gt; 8))
+
+#define SWAP_BE32_TO_LE32(val) (xdg_uint32_t)((((xdg_uint32_t)(val) &amp; 0xFF000000U) &gt;&gt; 24) |        \
+                                              (((xdg_uint32_t)(val) &amp; 0x00FF0000U) &gt;&gt; 8) |        \
+                                              (((xdg_uint32_t)(val) &amp; 0x0000FF00U) &lt;&lt; 8) |        \
+                                              (((xdg_uint32_t)(val) &amp; 0x000000FFU) &lt;&lt; 24))
+/* UTF-8 utils
+ */
+extern const char *const _xdg_utf8_skip;
+#define _xdg_utf8_next_char(p) (char *)((p) + _xdg_utf8_skip[*(unsigned char *)(p)])
+#define _xdg_utf8_char_size(p) (int) (_xdg_utf8_skip[*(unsigned char *)(p)])
+
+xdg_unichar_t  _xdg_utf8_to_ucs4  (const char    *source);
+xdg_unichar_t  _xdg_ucs4_to_lower (xdg_unichar_t  source);
+int            _xdg_utf8_validate (const char    *source);
+xdg_unichar_t *_xdg_convert_to_ucs4 (const char *source, int *len);
+void           _xdg_reverse_ucs4 (xdg_unichar_t *source, int len);
+const char    *_xdg_get_base_name (const char    *file_name);
+const char    *_xdg_binary_or_text_fallback(const void *data, size_t len);
+
+#endif /* __XDG_MIME_INT_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeint.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimemagicc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,816 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimemagic.: Private file.  Datastructure for storing magic files.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &lt;assert.h&gt;
+#include &quot;xdgmimemagic.h&quot;
+#include &quot;xdgmimeint.h&quot;
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;string.h&gt;
+#include &lt;ctype.h&gt;
+#include &lt;errno.h&gt;
+#include &lt;limits.h&gt;
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+#if !defined getc_unlocked &amp;&amp; !defined HAVE_GETC_UNLOCKED
+# define getc_unlocked(fp) getc (fp)
+#endif
+
+typedef struct XdgMimeMagicMatch XdgMimeMagicMatch;
+typedef struct XdgMimeMagicMatchlet XdgMimeMagicMatchlet;
+
+typedef enum
+{
+  XDG_MIME_MAGIC_SECTION,
+  XDG_MIME_MAGIC_MAGIC,
+  XDG_MIME_MAGIC_ERROR,
+  XDG_MIME_MAGIC_EOF
+} XdgMimeMagicState;
+
+struct XdgMimeMagicMatch
+{
+  const char *mime_type;
+  int priority;
+  XdgMimeMagicMatchlet *matchlet;
+  XdgMimeMagicMatch *next;
+};
+
+
+struct XdgMimeMagicMatchlet
+{
+  int indent;
+  int offset;
+  unsigned int value_length;
+  unsigned char *value;
+  unsigned char *mask;
+  unsigned int range_length;
+  unsigned int word_size;
+  XdgMimeMagicMatchlet *next;
+};
+
+
+struct XdgMimeMagic
+{
+  XdgMimeMagicMatch *match_list;
+  int max_extent;
+};
+
+static XdgMimeMagicMatch *
+_xdg_mime_magic_match_new (void)
+{
+  return calloc (1, sizeof (XdgMimeMagicMatch));
+}
+
+
+static XdgMimeMagicMatchlet *
+_xdg_mime_magic_matchlet_new (void)
+{
+  XdgMimeMagicMatchlet *matchlet;
+
+  matchlet = malloc (sizeof (XdgMimeMagicMatchlet));
+
+  matchlet-&gt;indent = 0;
+  matchlet-&gt;offset = 0;
+  matchlet-&gt;value_length = 0;
+  matchlet-&gt;value = NULL;
+  matchlet-&gt;mask = NULL;
+  matchlet-&gt;range_length = 1;
+  matchlet-&gt;word_size = 1;
+  matchlet-&gt;next = NULL;
+
+  return matchlet;
+}
+
+
+static void
+_xdg_mime_magic_matchlet_free (XdgMimeMagicMatchlet *mime_magic_matchlet)
+{
+  if (mime_magic_matchlet)
+    {
+      if (mime_magic_matchlet-&gt;next)
+        _xdg_mime_magic_matchlet_free (mime_magic_matchlet-&gt;next);
+      if (mime_magic_matchlet-&gt;value)
+        free (mime_magic_matchlet-&gt;value);
+      if (mime_magic_matchlet-&gt;mask)
+        free (mime_magic_matchlet-&gt;mask);
+      free (mime_magic_matchlet);
+    }
+}
+
+
+/* Frees mime_magic_match and the remainder of its list
+ */
+static void
+_xdg_mime_magic_match_free (XdgMimeMagicMatch *mime_magic_match)
+{
+  XdgMimeMagicMatch *ptr, *next;
+
+  ptr = mime_magic_match;
+  while (ptr)
+    {
+      next = ptr-&gt;next;
+
+      if (ptr-&gt;mime_type)
+        free ((void *) ptr-&gt;mime_type);
+      if (ptr-&gt;matchlet)
+        _xdg_mime_magic_matchlet_free (ptr-&gt;matchlet);
+      free (ptr);
+
+      ptr = next;
+    }
+}
+
+/* Reads in a hunk of data until a newline character or a '\000' is hit.  The
+ * returned string is null terminated, and doesn't include the newline.
+ */
+static unsigned char *
+_xdg_mime_magic_read_to_newline (FILE *magic_file,
+                                 int  *end_of_file)
+{
+  unsigned char *retval;
+  int c;
+  int len, pos;
+
+  len = 128;
+  pos = 0;
+  retval = malloc (len);
+  *end_of_file = FALSE;
+
+  while (TRUE)
+    {
+      c = getc_unlocked (magic_file);
+      if (c == EOF)
+        {
+          *end_of_file = TRUE;
+          break;
+        }
+      if (c == '\n' || c == '\000')
+        break;
+      retval[pos++] = (unsigned char) c;
+      if (pos % 128 == 127)
+        {
+          len = len + 128;
+          retval = realloc (retval, len);
+        }
+    }
+
+  retval[pos] = '\000';
+  return retval;
+}
+
+/* Returns the number read from the file, or -1 if no number could be read.
+ */
+static int
+_xdg_mime_magic_read_a_number (FILE *magic_file,
+                               int  *end_of_file)
+{
+  /* LONG_MAX is about 20 characters on my system */
+#define MAX_NUMBER_SIZE 30
+  char number_string[MAX_NUMBER_SIZE + 1];
+  int pos = 0;
+  int c;
+  long retval = -1;
+
+  while (TRUE)
+    {
+      c = getc_unlocked (magic_file);
+
+      if (c == EOF)
+        {
+          *end_of_file = TRUE;
+          break;
+        }
+      if (! isdigit (c))
+        {
+          ungetc (c, magic_file);
+          break;
+        }
+      number_string[pos] = (char) c;
+      pos++;
+      if (pos == MAX_NUMBER_SIZE)
+        break;
+    }
+  if (pos &gt; 0)
+    {
+      number_string[pos] = '\000';
+      errno = 0;
+      retval = strtol (number_string, NULL, 10);
+
+      if ((retval &lt; INT_MIN) || (retval &gt; INT_MAX) || (errno != 0))
+        return -1;
+    }
+
+  return retval;
+}
+
+/* Headers are of the format:
+ * [&lt;priority&gt;:&lt;mime-type&gt;]
+ */
+static XdgMimeMagicState
+_xdg_mime_magic_parse_header (FILE *magic_file, XdgMimeMagicMatch *match)
+{
+  int c;
+  char *buffer;
+  char *end_ptr;
+  int end_of_file = 0;
+
+  assert (magic_file != NULL);
+  assert (match != NULL);
+
+  c = getc_unlocked (magic_file);
+  if (c == EOF)
+    return XDG_MIME_MAGIC_EOF;
+  if (c != '[')
+    return XDG_MIME_MAGIC_ERROR;
+
+  match-&gt;priority = _xdg_mime_magic_read_a_number (magic_file, &amp;end_of_file);
+  if (end_of_file)
+    return XDG_MIME_MAGIC_EOF;
+  if (match-&gt;priority == -1)
+    return XDG_MIME_MAGIC_ERROR;
+
+  c = getc_unlocked (magic_file);
+  if (c == EOF)
+    return XDG_MIME_MAGIC_EOF;
+  if (c != ':')
+    return XDG_MIME_MAGIC_ERROR;
+
+  buffer = (char *)_xdg_mime_magic_read_to_newline (magic_file, &amp;end_of_file);
+  if (end_of_file)
+    {
+      free (buffer);
+      return XDG_MIME_MAGIC_EOF;
+    }
+
+  end_ptr = buffer;
+  while (*end_ptr != ']' &amp;&amp; *end_ptr != '\000' &amp;&amp; *end_ptr != '\n')
+    end_ptr++;
+  if (*end_ptr != ']')
+    {
+      free (buffer);
+      return XDG_MIME_MAGIC_ERROR;
+    }
+  *end_ptr = '\000';
+
+  match-&gt;mime_type = strdup (buffer);
+  free (buffer);
+
+  return XDG_MIME_MAGIC_MAGIC;
+}
+
+static XdgMimeMagicState
+_xdg_mime_magic_parse_error (FILE *magic_file)
+{
+  int c;
+
+  while (1)
+    {
+      c = getc_unlocked (magic_file);
+      if (c == EOF)
+        return XDG_MIME_MAGIC_EOF;
+      if (c == '\n')
+        return XDG_MIME_MAGIC_SECTION;
+    }
+}
+
+/* Headers are of the format:
+ * [ indent ] &quot;&gt;&quot; start-offset &quot;=&quot; value
+ * [ &quot;&amp;&quot; mask ] [ &quot;~&quot; word-size ] [ &quot;+&quot; range-length ] &quot;\n&quot;
+ */
+static XdgMimeMagicState
+_xdg_mime_magic_parse_magic_line (FILE              *magic_file,
+                                  XdgMimeMagicMatch *match)
+{
+  XdgMimeMagicMatchlet *matchlet;
+  int c;
+  int end_of_file;
+  int indent = 0;
+  int bytes_read;
+
+  assert (magic_file != NULL);
+
+  /* Sniff the buffer to make sure it's a valid line */
+  c = getc_unlocked (magic_file);
+  if (c == EOF)
+    return XDG_MIME_MAGIC_EOF;
+  else if (c == '[')
+    {
+      ungetc (c, magic_file);
+      return XDG_MIME_MAGIC_SECTION;
+    }
+  else if (c == '\n')
+    return XDG_MIME_MAGIC_MAGIC;
+
+  /* At this point, it must be a digit or a '&gt;' */
+  end_of_file = FALSE;
+  if (isdigit (c))
+    {
+      ungetc (c, magic_file);
+      indent = _xdg_mime_magic_read_a_number (magic_file, &amp;end_of_file);
+      if (end_of_file)
+        return XDG_MIME_MAGIC_EOF;
+      if (indent == -1)
+        return XDG_MIME_MAGIC_ERROR;
+      c = getc_unlocked (magic_file);
+      if (c == EOF)
+        return XDG_MIME_MAGIC_EOF;
+    }
+
+  if (c != '&gt;')
+    return XDG_MIME_MAGIC_ERROR;
+
+  matchlet = _xdg_mime_magic_matchlet_new ();
+  matchlet-&gt;indent = indent;
+  matchlet-&gt;offset = _xdg_mime_magic_read_a_number (magic_file, &amp;end_of_file);
+  if (end_of_file)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_EOF;
+    }
+  if (matchlet-&gt;offset == -1)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_ERROR;
+    }
+  c = getc_unlocked (magic_file);
+  if (c == EOF)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_EOF;
+    }
+  else if (c != '=')
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_ERROR;
+    }
+
+  /* Next two bytes determine how long the value is */
+  matchlet-&gt;value_length = 0;
+  c = getc_unlocked (magic_file);
+  if (c == EOF)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_EOF;
+    }
+  matchlet-&gt;value_length = c &amp; 0xFF;
+  matchlet-&gt;value_length = matchlet-&gt;value_length &lt;&lt; 8;
+
+  c = getc_unlocked (magic_file);
+  if (c == EOF)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_EOF;
+    }
+  matchlet-&gt;value_length = matchlet-&gt;value_length + (c &amp; 0xFF);
+
+  matchlet-&gt;value = malloc (matchlet-&gt;value_length);
+
+  /* OOM */
+  if (matchlet-&gt;value == NULL)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      return XDG_MIME_MAGIC_ERROR;
+    }
+  bytes_read = fread (matchlet-&gt;value, 1, matchlet-&gt;value_length, magic_file);
+  if (bytes_read != matchlet-&gt;value_length)
+    {
+      _xdg_mime_magic_matchlet_free (matchlet);
+      if (feof (magic_file))
+        return XDG_MIME_MAGIC_EOF;
+      else
+        return XDG_MIME_MAGIC_ERROR;
+    }
+
+  c = getc_unlocked (magic_file);
+  if (c == '&amp;')
+    {
+      matchlet-&gt;mask = malloc (matchlet-&gt;value_length);
+      /* OOM */
+      if (matchlet-&gt;mask == NULL)
+        {
+          _xdg_mime_magic_matchlet_free (matchlet);
+          return XDG_MIME_MAGIC_ERROR;
+        }
+      bytes_read = fread (matchlet-&gt;mask, 1, matchlet-&gt;value_length, magic_file);
+      if (bytes_read != matchlet-&gt;value_length)
+        {
+          _xdg_mime_magic_matchlet_free (matchlet);
+          if (feof (magic_file))
+            return XDG_MIME_MAGIC_EOF;
+          else
+            return XDG_MIME_MAGIC_ERROR;
+        }
+      c = getc_unlocked (magic_file);
+    }
+
+  if (c == '~')
+    {
+      matchlet-&gt;word_size = _xdg_mime_magic_read_a_number (magic_file, &amp;end_of_file);
+      if (end_of_file)
+        {
+          _xdg_mime_magic_matchlet_free (matchlet);
+          return XDG_MIME_MAGIC_EOF;
+        }
+      if (matchlet-&gt;word_size != 0 &amp;&amp;
+          matchlet-&gt;word_size != 1 &amp;&amp;
+          matchlet-&gt;word_size != 2 &amp;&amp;
+          matchlet-&gt;word_size != 4)
+        {
+          _xdg_mime_magic_matchlet_free (matchlet);
+          return XDG_MIME_MAGIC_ERROR;
+        }
+      c = getc_unlocked (magic_file);
+    }
+
+  if (c == '+')
+    {
+      matchlet-&gt;range_length = _xdg_mime_magic_read_a_number (magic_file, &amp;end_of_file);
+      if (end_of_file)
+        {
+          _xdg_mime_magic_matchlet_free (matchlet);
+          return XDG_MIME_MAGIC_EOF;
+        }
+      if (matchlet-&gt;range_length == -1)
+        {
+          _xdg_mime_magic_matchlet_free (matchlet);
+          return XDG_MIME_MAGIC_ERROR;
+        }
+      c = getc_unlocked (magic_file);
+    }
+
+
+  if (c == '\n')
+    {
+      /* We clean up the matchlet, byte swapping if needed */
+      if (matchlet-&gt;word_size &gt; 1)
+        {
+          int i;
+          if (matchlet-&gt;value_length % matchlet-&gt;word_size != 0)
+            {
+              _xdg_mime_magic_matchlet_free (matchlet);
+              return XDG_MIME_MAGIC_ERROR;
+            }
+          /* FIXME: need to get this defined in a &lt;config.h&gt; style file */
+#if LITTLE_ENDIAN
+          for (i = 0; i &lt; matchlet-&gt;value_length; i = i + matchlet-&gt;word_size)
+            {
+              if (matchlet-&gt;word_size == 2)
+                *((xdg_uint16_t *) matchlet-&gt;value + i) = SWAP_BE16_TO_LE16 (*((xdg_uint16_t *) (matchlet-&gt;value + i)));
+              else if (matchlet-&gt;word_size == 4)
+                *((xdg_uint32_t *) matchlet-&gt;value + i) = SWAP_BE32_TO_LE32 (*((xdg_uint32_t *) (matchlet-&gt;value + i)));
+              if (matchlet-&gt;mask)
+                {
+                  if (matchlet-&gt;word_size == 2)
+                    *((xdg_uint16_t *) matchlet-&gt;mask + i) = SWAP_BE16_TO_LE16 (*((xdg_uint16_t *) (matchlet-&gt;mask + i)));
+                  else if (matchlet-&gt;word_size == 4)
+                    *((xdg_uint32_t *) matchlet-&gt;mask + i) = SWAP_BE32_TO_LE32 (*((xdg_uint32_t *) (matchlet-&gt;mask + i)));
+
+                }
+            }
+#endif
+        }
+
+      matchlet-&gt;next = match-&gt;matchlet;
+      match-&gt;matchlet = matchlet;
+
+
+      return XDG_MIME_MAGIC_MAGIC;
+    }
+
+  _xdg_mime_magic_matchlet_free (matchlet);
+  if (c == EOF)
+    return XDG_MIME_MAGIC_EOF;
+
+  return XDG_MIME_MAGIC_ERROR;
+}
+
+static int
+_xdg_mime_magic_matchlet_compare_to_data (XdgMimeMagicMatchlet *matchlet,
+                                          const void           *data,
+                                          size_t                len)
+{
+  int i, j;
+  for (i = matchlet-&gt;offset; i &lt; matchlet-&gt;offset + matchlet-&gt;range_length; i++)
+    {
+      int valid_matchlet = TRUE;
+
+      if (i + matchlet-&gt;value_length &gt; len)
+        return FALSE;
+
+      if (matchlet-&gt;mask)
+        {
+          for (j = 0; j &lt; matchlet-&gt;value_length; j++)
+            {
+              if ((matchlet-&gt;value[j] &amp; matchlet-&gt;mask[j]) !=
+                  ((((unsigned char *) data)[j + i]) &amp; matchlet-&gt;mask[j]))
+                {
+                  valid_matchlet = FALSE;
+                  break;
+                }
+            }
+        }
+      else
+        {
+          for (j = 0; j &lt;  matchlet-&gt;value_length; j++)
+            {
+              if (matchlet-&gt;value[j] != ((unsigned char *) data)[j + i])
+                {
+                  valid_matchlet = FALSE;
+                  break;
+                }
+            }
+        }
+      if (valid_matchlet)
+        return TRUE;
+    }
+  return FALSE;
+}
+
+static int
+_xdg_mime_magic_matchlet_compare_level (XdgMimeMagicMatchlet *matchlet,
+                                        const void           *data,
+                                        size_t                len,
+                                        int                   indent)
+{
+  while ((matchlet != NULL) &amp;&amp; (matchlet-&gt;indent == indent))
+    {
+      if (_xdg_mime_magic_matchlet_compare_to_data (matchlet, data, len))
+        {
+          if ((matchlet-&gt;next == NULL) ||
+              (matchlet-&gt;next-&gt;indent &lt;= indent))
+            return TRUE;
+
+          if (_xdg_mime_magic_matchlet_compare_level (matchlet-&gt;next,
+                                                      data,
+                                                      len,
+                                                      indent + 1))
+            return TRUE;
+        }
+
+      do
+        {
+          matchlet = matchlet-&gt;next;
+        }
+      while (matchlet &amp;&amp; matchlet-&gt;indent &gt; indent);
+    }
+
+  return FALSE;
+}
+
+static int
+_xdg_mime_magic_match_compare_to_data (XdgMimeMagicMatch *match,
+                                       const void        *data,
+                                       size_t             len)
+{
+  return _xdg_mime_magic_matchlet_compare_level (match-&gt;matchlet, data, len, 0);
+}
+
+static void
+_xdg_mime_magic_insert_match (XdgMimeMagic      *mime_magic,
+                              XdgMimeMagicMatch *match)
+{
+  XdgMimeMagicMatch *list;
+
+  if (mime_magic-&gt;match_list == NULL)
+    {
+      mime_magic-&gt;match_list = match;
+      return;
+    }
+
+  if (match-&gt;priority &gt; mime_magic-&gt;match_list-&gt;priority)
+    {
+      match-&gt;next = mime_magic-&gt;match_list;
+      mime_magic-&gt;match_list = match;
+      return;
+    }
+
+  list = mime_magic-&gt;match_list;
+  while (list-&gt;next != NULL)
+    {
+      if (list-&gt;next-&gt;priority &lt; match-&gt;priority)
+        {
+          match-&gt;next = list-&gt;next;
+          list-&gt;next = match;
+          return;
+        }
+      list = list-&gt;next;
+    }
+  list-&gt;next = match;
+  match-&gt;next = NULL;
+}
+
+XdgMimeMagic *
+_xdg_mime_magic_new (void)
+{
+  return calloc (1, sizeof (XdgMimeMagic));
+}
+
+void
+_xdg_mime_magic_free (XdgMimeMagic *mime_magic)
+{
+  if (mime_magic) {
+    _xdg_mime_magic_match_free (mime_magic-&gt;match_list);
+    free (mime_magic);
+  }
+}
+
+int
+_xdg_mime_magic_get_buffer_extents (XdgMimeMagic *mime_magic)
+{
+  return mime_magic-&gt;max_extent;
+}
+
+const char *
+_xdg_mime_magic_lookup_data (XdgMimeMagic *mime_magic,
+                             const void   *data,
+                             size_t        len,
+                             int           *result_prio,
+                             const char   *mime_types[],
+                             int           n_mime_types)
+{
+  XdgMimeMagicMatch *match;
+  const char *mime_type;
+  int n;
+  int prio;
+
+  prio = 0;
+  mime_type = NULL;
+  for (match = mime_magic-&gt;match_list; match; match = match-&gt;next)
+    {
+      if (_xdg_mime_magic_match_compare_to_data (match, data, len))
+        {
+          prio = match-&gt;priority;
+          mime_type = match-&gt;mime_type;
+          break;
+        }
+      else 
+        {
+          for (n = 0; n &lt; n_mime_types; n++)
+            {
+              if (mime_types[n] &amp;&amp; 
+                  _xdg_mime_mime_type_equal (mime_types[n], match-&gt;mime_type))
+                mime_types[n] = NULL;
+            }
+        }
+    }
+
+  if (mime_type == NULL)
+    {
+      for (n = 0; n &lt; n_mime_types; n++)
+        {
+          if (mime_types[n])
+            mime_type = mime_types[n];
+        }
+    }
+  
+  if (result_prio)
+    *result_prio = prio;
+
+  return mime_type;
+}
+
+static void
+_xdg_mime_update_mime_magic_extents (XdgMimeMagic *mime_magic)
+{
+  XdgMimeMagicMatch *match;
+  int max_extent = 0;
+
+  for (match = mime_magic-&gt;match_list; match; match = match-&gt;next)
+    {
+      XdgMimeMagicMatchlet *matchlet;
+
+      for (matchlet = match-&gt;matchlet; matchlet; matchlet = matchlet-&gt;next)
+        {
+          int extent;
+
+          extent = matchlet-&gt;value_length + matchlet-&gt;offset + matchlet-&gt;range_length;
+          if (max_extent &lt; extent)
+            max_extent = extent;
+        }
+    }
+
+  mime_magic-&gt;max_extent = max_extent;
+}
+
+static XdgMimeMagicMatchlet *
+_xdg_mime_magic_matchlet_mirror (XdgMimeMagicMatchlet *matchlets)
+{
+  XdgMimeMagicMatchlet *new_list;
+  XdgMimeMagicMatchlet *tmp;
+
+  if ((matchlets == NULL) || (matchlets-&gt;next == NULL))
+    return matchlets;
+
+  new_list = NULL;
+  tmp = matchlets;
+  while (tmp != NULL)
+    {
+      XdgMimeMagicMatchlet *matchlet;
+
+      matchlet = tmp;
+      tmp = tmp-&gt;next;
+      matchlet-&gt;next = new_list;
+      new_list = matchlet;
+    }
+
+  return new_list;
+
+}
+
+static void
+_xdg_mime_magic_read_magic_file (XdgMimeMagic *mime_magic,
+                                 FILE         *magic_file)
+{
+  XdgMimeMagicState state;
+  XdgMimeMagicMatch *match = NULL; /* Quiet compiler */
+
+  state = XDG_MIME_MAGIC_SECTION;
+
+  while (state != XDG_MIME_MAGIC_EOF)
+    {
+      switch (state)
+        {
+        case XDG_MIME_MAGIC_SECTION:
+          match = _xdg_mime_magic_match_new ();
+          state = _xdg_mime_magic_parse_header (magic_file, match);
+          if (state == XDG_MIME_MAGIC_EOF || state == XDG_MIME_MAGIC_ERROR)
+            _xdg_mime_magic_match_free (match);
+          break;
+        case XDG_MIME_MAGIC_MAGIC:
+          state = _xdg_mime_magic_parse_magic_line (magic_file, match);
+          if (state == XDG_MIME_MAGIC_SECTION ||
+              (state == XDG_MIME_MAGIC_EOF &amp;&amp; match-&gt;mime_type))
+            {
+              match-&gt;matchlet = _xdg_mime_magic_matchlet_mirror (match-&gt;matchlet);
+              _xdg_mime_magic_insert_match (mime_magic, match);
+            }
+          else if (state == XDG_MIME_MAGIC_EOF || state == XDG_MIME_MAGIC_ERROR)
+            _xdg_mime_magic_match_free (match);
+          break;
+        case XDG_MIME_MAGIC_ERROR:
+          state = _xdg_mime_magic_parse_error (magic_file);
+          break;
+        case XDG_MIME_MAGIC_EOF:
+        default:
+          /* Make the compiler happy */
+          assert (0);
+        }
+    }
+  _xdg_mime_update_mime_magic_extents (mime_magic);
+}
+
+void
+_xdg_mime_magic_read_from_file (XdgMimeMagic *mime_magic,
+                                const char   *file_name)
+{
+  FILE *magic_file;
+  char header[12];
+
+  magic_file = fopen (file_name, &quot;r&quot;);
+
+  if (magic_file == NULL)
+    return;
+
+  if (fread (header, 1, 12, magic_file) == 12)
+    {
+      if (memcmp (&quot;MIME-Magic\0\n&quot;, header, 12) == 0)
+        _xdg_mime_magic_read_magic_file (mime_magic, magic_file);
+    }
+
+  fclose (magic_file);
+}
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimemagich"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimemagic.h: Private file.  Datastructure for storing the magic files.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2003  Red Hat, Inc.
+ * Copyright (C) 2003  Jonathan Blandford &lt;jrb@alum.mit.edu&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_MAGIC_H__
+#define __XDG_MIME_MAGIC_H__
+
+#include &lt;unistd.h&gt;
+#include &quot;xdgmime.h&quot;
+typedef struct XdgMimeMagic XdgMimeMagic;
+
+#ifdef XDG_PREFIX
+#define _xdg_mime_glob_read_from_file             XDG_RESERVED_ENTRY(glob_read_from_file)
+#define _xdg_mime_magic_new                       XDG_RESERVED_ENTRY(magic_new)
+#define _xdg_mime_magic_read_from_file            XDG_RESERVED_ENTRY(magic_read_from_file)
+#define _xdg_mime_magic_free                      XDG_RESERVED_ENTRY(magic_free)
+#define _xdg_mime_magic_get_buffer_extents        XDG_RESERVED_ENTRY(magic_get_buffer_extents)
+#define _xdg_mime_magic_lookup_data               XDG_RESERVED_ENTRY(magic_lookup_data)
+#endif
+
+
+XdgMimeMagic *_xdg_mime_magic_new                (void);
+void          _xdg_mime_magic_read_from_file     (XdgMimeMagic *mime_magic,
+                                                  const char   *file_name);
+void          _xdg_mime_magic_free               (XdgMimeMagic *mime_magic);
+int           _xdg_mime_magic_get_buffer_extents (XdgMimeMagic *mime_magic);
+const char   *_xdg_mime_magic_lookup_data        (XdgMimeMagic *mime_magic,
+                                                  const void   *data,
+                                                  size_t        len,
+                                                  int          *result_prio,
+                                                  const char   *mime_types[],
+                                                  int           n_mime_types);
+
+#endif /* __XDG_MIME_MAGIC_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimemagic.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeparentc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.c (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.c        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.c        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,219 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimealias.c: Private file.  Datastructure for storing the hierarchy.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2004  Red Hat, Inc.
+ * Copyright (C) 2004  Matthias Clasen &lt;mclasen@redhat.com&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include &quot;cmakeconfig.h&quot;
+#endif
+
+#include &quot;xdgmimeparent.h&quot;
+#include &quot;xdgmimeint.h&quot;
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;assert.h&gt;
+#include &lt;string.h&gt;
+#include &lt;fnmatch.h&gt;
+
+#ifndef        FALSE
+#define        FALSE        (0)
+#endif
+
+#ifndef        TRUE
+#define        TRUE        (!FALSE)
+#endif
+
+typedef struct XdgMimeParents XdgMimeParents;
+
+struct XdgMimeParents
+{
+  char *mime;
+  char **parents;
+  int n_parents;
+};
+
+struct XdgParentList
+{
+  struct XdgMimeParents *parents;
+  int n_mimes;
+};
+
+XdgParentList *
+_xdg_mime_parent_list_new (void)
+{
+  XdgParentList *list;
+
+  list = malloc (sizeof (XdgParentList));
+
+  list-&gt;parents = NULL;
+  list-&gt;n_mimes = 0;
+
+  return list;
+}
+
+void         
+_xdg_mime_parent_list_free (XdgParentList *list)
+{
+  int i;
+  char **p;
+
+  if (list-&gt;parents)
+    {
+      for (i = 0; i &lt; list-&gt;n_mimes; i++)
+        {
+          for (p = list-&gt;parents[i].parents; *p; p++)
+            free (*p);
+
+          free (list-&gt;parents[i].parents);
+          free (list-&gt;parents[i].mime);
+        }
+      free (list-&gt;parents);
+    }
+  free (list);
+}
+
+static int
+parent_entry_cmp (const void *v1, const void *v2)
+{
+  return strcmp (((XdgMimeParents *)v1)-&gt;mime, ((XdgMimeParents *)v2)-&gt;mime);
+}
+
+const char **
+_xdg_mime_parent_list_lookup (XdgParentList *list,
+                              const char    *mime)
+{
+  XdgMimeParents *entry;
+  XdgMimeParents key;
+
+  if (list-&gt;n_mimes &gt; 0)
+    {
+      key.mime = (char *)mime;
+      key.parents = NULL;
+
+      entry = bsearch (&amp;key, list-&gt;parents, list-&gt;n_mimes,
+                       sizeof (XdgMimeParents), &amp;parent_entry_cmp);
+      if (entry)
+        return (const char **)entry-&gt;parents;
+    }
+
+  return NULL;
+}
+
+void
+_xdg_mime_parent_read_from_file (XdgParentList *list,
+                                 const char    *file_name)
+{
+  FILE *file;
+  char line[255];
+  int i, alloc;
+  XdgMimeParents *entry;
+
+  file = fopen (file_name, &quot;r&quot;);
+
+  if (file == NULL)
+    return;
+
+  /* FIXME: Not UTF-8 safe.  Doesn't work if lines are greater than 255 chars.
+   * Blah */
+  alloc = list-&gt;n_mimes + 16;
+  list-&gt;parents = realloc (list-&gt;parents, alloc * sizeof (XdgMimeParents));
+  while (fgets (line, 255, file) != NULL)
+    {
+      char *sep;
+      if (line[0] == '#')
+        continue;
+
+      sep = strchr (line, ' ');
+      if (sep == NULL)
+        continue;
+      *(sep++) = '\000';
+      sep[strlen (sep) -1] = '\000';
+      entry = NULL;
+      for (i = 0; i &lt; list-&gt;n_mimes; i++)
+        {
+          if (strcmp (list-&gt;parents[i].mime, line) == 0)
+            {
+              entry = &amp;(list-&gt;parents[i]);
+              break;
+            }
+        }
+      
+      if (!entry)
+        {
+          if (list-&gt;n_mimes == alloc)
+            {
+              alloc &lt;&lt;= 1;
+              list-&gt;parents = realloc (list-&gt;parents, 
+                                       alloc * sizeof (XdgMimeParents));
+            }
+          list-&gt;parents[list-&gt;n_mimes].mime = strdup (line);
+          list-&gt;parents[list-&gt;n_mimes].parents = NULL;
+          entry = &amp;(list-&gt;parents[list-&gt;n_mimes]);
+          list-&gt;n_mimes++;
+        }
+
+      if (!entry-&gt;parents)
+        {
+          entry-&gt;n_parents = 1;
+          entry-&gt;parents = malloc ((entry-&gt;n_parents + 1) * sizeof (char *));
+        }
+      else
+        {
+          entry-&gt;n_parents += 1;
+          entry-&gt;parents = realloc (entry-&gt;parents, 
+                                    (entry-&gt;n_parents + 2) * sizeof (char *));
+        }
+      entry-&gt;parents[entry-&gt;n_parents - 1] = strdup (sep);
+      entry-&gt;parents[entry-&gt;n_parents] = NULL;
+    }
+
+  list-&gt;parents = realloc (list-&gt;parents, 
+                           list-&gt;n_mimes * sizeof (XdgMimeParents));
+
+  fclose (file);  
+  
+  if (list-&gt;n_mimes &gt; 1)
+    qsort (list-&gt;parents, list-&gt;n_mimes, 
+           sizeof (XdgMimeParents), &amp;parent_entry_cmp);
+}
+
+
+void         
+_xdg_mime_parent_list_dump (XdgParentList *list)
+{
+  int i;
+  char **p;
+
+  if (list-&gt;parents)
+    {
+      for (i = 0; i &lt; list-&gt;n_mimes; i++)
+        {
+          for (p = list-&gt;parents[i].parents; *p; p++)
+            printf (&quot;%s %s\n&quot;, list-&gt;parents[i].mime, *p);
+        }
+    }
+}
+
+
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.c
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceThirdPartyxdgmimesrcxdgmimeparenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.h (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.h        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.h        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/* -*- mode: C; c-file-style: &quot;gnu&quot; -*- */
+/* xdgmimeparent.h: Private file.  Datastructure for storing the hierarchy.
+ *
+ * More info can be found at http://www.freedesktop.org/standards/
+ *
+ * Copyright (C) 2004  Red Hat, Inc.
+ * Copyright (C) 200  Matthias Clasen &lt;mclasen@redhat.com&gt;
+ *
+ * Licensed under the Academic Free License version 2.0
+ * Or under the following terms:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XDG_MIME_PARENT_H__
+#define __XDG_MIME_PARENT_H__
+
+#include &quot;xdgmime.h&quot;
+
+typedef struct XdgParentList XdgParentList;
+
+#ifdef XDG_PREFIX
+#define _xdg_mime_parent_read_from_file        XDG_RESERVED_ENTRY(parent_read_from_file)
+#define _xdg_mime_parent_list_new              XDG_RESERVED_ENTRY(parent_list_new)
+#define _xdg_mime_parent_list_free             XDG_RESERVED_ENTRY(parent_list_free)
+#define _xdg_mime_parent_list_lookup           XDG_RESERVED_ENTRY(parent_list_lookup)
+#define _xdg_mime_parent_list_dump             XDG_RESERVED_ENTRY(parent_list_dump)
+#endif
+
+void          _xdg_mime_parent_read_from_file (XdgParentList *list,
+                                               const char    *file_name);
+XdgParentList *_xdg_mime_parent_list_new       (void);
+void           _xdg_mime_parent_list_free      (XdgParentList *list);
+const char   **_xdg_mime_parent_list_lookup    (XdgParentList *list,
+                                                const char    *mime);
+void           _xdg_mime_parent_list_dump      (XdgParentList *list);
+
+#endif /* __XDG_MIME_PARENT_H__ */
</ins><span class="cx">Property changes on: trunk/Source/ThirdParty/xdgmime/src/xdgmimeparent.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="allowtabs"></a>
<div class="addfile"><h4>Added: allow-tabs</h4></div>
<ins>+yes
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -3493,6 +3493,11 @@
</span><span class="cx">   list(APPEND WebCore_LIBRARIES woff2)
</span><span class="cx"> endif ()
</span><span class="cx"> 
</span><ins>+if (USE_XDGMIME)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES &quot;${THIRDPARTY_DIR}/xdgmime/src&quot;)
+    list(APPEND WebCore_LIBRARIES xdgmime)
+endif ()
+
</ins><span class="cx"> set(WebCoreTestSupport_INCLUDE_DIRECTORIES
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/mock&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/testing&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/WebCore/ChangeLog        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-03-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
+        https://bugs.webkit.org/show_bug.cgi?id=170001
+
+        Reviewed by Michael Catanzaro.
+
+        The XDG implementation could be used by any port where shared-mime-info is expected to be available. It also
+        improves the current GTK+ implementation that is based on a very small map of mime types and extensions.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+        * platform/xdg/MIMETypeRegistryXdg.cpp: Renamed from Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp.
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
+
</ins><span class="cx"> 2017-03-23  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update createDataChannel on RTCPeerConnection
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -141,7 +141,6 @@
</span><span class="cx">     platform/gtk/DragDataGtk.cpp
</span><span class="cx">     platform/gtk/ErrorsGtk.cpp
</span><span class="cx">     platform/gtk/LocalizedStringsGtk.cpp
</span><del>-    platform/gtk/MIMETypeRegistryGtk.cpp
</del><span class="cx">     platform/gtk/PasteboardGtk.cpp
</span><span class="cx">     platform/gtk/ScrollAnimatorGtk.cpp
</span><span class="cx">     platform/gtk/SelectionData.cpp
</span><span class="lines">@@ -179,6 +178,8 @@
</span><span class="cx">     platform/text/hyphen/HyphenationLibHyphen.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/unix/LoggingUnix.cpp
</span><ins>+
+    platform/xdg/MIMETypeRegistryXdg.cpp
</ins><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> list(APPEND WebCorePlatformGTK_SOURCES
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkMIMETypeRegistryGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -1,86 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 Zack Rusin &lt;zack@kde.org&gt;
- * Copyright (C) 2006 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;MIMETypeRegistry.h&quot;
-
-namespace WebCore {
-
-struct ExtensionMap {
-    const char* extension;
-    const char* mimeType;
-};
-
-static const ExtensionMap extensionMap [] = {
-    { &quot;bmp&quot;, &quot;image/bmp&quot; },
-    { &quot;css&quot;, &quot;text/css&quot; },
-    { &quot;gif&quot;, &quot;image/gif&quot; },
-    { &quot;html&quot;, &quot;text/html&quot; },
-    { &quot;htm&quot;, &quot;text/html&quot; },
-    { &quot;ico&quot;, &quot;image/x-icon&quot; },
-    { &quot;jpeg&quot;, &quot;image/jpeg&quot; },
-    { &quot;jpg&quot;, &quot;image/jpeg&quot; },
-    { &quot;js&quot;, &quot;application/x-javascript&quot; },
-    { &quot;pdf&quot;, &quot;application/pdf&quot; },
-    { &quot;png&quot;, &quot;image/png&quot; },
-    { &quot;rss&quot;, &quot;application/rss+xml&quot; },
-    { &quot;svg&quot;, &quot;image/svg+xml&quot; },
-    { &quot;swf&quot;, &quot;application/x-shockwave-flash&quot; },
-    { &quot;text&quot;, &quot;text/plain&quot; },
-    { &quot;txt&quot;, &quot;text/plain&quot; },
-    { &quot;xbm&quot;, &quot;image/x-xbitmap&quot; },
-    { &quot;xml&quot;, &quot;text/xml&quot; },
-    { &quot;xsl&quot;, &quot;text/xsl&quot; },
-    { &quot;xhtml&quot;, &quot;application/xhtml+xml&quot; },
-    { &quot;wml&quot;, &quot;text/vnd.wap.wml&quot; },
-    { &quot;wmlc&quot;, &quot;application/vnd.wap.wmlc&quot; },
-};
-
-String MIMETypeRegistry::getMIMETypeForExtension(const String&amp; extension)
-{
-    for (auto&amp; entry : extensionMap) {
-        if (equalIgnoringASCIICase(extension, entry.extension))
-            return entry.mimeType;
-    }
-    return String();
-}
-
-bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&amp;)
-{
-    return false;
-}
-
-String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String&amp; mimeType)
-{
-    for (auto&amp; entry : extensionMap) {
-        if (equalIgnoringASCIICase(mimeType, entry.mimeType))
-            return entry.extension;
-    }
-    return emptyString();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformxdgMIMETypeRegistryXdgcppfromrev214337trunkSourceWebCoreplatformgtkMIMETypeRegistryGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp (from rev 214337, trunk/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp) (0 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/xdg/MIMETypeRegistryXdg.cpp        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MIMETypeRegistry.h&quot;
+
+#define XDG_PREFIX _wk_xdg
+#include &quot;xdgmime.h&quot;
+
+namespace WebCore {
+
+String MIMETypeRegistry::getMIMETypeForExtension(const String&amp; extension)
+{
+    if (extension.isEmpty())
+        return String();
+
+    // Build any filename with the given extension.
+    String filename = &quot;a.&quot; + extension;
+    if (const char* mimeType = xdg_mime_get_mime_type_from_file_name(filename.utf8().data()))
+        return String::fromUTF8(mimeType);
+
+    return String();
+}
+
+bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&amp;)
+{
+    return false;
+}
+
+String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String&amp; mimeType)
+{
+    if (mimeType.isEmpty())
+        return String();
+
+    String returnValue;
+    char* extension;
+    if (xdg_mime_get_simple_globs(mimeType.utf8().data(), &amp;extension, 1)) {
+        if (extension[0] == '.' &amp;&amp; extension[1])
+            returnValue = String::fromUTF8(extension + 1);
+        free(extension);
+    }
+    return returnValue;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourcecmakeOptionsGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/cmake/OptionsGTK.cmake (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/cmake/OptionsGTK.cmake        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Source/cmake/OptionsGTK.cmake        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> WEBKIT_OPTION_BEGIN()
</span><span class="cx"> 
</span><span class="cx"> set(USE_WOFF2 ON)
</span><ins>+set(USE_XDGMIME ON)
</ins><span class="cx"> 
</span><span class="cx"> # For old versions of HarfBuzz that do not expose an API for the OpenType MATH
</span><span class="cx"> # table, we enable our own code to parse that table.
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Tools/ChangeLog        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-03-24  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Add MIMETypeRegistry implementation using xdgmime and remove the GTK+ one
+        https://bugs.webkit.org/show_bug.cgi?id=170001
+
+        Reviewed by Michael Catanzaro.
+
+        Ignore style of xdgmime sources.
+
+        * Scripts/webkitpy/tool/steps/checkstyle.py:
+
</ins><span class="cx"> 2017-03-23  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Dragging on a large image should not revert to a file icon if data interaction is enabled
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpystylecheckerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/style/checker.py (214337 => 214338)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/style/checker.py        2017-03-24 08:07:17 UTC (rev 214337)
+++ trunk/Tools/Scripts/webkitpy/style/checker.py        2017-03-24 08:21:21 UTC (rev 214338)
</span><span class="lines">@@ -224,7 +224,8 @@
</span><span class="cx">     ([os.path.join('webkitpy', 'thirdparty'),
</span><span class="cx">       os.path.join('Source', 'ThirdParty', 'ANGLE'),
</span><span class="cx">       os.path.join('Source', 'ThirdParty', 'brotli'),
</span><del>-      os.path.join('Source', 'ThirdParty', 'woff2')],
</del><ins>+      os.path.join('Source', 'ThirdParty', 'woff2'),
+      os.path.join('Source', 'ThirdParty', 'xdgmime')],
</ins><span class="cx">      [&quot;-&quot;,
</span><span class="cx">       &quot;+pep8/W191&quot;,  # Tabs
</span><span class="cx">       &quot;+pep8/W291&quot;,  # Trailing white space
</span></span></pre>
</div>
</div>

</body>
</html>