From e60090bc9c7e14bb8253eeb64658aedaa0f863c7 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 10 Nov 2019 18:43:43 -0500 Subject: Bug 1427732 - fix newline handling when copying messages and compacting folders. Tag #1273 --- mailnews/base/public/msgCore.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mailnews/base/public') diff --git a/mailnews/base/public/msgCore.h b/mailnews/base/public/msgCore.h index fc18fb16f..d14ff6140 100644 --- a/mailnews/base/public/msgCore.h +++ b/mailnews/base/public/msgCore.h @@ -178,6 +178,19 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value) #define MSG_LINEBREAK_LEN 1 #endif +/* + * On Windows, we use \r\n as the line terminator in mbox files. On + * other platforms, we use \n. However, we need to be able to + * recognize line terminators produced on any platform, because we + * allow profiles (including the mbox files they contain) to be shared + * between platforms. + * + * Returns 0 (i.e., false) if the line is not blank, or otherwise the + * length of the line terminator, i.e., 1 for \n or 2 for \r\n. + */ +#define IS_MSG_LINEBREAK(line) \ + (line[0] == '\012' ? 1 : ((line[0] == '\015' && line[1] == '\012') ? 2 : 0)) + #define NS_MSG_BASE #define NS_MSG_BASE_STATIC_MEMBER_(type) type -- cgit v1.2.3