winemenubuilder: Return pointer from freedesktop_mime_type_for_extension.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fe96d12a89
commit
38eb26f047
|
@ -1874,29 +1874,26 @@ static BOOL build_native_mime_types(struct list *mime_types)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL freedesktop_mime_type_for_extension(struct list *native_mime_types,
|
static WCHAR *freedesktop_mime_type_for_extension(struct list *native_mime_types,
|
||||||
LPCWSTR extensionW,
|
const WCHAR *extensionW)
|
||||||
WCHAR **match)
|
|
||||||
{
|
{
|
||||||
struct xdg_mime_type *mime_type_entry;
|
struct xdg_mime_type *mime_type_entry;
|
||||||
int matchLength = 0;
|
int matchLength = 0;
|
||||||
|
const WCHAR* match = NULL;
|
||||||
*match = NULL;
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(mime_type_entry, native_mime_types, struct xdg_mime_type, entry)
|
LIST_FOR_EACH_ENTRY(mime_type_entry, native_mime_types, struct xdg_mime_type, entry)
|
||||||
{
|
{
|
||||||
if (PathMatchSpecW( extensionW, mime_type_entry->glob ))
|
if (PathMatchSpecW( extensionW, mime_type_entry->glob ))
|
||||||
{
|
{
|
||||||
if (*match == NULL || matchLength < lstrlenW(mime_type_entry->glob))
|
if (match == NULL || matchLength < lstrlenW(mime_type_entry->glob))
|
||||||
{
|
{
|
||||||
*match = mime_type_entry->mimeType;
|
match = mime_type_entry->mimeType;
|
||||||
matchLength = lstrlenW(mime_type_entry->glob);
|
matchLength = lstrlenW(mime_type_entry->glob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*match != NULL) *match = xwcsdup(*match);
|
return match ? xwcsdup(match) : NULL;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static WCHAR* reg_get_valW(HKEY key, LPCWSTR subkey, LPCWSTR name)
|
static WCHAR* reg_get_valW(HKEY key, LPCWSTR subkey, LPCWSTR name)
|
||||||
|
@ -2190,8 +2187,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
|
||||||
if (contentTypeW)
|
if (contentTypeW)
|
||||||
wcslwr(contentTypeW);
|
wcslwr(contentTypeW);
|
||||||
|
|
||||||
if (!freedesktop_mime_type_for_extension(&nativeMimeTypes, extensionW, &mimeType))
|
mimeType = freedesktop_mime_type_for_extension(&nativeMimeTypes, extensionW);
|
||||||
goto end;
|
|
||||||
|
|
||||||
if (mimeType == NULL)
|
if (mimeType == NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue