Commit b5fa0927 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Added image/pjpeg mime filter.

parent 973371c0
...@@ -416,6 +416,11 @@ static BOOL text_html_filter(LPVOID buf, DWORD size) ...@@ -416,6 +416,11 @@ static BOOL text_html_filter(LPVOID buf, DWORD size)
return FALSE; return FALSE;
} }
static BOOL image_pjpeg_filter(LPVOID buf, DWORD size)
{
return size > 2 && *(BYTE*)buf == 0xff && *((BYTE*)buf+1) == 0xd8;
}
static BOOL text_plain_filter(LPVOID buf, DWORD size) static BOOL text_plain_filter(LPVOID buf, DWORD size)
{ {
UCHAR *ptr; UCHAR *ptr;
...@@ -468,6 +473,7 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, ...@@ -468,6 +473,7 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer,
int i = 0; int i = 0;
static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0}; static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
static const WCHAR wszImagePjpeg[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
static const WCHAR wszTextPlain[] = {'t','e','x','t','/','p','l','a','i','n','\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','/', 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'}; 'o','c','t','e','t','-','s','t','r','e','a','m','\0'};
...@@ -477,6 +483,7 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, ...@@ -477,6 +483,7 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer,
BOOL (*filter)(LPVOID,DWORD); BOOL (*filter)(LPVOID,DWORD);
} mime_filters[] = { } mime_filters[] = {
{wszTextHtml, text_html_filter}, {wszTextHtml, text_html_filter},
{wszImagePjpeg, image_pjpeg_filter},
{wszTextPlain, text_plain_filter}, {wszTextPlain, text_plain_filter},
{wszAppOctetStream, application_octet_stream_filter} {wszAppOctetStream, application_octet_stream_filter}
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment