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
c73c3362
Commit
c73c3362
authored
May 30, 2006
by
Jacek Caban
Committed by
Alexandre Julliard
May 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Use filters mechanism in FindMimeFromData.
parent
bdbc4826
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
urlmon_main.c
dlls/urlmon/urlmon_main.c
+33
-10
No files found.
dlls/urlmon/urlmon_main.c
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
;
...
...
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