Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e14f3c40
Commit
e14f3c40
authored
Oct 01, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Use PathMatchSpec() instead of fnmatch().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
982a712c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
51 deletions
+8
-51
configure
configure
+0
-2
configure.ac
configure.ac
+0
-2
config.h.in
include/config.h.in
+0
-6
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+8
-41
No files found.
configure
View file @
e14f3c40
...
...
@@ -7481,7 +7481,6 @@ for ac_header in \
dlfcn.h
\
elf.h
\
float.h
\
fnmatch.h
\
getopt.h
\
gettext-po.h
\
grp.h
\
...
...
@@ -17902,7 +17901,6 @@ for ac_func in \
__res_getservers
\
_spawnvp
\
epoll_create
\
fnmatch
\
fork
\
fstatfs
\
futimens
\
...
...
configure.ac
View file @
e14f3c40
...
...
@@ -450,7 +450,6 @@ AC_CHECK_HEADERS(\
dlfcn.h \
elf.h \
float.h \
fnmatch.h \
getopt.h \
gettext-po.h \
grp.h \
...
...
@@ -2132,7 +2131,6 @@ AC_CHECK_FUNCS(\
__res_getservers \
_spawnvp \
epoll_create \
fnmatch \
fork \
fstatfs \
futimens \
...
...
include/config.h.in
View file @
e14f3c40
...
...
@@ -96,12 +96,6 @@
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
/* Define to 1 if you have the `fnmatch' function. */
#undef HAVE_FNMATCH
/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H
/* Define to 1 if you have the <fontconfig/fontconfig.h> header file. */
#undef HAVE_FONTCONFIG_FONTCONFIG_H
...
...
programs/winemenubuilder/winemenubuilder.c
View file @
e14f3c40
...
...
@@ -73,9 +73,6 @@
#endif
#include <errno.h>
#include <stdarg.h>
#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
#endif
#define COBJMACROS
#define NONAMELESSUNION
...
...
@@ -181,7 +178,6 @@ struct xdg_mime_type
{
char
*
mimeType
;
char
*
glob
;
char
*
lower_glob
;
struct
list
entry
;
};
...
...
@@ -1936,7 +1932,7 @@ static BOOL add_mimes(const char *xdg_data_dir, struct list *mime_types)
int
size
=
0
;
while
(
ret
&&
(
ret
=
next_line
(
globs_file
,
&
line
,
&
size
))
&&
line
)
{
char
*
pos
,
*
l
;
char
*
pos
;
struct
xdg_mime_type
*
mime_type_entry
=
NULL
;
if
(
line
[
0
]
!=
'#'
&&
(
pos
=
strchr
(
line
,
':'
)))
{
...
...
@@ -1944,9 +1940,6 @@ static BOOL add_mimes(const char *xdg_data_dir, struct list *mime_types)
*
pos
=
0
;
mime_type_entry
->
mimeType
=
xstrdup
(
line
);
mime_type_entry
->
glob
=
xstrdup
(
pos
+
1
);
mime_type_entry
->
lower_glob
=
xstrdup
(
pos
+
1
);
for
(
l
=
mime_type_entry
->
lower_glob
;
*
l
;
l
++
)
*
l
=
tolower
(
*
l
);
list_add_tail
(
mime_types
,
&
mime_type_entry
->
entry
);
}
}
...
...
@@ -1965,7 +1958,6 @@ static void free_native_mime_types(struct list *native_mime_types)
{
list_remove
(
&
mime_type_entry
->
entry
);
heap_free
(
mime_type_entry
->
glob
);
heap_free
(
mime_type_entry
->
lower_glob
);
heap_free
(
mime_type_entry
->
mimeType
);
heap_free
(
mime_type_entry
);
}
...
...
@@ -2005,10 +1997,11 @@ static BOOL build_native_mime_types(const char *xdg_data_home, struct list *mime
return
ret
;
}
static
BOOL
match_glob
(
struct
list
*
native_mime_types
,
const
char
*
extension
,
int
ignoreGlobCase
,
char
**
match
)
static
BOOL
freedesktop_mime_type_for_extension
(
struct
list
*
native_mime_types
,
const
char
*
extensionA
,
LPCWSTR
extensionW
,
char
**
match
)
{
#ifdef HAVE_FNMATCH
struct
xdg_mime_type
*
mime_type_entry
;
int
matchLength
=
0
;
...
...
@@ -2016,46 +2009,20 @@ static BOOL match_glob(struct list *native_mime_types, const char *extension,
LIST_FOR_EACH_ENTRY
(
mime_type_entry
,
native_mime_types
,
struct
xdg_mime_type
,
entry
)
{
const
char
*
glob
=
ignoreGlobCase
?
mime_type_entry
->
lower_glob
:
mime_type_entry
->
glob
;
if
(
fnmatch
(
glob
,
extension
,
0
)
==
0
)
if
(
PathMatchSpecA
(
extensionA
,
mime_type_entry
->
glob
))
{
if
(
*
match
==
NULL
||
matchLength
<
strlen
(
glob
))
if
(
*
match
==
NULL
||
matchLength
<
strlen
(
mime_type_entry
->
glob
))
{
*
match
=
mime_type_entry
->
mimeType
;
matchLength
=
strlen
(
glob
);
matchLength
=
strlen
(
mime_type_entry
->
glob
);
}
}
}
if
(
*
match
!=
NULL
)
*
match
=
xstrdup
(
*
match
);
#else
*
match
=
NULL
;
#endif
return
TRUE
;
}
static
BOOL
freedesktop_mime_type_for_extension
(
struct
list
*
native_mime_types
,
const
char
*
extensionA
,
LPCWSTR
extensionW
,
char
**
mime_type
)
{
WCHAR
*
lower_extensionW
;
char
*
lower_extensionA
;
INT
len
;
BOOL
ret
=
match_glob
(
native_mime_types
,
extensionA
,
0
,
mime_type
);
if
(
ret
==
FALSE
||
*
mime_type
!=
NULL
)
return
ret
;
len
=
strlenW
(
extensionW
);
lower_extensionW
=
xmalloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
lower_extensionW
,
extensionW
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
strlwrW
(
lower_extensionW
);
lower_extensionA
=
wchars_to_utf8_chars
(
lower_extensionW
);
ret
=
match_glob
(
native_mime_types
,
lower_extensionA
,
1
,
mime_type
);
heap_free
(
lower_extensionA
);
heap_free
(
lower_extensionW
);
return
ret
;
}
static
WCHAR
*
reg_get_valW
(
HKEY
key
,
LPCWSTR
subkey
,
LPCWSTR
name
)
{
DWORD
size
;
...
...
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