Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f2538c6e
Commit
f2538c6e
authored
Dec 22, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Simplify MIME types list management.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c9fb3b7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
32 deletions
+21
-32
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+21
-32
No files found.
programs/winemenubuilder/winemenubuilder.c
View file @
f2538c6e
...
...
@@ -2102,16 +2102,13 @@ static void free_native_mime_types(struct list *native_mime_types)
HeapFree
(
GetProcessHeap
(),
0
,
mime_type_entry
->
mimeType
);
HeapFree
(
GetProcessHeap
(),
0
,
mime_type_entry
);
}
HeapFree
(
GetProcessHeap
(),
0
,
native_mime_types
);
}
static
BOOL
build_native_mime_types
(
const
char
*
xdg_data_home
,
struct
list
*
*
mime_types
)
static
BOOL
build_native_mime_types
(
const
char
*
xdg_data_home
,
struct
list
*
mime_types
)
{
char
*
xdg_data_dirs
;
BOOL
ret
;
*
mime_types
=
NULL
;
xdg_data_dirs
=
getenv
(
"XDG_DATA_DIRS"
);
if
(
xdg_data_dirs
==
NULL
)
xdg_data_dirs
=
heap_printf
(
"/usr/local/share/:/usr/share/"
);
...
...
@@ -2120,39 +2117,29 @@ static BOOL build_native_mime_types(const char *xdg_data_home, struct list **mim
if
(
xdg_data_dirs
)
{
*
mime_types
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
list
));
if
(
*
mime_types
)
{
const
char
*
begin
;
char
*
end
;
const
char
*
begin
;
char
*
end
;
list_init
(
*
mime_types
);
ret
=
add_mimes
(
xdg_data_home
,
*
mime_types
);
if
(
ret
)
ret
=
add_mimes
(
xdg_data_home
,
mime_types
);
if
(
ret
)
{
for
(
begin
=
xdg_data_dirs
;
(
end
=
strchr
(
begin
,
':'
));
begin
=
end
+
1
)
{
for
(
begin
=
xdg_data_dirs
;
(
end
=
strchr
(
begin
,
':'
));
begin
=
end
+
1
)
{
*
end
=
'\0'
;
ret
=
add_mimes
(
begin
,
*
mime_types
);
*
end
=
':'
;
if
(
!
ret
)
break
;
}
if
(
ret
)
ret
=
add_mimes
(
begin
,
*
mime_types
);
*
end
=
'\0'
;
ret
=
add_mimes
(
begin
,
mime_types
);
*
end
=
':'
;
if
(
!
ret
)
break
;
}
if
(
ret
)
ret
=
add_mimes
(
begin
,
mime_types
);
}
else
ret
=
FALSE
;
HeapFree
(
GetProcessHeap
(),
0
,
xdg_data_dirs
);
}
else
ret
=
FALSE
;
if
(
!
ret
&&
*
mime_types
)
{
free_native_mime_types
(
*
mime_types
);
*
mime_types
=
NULL
;
}
if
(
!
ret
)
free_native_mime_types
(
mime_types
);
return
ret
;
}
...
...
@@ -2557,7 +2544,7 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
{
static
const
WCHAR
openW
[]
=
{
'o'
,
'p'
,
'e'
,
'n'
,
0
};
struct
wine_rb_tree
mimeProgidTree
;
struct
list
*
nativeMimeTypes
=
NULL
;
struct
list
nativeMimeTypes
;
LSTATUS
ret
=
0
;
int
i
;
BOOL
hasChanged
=
FALSE
;
...
...
@@ -2567,6 +2554,8 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
WINE_ERR
(
"wine_rb_init failed
\n
"
);
return
FALSE
;
}
list_init
(
&
nativeMimeTypes
);
if
(
!
build_native_mime_types
(
xdg_data_home
,
&
nativeMimeTypes
))
{
WINE_ERR
(
"could not build native MIME types
\n
"
);
...
...
@@ -2634,7 +2623,7 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
if
(
contentTypeW
)
strlwrW
(
contentTypeW
);
if
(
!
freedesktop_mime_type_for_extension
(
nativeMimeTypes
,
extensionA
,
extensionW
,
&
mimeTypeA
))
if
(
!
freedesktop_mime_type_for_extension
(
&
nativeMimeTypes
,
extensionA
,
extensionW
,
&
mimeTypeA
))
goto
end
;
if
(
mimeTypeA
==
NULL
)
...
...
@@ -2780,7 +2769,7 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
}
wine_rb_destroy
(
&
mimeProgidTree
,
winemenubuilder_rb_destroy
,
NULL
);
free_native_mime_types
(
nativeMimeTypes
);
free_native_mime_types
(
&
nativeMimeTypes
);
return
hasChanged
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment