diff options
author | Andrew Sidwell <andy@entai.co.uk> | 2008-06-18 17:33:24 +0000 |
---|---|---|
committer | Andrew Sidwell <andy@entai.co.uk> | 2008-06-18 17:33:24 +0000 |
commit | 48ba3bdbd561645a78ef5e5cb99ead7ef3a10661 (patch) | |
tree | ff11bfb8ff547502d5dd2691da9ce3f34c382223 /src/input/filter.c | |
parent | fcc857c2b72ecc43388a0ee34f0a8ddfed8d13d8 (diff) | |
download | libhubbub-48ba3bdbd561645a78ef5e5cb99ead7ef3a10661.tar.gz libhubbub-48ba3bdbd561645a78ef5e5cb99ead7ef3a10661.tar.bz2 |
Fix remaining issues around passing the testsuite, and make sure all the tokeniser is tested.
svn path=/trunk/hubbub/; revision=4387
Diffstat (limited to 'src/input/filter.c')
-rw-r--r-- | src/input/filter.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/input/filter.c b/src/input/filter.c index 5ac5391..7a97840 100644 --- a/src/input/filter.c +++ b/src/input/filter.c @@ -348,24 +348,24 @@ hubbub_error read_character_filter(uint32_t c, uint32_t **output, #define LF (0x0000000A) #define REP (0x0000FFFD) - if (c == NUL) { - /* Replace NUL (U+0000) characters in input with U+FFFD */ - input->filter_output[0] = REP; + /* Replace NUL (U+0000) characters in input with U+FFFD */ + if (c == NUL) + c = REP; + + if (c == CR) { + /* Convert CRs to LFs straight away */ + input->filter_output[0] = LF; len = 1; - } else if (c == CR) { - /* Trap CR characters */ + } else if (input->last_filter_char == CR && c == LF) { + /* Trap this LF */ len = 0; - } else if (input->last_filter_char == CR && c != LF) { - /* Last char was CR and this isn't LF => CR -> LF */ - input->filter_output[0] = LF; - input->filter_output[1] = c; - len = 2; } else { /* Let character through unchanged */ input->filter_output[0] = c; len = 1; } + #undef NUL #undef CR #undef LF |