Mercurial > dovecot > core-2.2
changeset 1099:cad379bd76d6 HEAD
We handled '=' at end of line wrong.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 08 Feb 2003 08:33:30 +0200 |
parents | 5a60e173fe9a |
children | 95d2f3e60b82 |
files | src/lib-mail/quoted-printable.c |
diffstat | 1 files changed, 31 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/quoted-printable.c Thu Feb 06 04:31:31 2003 +0200 +++ b/src/lib-mail/quoted-printable.c Sat Feb 08 08:33:30 2003 +0200 @@ -19,25 +19,42 @@ continue; buffer_append(dest, src + next, src_pos - next); + next = src_pos+1; if (src[src_pos] == '_') { buffer_append_c(dest, ' '); + continue; + } + + if (src_pos+1 >= src_size) + break; + + if (src[src_pos+1] == '\n') { + /* =\n -> skip both */ + src_pos++; + continue; + } + + if (src_pos+2 >= src_size) + break; + + if (src[src_pos+1] == '\r' && src[src_pos+2] == '\n') { + /* =\r\n -> skip both */ + src_pos += 2; + next++; + continue; + } + + /* =<hex> */ + hexbuf[0] = src[src_pos+1]; + hexbuf[1] = src[src_pos+2]; + + if (hex_to_binary(hexbuf, dest) == 1) { + src_pos += 2; next = src_pos+1; } else { - /* =<hex> */ - if (src_pos+2 >= src_size) - break; - - hexbuf[0] = src[src_pos+1]; - hexbuf[1] = src[src_pos+2]; - - if (hex_to_binary(hexbuf, dest) == 1) { - src_pos += 2; - next = src_pos+1; - } else { - /* non-hex data */ - next = src_pos; - } + /* non-hex data, show as-is */ + next = src_pos; } }