Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
c73c3362
Commit
c73c3362
authored
18 years ago
by
Jacek Caban
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
urlmon: Use filters mechanism in FindMimeFromData.
parent
bdbc4826
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/urlmon/urlmon_main.c
+33
-10
33 additions, 10 deletions
dlls/urlmon/urlmon_main.c
with
33 additions
and
10 deletions
dlls/urlmon/urlmon_main.c
+
33
−
10
View file @
c73c3362
...
...
@@ -397,6 +397,23 @@ void WINAPI ReleaseBindInfo(BINDINFO* pbindinfo)
*
* Determines the Multipurpose Internet Mail Extensions (MIME) type from the data provided.
*/
static
BOOL
text_plain_filter
(
LPVOID
buf
,
DWORD
size
)
{
UCHAR
*
ptr
;
for
(
ptr
=
buf
;
ptr
<
(
UCHAR
*
)
buf
+
size
-
1
;
ptr
++
)
{
if
(
*
ptr
<
0x20
&&
*
ptr
!=
'\n'
&&
*
ptr
!=
'\r'
&&
*
ptr
!=
'\t'
)
return
FALSE
;
}
return
TRUE
;
}
static
BOOL
application_octet_stream_filter
(
LPVOID
buf
,
DWORD
size
)
{
return
TRUE
;
}
HRESULT
WINAPI
FindMimeFromData
(
LPBC
pBC
,
LPCWSTR
pwzUrl
,
LPVOID
pBuffer
,
DWORD
cbSize
,
LPCWSTR
pwzMimeProposed
,
DWORD
dwMimeFlags
,
LPWSTR
*
ppwzMimeOut
,
DWORD
dwReserved
)
...
...
@@ -427,23 +444,29 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer,
}
if
(
pBuffer
)
{
UCHAR
*
ptr
=
pBuffer
;
DWORD
len
;
LPCWSTR
ret
;
LPCWSTR
ret
=
NULL
;
int
i
=
0
;
static
const
WCHAR
wszAppOctetStream
[]
=
{
'a'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'/'
,
'o'
,
'c'
,
't'
,
'e'
,
't'
,
'-'
,
's'
,
't'
,
'r'
,
'e'
,
'a'
,
'm'
,
'\0'
};
static
const
WCHAR
wszTextPlain
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
'/'
,
'p'
,
'l'
,
'a'
,
'i'
,
'n'
,
'\0'
};
static
const
WCHAR
wszAppOctetStream
[]
=
{
'a'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'/'
,
'o'
,
'c'
,
't'
,
'e'
,
't'
,
'-'
,
's'
,
't'
,
'r'
,
'e'
,
'a'
,
'm'
,
'\0'
};
static
const
struct
{
LPCWSTR
mime
;
BOOL
(
*
filter
)(
LPVOID
,
DWORD
);
}
mime_filters
[]
=
{
{
wszTextPlain
,
text_plain_filter
},
{
wszAppOctetStream
,
application_octet_stream_filter
}
};
if
(
!
cbSize
)
return
E_FAIL
;
ret
=
wszTextPlain
;
for
(
ptr
=
pBuffer
;
ptr
<
(
UCHAR
*
)
pBuffer
+
cbSize
-
1
;
ptr
++
)
{
if
(
*
ptr
<
0x20
&&
*
ptr
!=
'\n'
&&
*
ptr
!=
'\r'
&&
*
ptr
!=
'\t'
)
{
ret
=
wszAppOctetStream
;
break
;
}
while
(
!
ret
)
{
if
(
mime_filters
[
i
].
filter
(
pBuffer
,
cbSize
))
ret
=
mime_filters
[
i
].
mime
;
i
++
;
}
len
=
strlenW
(
ret
)
+
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment