From 3a00eca53547fd3d27a792421757db42e77127e9 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 3 Aug 2012 21:02:29 +0100 Subject: Clear the StopChunks before scanning for the UTF8 chunk, otherwise we risk thinking a CHRS chunk is a UTF8 chunk. --- amiga/clipboard.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'amiga/clipboard.c') diff --git a/amiga/clipboard.c b/amiga/clipboard.c index 66a4da2e0..b6eac6ed5 100755 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -53,6 +53,21 @@ static bool ami_copy_selection(const char *text, size_t length, struct box *box, void *handle, const char *whitespace_text, size_t whitespace_length); +static LONG ami_clipboard_iffp_do_nothing(struct Hook *hook, void *object, LONG *cmd) +{ + return 0; +} + +static void ami_clipboard_iffp_clear_stopchunk(struct IFFHandle *iffh, ULONG iff_type, ULONG iff_chunk) +{ + static struct Hook entry_hook; + + entry_hook.h_Entry = (void *)ami_clipboard_iffp_do_nothing; + entry_hook.h_Data = 0; + + EntryHandler(iffh, iff_type, iff_chunk, IFFSLI_TOP, &entry_hook, NULL); +} + struct IFFHandle *ami_clipboard_init_internal(int unit) { struct IFFHandle *iffhandle = NULL; @@ -114,6 +129,10 @@ bool ami_clipboard_check_for_utf8(struct IFFHandle *iffh) { bool utf8_chunk = false; if(OpenIFF(iffh, IFFF_READ)) return false; + + ami_clipboard_iffp_clear_stopchunk(iffh, ID_FTXT, ID_CSET); + ami_clipboard_iffp_clear_stopchunk(iffh, ID_FTXT, ID_CHRS); + if(!StopChunk(iffh, ID_FTXT, ID_UTF8)) { error = ParseIFF(iffh, IFFPARSE_SCAN); if(error != IFFERR_EOF) -- cgit v1.2.3