summaryrefslogtreecommitdiff
path: root/amiga/clipboard.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-03 21:02:29 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-03 21:02:29 +0100
commit3a00eca53547fd3d27a792421757db42e77127e9 (patch)
tree6ba6c4c161634a8b108e3904b3e09f9dccb8cfa0 /amiga/clipboard.c
parent0b0c6a4f6ae8d04546028f42440054508c6121d0 (diff)
downloadnetsurf-3a00eca53547fd3d27a792421757db42e77127e9.tar.gz
netsurf-3a00eca53547fd3d27a792421757db42e77127e9.tar.bz2
Clear the StopChunks before scanning for the UTF8 chunk, otherwise we risk thinking a CHRS chunk is a UTF8 chunk.
Diffstat (limited to 'amiga/clipboard.c')
-rwxr-xr-xamiga/clipboard.c19
1 files changed, 19 insertions, 0 deletions
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)