[PATCH 2/3] winemac: Export HTML Format clipboard data to the public.html pasteboard type.
Alexandre Julliard
julliard at winehq.org
Fri Jan 13 14:22:23 CST 2017
Sebastian Lackner <sebastian at fds-team.de> writes:
> On 13.01.2017 20:36, Ken Thomases wrote:
>> Signed-off-by: Ken Thomases <ken at codeweavers.com>
>> ---
>> dlls/winemac.drv/clipboard.c | 68 +++++++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 67 insertions(+), 1 deletion(-)
>>
>> diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c
>> index fdd1110..49a3ed3 100644
>> --- a/dlls/winemac.drv/clipboard.c
>> +++ b/dlls/winemac.drv/clipboard.c
>> @@ -82,6 +82,7 @@ static CFDataRef export_bitmap_to_bmp(HANDLE data);
>> static CFDataRef export_dib_to_bmp(HANDLE data);
>> static CFDataRef export_enhmetafile(HANDLE data);
>> static CFDataRef export_hdrop_to_filenames(HANDLE data);
>> +static CFDataRef export_html(HANDLE data);
>> static CFDataRef export_metafilepict(HANDLE data);
>> static CFDataRef export_text_to_utf8(HANDLE data);
>> static CFDataRef export_unicodetext_to_utf8(HANDLE data);
>> @@ -186,7 +187,7 @@ static const struct
>> { wszJFIF, CFSTR("public.jpeg"), import_clipboard_data, export_clipboard_data },
>> { wszPNG, CFSTR("public.png"), import_clipboard_data, export_clipboard_data },
>> { wszHTMLFormat, NULL, import_clipboard_data, export_clipboard_data },
>> - { wszHTMLFormat, CFSTR("public.html"), import_html, NULL, TRUE },
>> + { wszHTMLFormat, CFSTR("public.html"), import_html, export_html, TRUE },
>> { CFSTR_SHELLURLW, CFSTR("public.url"), import_utf8_to_text, export_text_to_utf8 },
>> };
>>
>> @@ -522,6 +523,28 @@ static HANDLE create_bitmap_from_dib(HANDLE dib)
>>
>>
>> /**************************************************************************
>> + * get_html_description_field
>> + *
>> + * Find the value of a field in an HTML Format description.
>> + */
>> +static const char* get_html_description_field(const char* data, const char* keyword)
>> +{
>> + const char* pos = data;
>> +
>> + while (pos && *pos && *pos != '<')
>> + {
>> + if (memcmp(pos, keyword, strlen(keyword)) == 0)
>
> Its not safe to use memcmp, it could read past the terminating \0 of data.
That's a copy of the X11 code so it's OK for now, but yes, that code
needs some work. I was planning to clean it up after code freeze.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list