From c53e914ea57dac19773aee30d3cf04d92d8cf1bf Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 2 Jan 2017 21:40:38 +0100 Subject: Always ignore newlines between words. --- src/vmime/word.cpp | 5 ++++- tests/parser/textTest.cpp | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vmime/word.cpp b/src/vmime/word.cpp index 27b741d4..d2d53b2b 100644 --- a/src/vmime/word.cpp +++ b/src/vmime/word.cpp @@ -82,11 +82,14 @@ shared_ptr word::parseNext // - before the first word // - between two encoded words // - after the last word + // Always ignore newlines string whiteSpaces; while (pos < end && parserHelpers::isSpace(buffer[pos])) { - whiteSpaces += buffer[pos]; + if (buffer[pos] != '\r' && buffer[pos] != '\n') // do not include newlines + whiteSpaces += buffer[pos]; + ++pos; } diff --git a/tests/parser/textTest.cpp b/tests/parser/textTest.cpp index 530c83b6..60a9508e 100644 --- a/tests/parser/textTest.cpp +++ b/tests/parser/textTest.cpp @@ -269,6 +269,10 @@ VMIME_TEST_SUITE_BEGIN(textTest) // Whitespaces and multiline VASSERT_EQ("16", "a b c d e", DISPLAY_FORM("=?ISO-8859-1?Q?a_b_?=c\n\t=?ISO-8859-1?Q?d_?=e")); + // Ignored newlines + VASSERT_EQ("17", "ab", DISPLAY_FORM("=?ISO-8859-1?Q?a?=\r\nb")); + VASSERT_EQ("18", "a b", DISPLAY_FORM("=?ISO-8859-1?Q?a?= \r\nb")); + #undef DISPLAY_FORM } -- cgit v1.2.3