diff --git a/extensions/cookie/nsCookies.cpp b/extensions/cookie/nsCookies.cpp index bbc954f3ee93..5cbd41530685 100644 --- a/extensions/cookie/nsCookies.cpp +++ b/extensions/cookie/nsCookies.cpp @@ -723,7 +723,7 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook /* terminate at any carriage return or linefeed */ for(ptr=setCookieHeaderInternal; *ptr; ptr++) { - if(*ptr == LF || *ptr == CR) { + if(*ptr == nsCRT::LF || *ptr == nsCRT::CR) { *ptr = '\0'; break; } @@ -1248,8 +1248,8 @@ COOKIE_Read() { if ( !buffer.IsEmpty() ) { PRUnichar firstChar = buffer.CharAt(0); - if (firstChar == '#' || firstChar == CR || - firstChar == LF || firstChar == 0) { + if (firstChar == '#' || firstChar == nsCRT::CR || + firstChar == nsCRT::LF || firstChar == 0) { continue; } } diff --git a/extensions/cookie/nsPermissions.cpp b/extensions/cookie/nsPermissions.cpp index f62ef6cd3b9b..372e1c5a504f 100644 --- a/extensions/cookie/nsPermissions.cpp +++ b/extensions/cookie/nsPermissions.cpp @@ -463,8 +463,8 @@ PERMISSION_Read() { while(CKutil_GetLine(strm,buffer) != -1) { if ( !buffer.IsEmpty() ) { PRUnichar firstChar = buffer.CharAt(0); - if (firstChar == '#' || firstChar == CR || - firstChar == LF || firstChar == 0) { + if (firstChar == '#' || firstChar == nsCRT::CR || + firstChar == nsCRT::LF || firstChar == 0) { continue; } } diff --git a/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp b/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp index 690b123e310a..86d4e60ff916 100644 --- a/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp +++ b/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp @@ -1021,8 +1021,8 @@ nsXMLHttpRequest::GetStreamForWString(const PRUnichar* aStr, nsCRT::memcpy(postData+headerSize, postData+MAX_HEADER_SIZE, charLength); // Shove in the traling CRLF - postData[headerSize+charLength] = CR; - postData[headerSize+charLength+1] = LF; + postData[headerSize+charLength] = nsCRT::CR; + postData[headerSize+charLength+1] = nsCRT::LF; postData[headerSize+charLength+2] = '\0'; // The new stream takes ownership of the buffer diff --git a/htmlparser/src/nsExpatTokenizer.cpp b/htmlparser/src/nsExpatTokenizer.cpp index d92220132d26..f360db5997ef 100644 --- a/htmlparser/src/nsExpatTokenizer.cpp +++ b/htmlparser/src/nsExpatTokenizer.cpp @@ -588,7 +588,7 @@ void Tokenizer_HandleCharacterData(void *userData, const XML_Char *s, int len) { switch(((PRUnichar*)s)[0]){ case kNewLine: - case CR: + case nsCRT::CR: newToken = state->tokenAllocator->CreateTokenOfType(eToken_newline,eHTMLTag_unknown); break; case kSpace: diff --git a/mailnews/absync/src/nsAbSync.cpp b/mailnews/absync/src/nsAbSync.cpp index 4dae07cea870..da25136b492b 100644 --- a/mailnews/absync/src/nsAbSync.cpp +++ b/mailnews/absync/src/nsAbSync.cpp @@ -2042,7 +2042,7 @@ nsAbSync::ExtractCurrentLine() nsString extractString; while ( (*mProtocolOffset) && - ( (*mProtocolOffset != CR) && (*mProtocolOffset != LF) ) + ( (*mProtocolOffset != nsCRT::CR) && (*mProtocolOffset != nsCRT::LF) ) ) { extractString.Append(PRUnichar(*mProtocolOffset)); @@ -2054,10 +2054,10 @@ nsAbSync::ExtractCurrentLine() else { while ( (*mProtocolOffset) && - (*mProtocolOffset == CR) ) + (*mProtocolOffset == nsCRT::CR) ) mProtocolOffset++; - if (*mProtocolOffset == LF) + if (*mProtocolOffset == nsCRT::LF) mProtocolOffset++; char *tString = extractString.ToNewCString(); @@ -2074,9 +2074,9 @@ nsAbSync::ExtractCurrentLine() nsresult nsAbSync::AdvanceToNextLine() { - // First, find first CR or LF... + // First, find first nsCRT::CR or nsCRT::LF... while ( (*mProtocolOffset) && - ( (*mProtocolOffset != CR) && (*mProtocolOffset != LF) ) + ( (*mProtocolOffset != nsCRT::CR) && (*mProtocolOffset != nsCRT::LF) ) ) { mProtocolOffset++; @@ -2086,10 +2086,10 @@ nsAbSync::AdvanceToNextLine() if (*mProtocolOffset) { while ( (*mProtocolOffset) && - (*mProtocolOffset != LF) ) + (*mProtocolOffset != nsCRT::LF) ) mProtocolOffset++; - if (*mProtocolOffset == LF) + if (*mProtocolOffset == nsCRT::LF) mProtocolOffset++; } diff --git a/mailnews/base/public/nsMsgLocalFolderHdrs.h b/mailnews/base/public/nsMsgLocalFolderHdrs.h index 2405240832cc..b2fdd74da503 100644 --- a/mailnews/base/public/nsMsgLocalFolderHdrs.h +++ b/mailnews/base/public/nsMsgLocalFolderHdrs.h @@ -47,6 +47,6 @@ #define CONTENT_LENGTH_LEN /*12345678901234*/ 14 /* Provide a common means of detecting empty lines in a message. i.e. to detect the end of headers among other things...*/ -#define EMPTY_MESSAGE_LINE(buf) (buf[0] == CR || buf[0] == LF || buf[0] == '\0') +#define EMPTY_MESSAGE_LINE(buf) (buf[0] == nsCRT::CR || buf[0] == nsCRT::LF || buf[0] == '\0') #endif diff --git a/mailnews/base/search/public/nsMsgSearchTerm.h b/mailnews/base/search/public/nsMsgSearchTerm.h index 3698bba672e4..d86c4615d6e4 100644 --- a/mailnews/base/search/public/nsMsgSearchTerm.h +++ b/mailnews/base/search/public/nsMsgSearchTerm.h @@ -33,7 +33,7 @@ #include "nsIMsgSearchScopeTerm.h" #include "nsIMsgSearchTerm.h" -#define EMPTY_MESSAGE_LINE(buf) (buf[0] == CR || buf[0] == LF || buf[0] == '\0') +#define EMPTY_MESSAGE_LINE(buf) (buf[0] == nsCRT::CR || buf[0] == nsCRT::LF || buf[0] == '\0') class nsMsgSearchTerm : public nsIMsgSearchTerm { diff --git a/mailnews/base/search/src/nsMsgBodyHandler.cpp b/mailnews/base/search/src/nsMsgBodyHandler.cpp index 9d3f8fb772de..7bed1366d8ae 100644 --- a/mailnews/base/search/src/nsMsgBodyHandler.cpp +++ b/mailnews/base/search/src/nsMsgBodyHandler.cpp @@ -150,7 +150,7 @@ PRInt32 nsMsgBodyHandler::GetNextFilterLine(char * buf, PRUint32 bufSize) // strings. It is possible to have: To NULL CR LF From. We want to skip over these CR/LFs if they start // at the beginning of what we think is another header. - while ((m_headers[0] == CR || m_headers[0] == LF || m_headers[0] == ' ' || m_headers[0] == '\0') && m_headersSize > 0) + while ((m_headers[0] == nsCRT::CR || m_headers[0] == nsCRT::LF || m_headers[0] == ' ' || m_headers[0] == '\0') && m_headersSize > 0) { m_headers++; // skip over these chars... m_headersSize--; diff --git a/mailnews/base/search/src/nsMsgSearchTerm.cpp b/mailnews/base/search/src/nsMsgSearchTerm.cpp index 1fc385356818..d4497c2dc39b 100644 --- a/mailnews/base/search/src/nsMsgSearchTerm.cpp +++ b/mailnews/base/search/src/nsMsgSearchTerm.cpp @@ -732,7 +732,7 @@ nsresult nsMsgSearchTerm::MatchBody (nsIMsgSearchScopeTerm *scope, PRUint32 offs // ConvertToUnicode(charset, buf, compare); if (compare.Length() > 0) { char startChar = (char) compare.CharAt(0); - if (startChar != CR && startChar != LF) + if (startChar != nsCRT::CR && startChar != nsCRT::LF) { err = MatchString (compare, folderCharset, &result); lines++; diff --git a/mailnews/base/util/nsMsgI18N.cpp b/mailnews/base/util/nsMsgI18N.cpp index ce66c413da02..217dc99e3a60 100644 --- a/mailnews/base/util/nsMsgI18N.cpp +++ b/mailnews/base/util/nsMsgI18N.cpp @@ -556,7 +556,7 @@ nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec) while (!fileStream.eof() && !fileStream.failed() && fileStream.is_open()) { fileStream.readline(buffer, 512); - if (*buffer == CR || *buffer == LF || *buffer == 0) + if (*buffer == nsCRT::CR || *buffer == nsCRT::LF || *buffer == 0) continue; for (int i = 0; i < (int)PL_strlen(buffer); i++) { diff --git a/mailnews/base/util/nsMsgLineBuffer.cpp b/mailnews/base/util/nsMsgLineBuffer.cpp index 87730168edb0..408b53b3fda6 100644 --- a/mailnews/base/util/nsMsgLineBuffer.cpp +++ b/mailnews/base/util/nsMsgLineBuffer.cpp @@ -107,8 +107,8 @@ nsMsgLineBuffer::SetLookingForCRLF(PRBool b) PRInt32 nsMsgLineBuffer::BufferInput(const char *net_buffer, PRInt32 net_buffer_size) { int status = 0; - if (m_bufferPos > 0 && m_buffer && m_buffer[m_bufferPos - 1] == CR && - net_buffer_size > 0 && net_buffer[0] != LF) { + if (m_bufferPos > 0 && m_buffer && m_buffer[m_bufferPos - 1] == nsCRT::CR && + net_buffer_size > 0 && net_buffer[0] != nsCRT::LF) { /* The last buffer ended with a CR. The new buffer does not start with a LF. This old buffer should be shipped out and discarded. */ PR_ASSERT(m_bufferSize > m_bufferPos); @@ -135,15 +135,15 @@ PRInt32 nsMsgLineBuffer::BufferInput(const char *net_buffer, PRInt32 net_buffer_ seeing a line terminator. This is to catch the case of the buffers splitting a CRLF pair, as in "FOO\r\nBAR\r" "\nBAZ\r\n". */ - if (*s == CR || *s == LF) { + if (*s == nsCRT::CR || *s == nsCRT::LF) { newline = s; - if (newline[0] == CR) { + if (newline[0] == nsCRT::CR) { if (s == net_buffer_end - 1) { /* CR at end - wait for the next character. */ newline = 0; break; } - else if (newline[1] == LF) { + else if (newline[1] == nsCRT::LF) { /* CRLF seen; swallow both. */ newline++; } @@ -154,7 +154,7 @@ PRInt32 nsMsgLineBuffer::BufferInput(const char *net_buffer, PRInt32 net_buffer_ } else { /* if not looking for a CRLF, stop at CR or LF. (for example, when parsing the newsrc file). this fixes #9896, where we'd lose the last line of anything we'd parse that used CR as the line break. */ - if (*s == CR || *s == LF) { + if (*s == nsCRT::CR || *s == nsCRT::LF) { newline = s; newline++; break; @@ -221,8 +221,8 @@ PRInt32 nsMsgLineBuffer::ConvertAndSendBuffer() return -1; newline = buf + length; - PR_ASSERT(newline[-1] == CR || newline[-1] == LF); - if (newline[-1] != CR && newline[-1] != LF) + PR_ASSERT(newline[-1] == nsCRT::CR || newline[-1] == nsCRT::LF); + if (newline[-1] != nsCRT::CR && newline[-1] != nsCRT::LF) return -1; if (!m_convertNewlinesP) @@ -230,8 +230,8 @@ PRInt32 nsMsgLineBuffer::ConvertAndSendBuffer() } #if (MSG_LINEBREAK_LEN == 1) else if ((newline - buf) >= 2 && - newline[-2] == CR && - newline[-1] == LF) + newline[-2] == nsCRT::CR && + newline[-1] == nsCRT::LF) { /* CRLF -> CR or LF */ buf [length - 2] = MSG_LINEBREAK[0]; @@ -244,8 +244,8 @@ PRInt32 nsMsgLineBuffer::ConvertAndSendBuffer() buf [length - 1] = MSG_LINEBREAK[0]; } #else - else if (((newline - buf) >= 2 && newline[-2] != CR) || - ((newline - buf) >= 1 && newline[-1] != LF)) + else if (((newline - buf) >= 2 && newline[-2] != nsCRT::CR) || + ((newline - buf) >= 1 && newline[-1] != nsCRT::LF)) { /* LF -> CRLF or CR -> CRLF */ length++; diff --git a/mailnews/base/util/nsMsgProtocol.cpp b/mailnews/base/util/nsMsgProtocol.cpp index 99eb1f236761..4a5be6220889 100644 --- a/mailnews/base/util/nsMsgProtocol.cpp +++ b/mailnews/base/util/nsMsgProtocol.cpp @@ -617,12 +617,12 @@ nsresult nsMsgProtocol::PostMessage(nsIURI* url, nsIFileSpec *fileSpec) L++; } - if (!lastLineWasComplete || (L > 1 && line[L-2] == CR && - line[L-1] == LF)) + if (!lastLineWasComplete || (L > 1 && line[L-2] == nsCRT::CR && + line[L-1] == nsCRT::LF)) { /* already ok */ } - else if(L > 0 /* && (line[L-1] == LF || line[L-1] == CR) */) + else if(L > 0 /* && (line[L-1] == nsCRT::LF || line[L-1] == nsCRT::CR) */) { /* only add the crlf if required * we still need to do all the @@ -632,8 +632,8 @@ nsresult nsMsgProtocol::PostMessage(nsIURI* url, nsIFileSpec *fileSpec) if(/* add_crlf_to_line_endings */ PR_TRUE) { /* Change newline to CRLF. */ - line[L++] = CR; - line[L++] = LF; + line[L++] = nsCRT::CR; + line[L++] = nsCRT::LF; line[L] = 0; } } @@ -641,8 +641,8 @@ nsresult nsMsgProtocol::PostMessage(nsIURI* url, nsIFileSpec *fileSpec) /* && add_crlf_to_line_endings */) { // jt ** empty line; output CRLF - line[L++] = CR; - line[L++] = LF; + line[L++] = nsCRT::CR; + line[L++] = nsCRT::LF; line[L] = 0; } diff --git a/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mailnews/compose/src/nsMsgAttachmentHandler.cpp index b16f29c25f8d..bd16426e9dbb 100644 --- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -139,7 +139,7 @@ nsMsgAttachmentHandler::AnalyzeDataChunk(const char *chunk, PRInt32 length) m_highbit_count++; m_unprintable_count++; } - else if (*s < ' ' && *s != '\t' && *s != CR && *s != LF) + else if (*s < ' ' && *s != '\t' && *s != nsCRT::CR && *s != nsCRT::LF) { m_unprintable_count++; m_ctl_count++; @@ -147,9 +147,9 @@ nsMsgAttachmentHandler::AnalyzeDataChunk(const char *chunk, PRInt32 length) m_null_count++; } - if (*s == CR || *s == LF) + if (*s == nsCRT::CR || *s == nsCRT::LF) { - if (s+1 < end && s[0] == CR && s[1] == LF) + if (s+1 < end && s[0] == nsCRT::CR && s[1] == nsCRT::LF) s++; if (m_max_column < m_current_column) m_max_column = m_current_column; diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp index 0fefeccf2b95..9c84f35dabb0 100644 --- a/mailnews/compose/src/nsMsgCompUtils.cpp +++ b/mailnews/compose/src/nsMsgCompUtils.cpp @@ -1285,7 +1285,7 @@ mime_fix_header_1 (const char *string, PRBool addr_p, PRBool news_p) old_size = PL_strlen (string); new_size = old_size; for (i = 0; i < old_size; i++) - if (string[i] == CR || string[i] == LF) + if (string[i] == nsCRT::CR || string[i] == nsCRT::LF) new_size += 2; new_string = (char *) PR_Malloc (new_size + 1); @@ -1301,12 +1301,12 @@ mime_fix_header_1 (const char *string, PRBool addr_p, PRBool news_p) /* replace CR, LF, or CRLF with CRLF-TAB. */ while (*in) { - if (*in == CR || *in == LF) { - if (*in == CR && in[1] == LF) + if (*in == nsCRT::CR || *in == nsCRT::LF) { + if (*in == nsCRT::CR && in[1] == nsCRT::LF) in++; in++; - *out++ = CR; - *out++ = LF; + *out++ = nsCRT::CR; + *out++ = nsCRT::LF; *out++ = '\t'; } else @@ -1477,13 +1477,13 @@ msg_make_filename_qtext(const char *srcText, PRBool stripCRLFs) */ if (*s == '\\' || *s == '"' || (!stripCRLFs && - (*s == CR && (*(s+1) != LF || - (*(s+1) == LF && (s+2) < end && !IS_SPACE(*(s+2))))))) + (*s == nsCRT::CR && (*(s+1) != nsCRT::LF || + (*(s+1) == nsCRT::LF && (s+2) < end && !IS_SPACE(*(s+2))))))) *d++ = '\\'; - if (*s == CR) + if (*s == nsCRT::CR) { - if (stripCRLFs && *(s+1) == LF && (s+2) < end && IS_SPACE(*(s+2))) + if (stripCRLFs && *(s+1) == nsCRT::LF && (s+2) < end && IS_SPACE(*(s+2))) s += 2; // skip CRLFLWSP } else @@ -2053,7 +2053,7 @@ nsMsgParseSubjectFromFile(nsFileSpec* fileSpec) if (wasTruncated) continue; - if (*buffer == CR || *buffer == LF || *buffer == 0) + if (*buffer == nsCRT::CR || *buffer == nsCRT::LF || *buffer == 0) break; if ( !PL_strncasecmp(buffer, "Subject: ", 9) ) diff --git a/mailnews/compose/src/nsMsgSend.h b/mailnews/compose/src/nsMsgSend.h index 04980a33e0d1..1aefa81a342b 100644 --- a/mailnews/compose/src/nsMsgSend.h +++ b/mailnews/compose/src/nsMsgSend.h @@ -157,7 +157,7 @@ #define PUSH_STRING(S) \ do { PL_strcpy (buffer_tail, S); buffer_tail += PL_strlen (S); } while(0) #define PUSH_NEWLINE() \ - do { *buffer_tail++ = CR; *buffer_tail++ = LF; *buffer_tail = '\0'; } while(0) + do { *buffer_tail++ = nsCRT::CR; *buffer_tail++ = nsCRT::LF; *buffer_tail = '\0'; } while(0) // // Forward declarations... diff --git a/mailnews/compose/src/nsMsgSendLater.cpp b/mailnews/compose/src/nsMsgSendLater.cpp index 6e23b542e124..ab93f7cfb570 100644 --- a/mailnews/compose/src/nsMsgSendLater.cpp +++ b/mailnews/compose/src/nsMsgSendLater.cpp @@ -208,7 +208,7 @@ FindEOL(char *inBuf, char *buf_end) while (buf <= buf_end) if (*buf == 0) return buf; - else if ( (*buf == LF) || (*buf == CR) ) + else if ( (*buf == nsCRT::LF) || (*buf == nsCRT::CR) ) { findLoc = buf; break; @@ -221,8 +221,8 @@ FindEOL(char *inBuf, char *buf_end) else if ((findLoc + 1) > buf_end) return buf; - if ( (*findLoc == LF && *(findLoc+1) == CR) || - (*findLoc == CR && *(findLoc+1) == LF)) + if ( (*findLoc == nsCRT::LF && *(findLoc+1) == nsCRT::CR) || + (*findLoc == nsCRT::CR && *(findLoc+1) == nsCRT::LF)) findLoc++; // possibly a pair. return findLoc; } @@ -825,14 +825,14 @@ nsMsgSendLater::BuildHeaders() value = buf; SEARCH_NEWLINE: - while (*buf != 0 && *buf != CR && *buf != LF) + while (*buf != 0 && *buf != nsCRT::CR && *buf != nsCRT::LF) buf++; if (buf+1 >= buf_end) ; // If "\r\n " or "\r\n\t" is next, that doesn't terminate the header. else if (buf+2 < buf_end && - (buf[0] == CR && buf[1] == LF) && + (buf[0] == nsCRT::CR && buf[1] == nsCRT::LF) && (buf[2] == ' ' || buf[2] == '\t')) { buf += 3; @@ -840,7 +840,7 @@ SEARCH_NEWLINE: } // If "\r " or "\r\t" or "\n " or "\n\t" is next, that doesn't terminate // the header either. - else if ((buf[0] == CR || buf[0] == LF) && + else if ((buf[0] == nsCRT::CR || buf[0] == nsCRT::LF) && (buf[1] == ' ' || buf[1] == '\t')) { buf += 2; @@ -902,9 +902,9 @@ SEARCH_NEWLINE: PR_FREEIF(draftInfo); } - if (*buf == CR || *buf == LF) + if (*buf == nsCRT::CR || *buf == nsCRT::LF) { - if (*buf == CR && buf[1] == LF) + if (*buf == nsCRT::CR && buf[1] == nsCRT::LF) buf++; buf++; } @@ -921,8 +921,8 @@ SEARCH_NEWLINE: } } - m_headers[m_headersFP++] = CR; - m_headers[m_headersFP++] = LF; + m_headers[m_headersFP++] = nsCRT::CR; + m_headers[m_headersFP++] = nsCRT::LF; // Now we have parsed out all of the headers we need and we // can proceed. @@ -968,11 +968,11 @@ nsMsgSendLater::DeliverQueuedLine(char *line, PRInt32 length) // convert existing newline to CRLF // Don't need this because the calling routine is taking care of it. -// if (length > 0 && (line[length-1] == CR || -// (line[length-1] == LF && (length < 2 || line[length-2] != CR)))) +// if (length > 0 && (line[length-1] == nsCRT::CR || +// (line[length-1] == nsCRT::LF && (length < 2 || line[length-2] != nsCRT::CR)))) // { -// line[length-1] = CR; -// line[length++] = LF; +// line[length-1] = nsCRT::CR; +// line[length++] = nsCRT::LF; // } // // @@ -1008,7 +1008,7 @@ nsMsgSendLater::DeliverQueuedLine(char *line, PRInt32 length) PR_FREEIF(m_fcc); } - if (line[0] == CR || line[0] == LF || line[0] == 0) + if (line[0] == nsCRT::CR || line[0] == nsCRT::LF || line[0] == 0) { // End of headers. Now parse them; open the temp file; // and write the appropriate subset of the headers out. diff --git a/mailnews/compose/src/nsMsgSendPart.cpp b/mailnews/compose/src/nsMsgSendPart.cpp index b78a91494649..fb9721977c80 100644 --- a/mailnews/compose/src/nsMsgSendPart.cpp +++ b/mailnews/compose/src/nsMsgSendPart.cpp @@ -284,24 +284,24 @@ int nsMsgSendPart::PushBody(char* buffer, PRInt32 length) for (; in < end; in++) { if (m_just_hit_CR) { m_just_hit_CR = PR_FALSE; - if (*in == LF) { + if (*in == nsCRT::LF) { // The last thing we wrote was a CRLF from hitting a CR. // So, we don't want to do anything from a following LF; // we want to ignore it. continue; } } - if (*in == CR || *in == LF) { + if (*in == nsCRT::CR || *in == nsCRT::LF) { /* Write out the newline. */ - *out++ = CR; - *out++ = LF; + *out++ = nsCRT::CR; + *out++ = nsCRT::LF; status = mime_write_message_body(m_state, buffer, out - buffer); if (status < 0) return status; out = buffer; - if (*in == CR) { + if (*in == nsCRT::CR) { m_just_hit_CR = PR_TRUE; } @@ -392,11 +392,11 @@ divide_content_headers(const char *headers, /* Loop until we reach a newline that is not followed by whitespace. */ if (tail[0] == 0 || - ((tail[0] == CR || tail[0] == LF) && - !(tail[1] == ' ' || tail[1] == '\t' || tail[1] == LF))) + ((tail[0] == nsCRT::CR || tail[0] == nsCRT::LF) && + !(tail[1] == ' ' || tail[1] == '\t' || tail[1] == nsCRT::LF))) { /* Swallow the whole newline. */ - if (tail[0] == CR && tail[1] == LF) + if (tail[0] == nsCRT::CR && tail[1] == nsCRT::LF) tail++; if (*tail) tail++; @@ -592,9 +592,9 @@ nsMsgSendPart::Write() L = PL_strlen(content_type_header); - if (content_type_header[L-1] == LF) + if (content_type_header[L-1] == nsCRT::LF) content_type_header[--L] = 0; - if (content_type_header[L-1] == CR) + if (content_type_header[L-1] == nsCRT::CR) content_type_header[--L] = 0; ct2 = PR_smprintf("%s;\r\n boundary=\"%s\"" CRLF, content_type_header, separator); @@ -692,9 +692,9 @@ nsMsgSendPart::Write() } int hdrLen = PL_strlen(buffer); - if ((hdrLen < 2) || (buffer[hdrLen-2] != CR)) { // if the line doesn't end with CRLF, + if ((hdrLen < 2) || (buffer[hdrLen-2] != nsCRT::CR)) { // if the line doesn't end with CRLF, // ... make it end with CRLF. - if ( (hdrLen == 0) || ((buffer[hdrLen-1] != CR) && (buffer[hdrLen-1] != LF)) ) + if ( (hdrLen == 0) || ((buffer[hdrLen-1] != nsCRT::CR) && (buffer[hdrLen-1] != nsCRT::LF)) ) hdrLen++; buffer[hdrLen-1] = '\015'; buffer[hdrLen] = '\012'; @@ -720,7 +720,7 @@ nsMsgSendPart::Write() PUSH(line); - if (*line == CR || *line == LF) { + if (*line == nsCRT::CR || *line == nsCRT::LF) { break; // Now can do normal reads for the body. } } diff --git a/mailnews/imap/src/nsIMAPGenericParser.cpp b/mailnews/imap/src/nsIMAPGenericParser.cpp index dc7f3f71a346..f4b7ae6cc9bc 100644 --- a/mailnews/imap/src/nsIMAPGenericParser.cpp +++ b/mailnews/imap/src/nsIMAPGenericParser.cpp @@ -517,7 +517,7 @@ char *nsIMAPGenericParser::CreateLiteral() if (!terminatedLine) { if (fCurrentTokenPlaceHolder && - *fCurrentTokenPlaceHolder == LF && + *fCurrentTokenPlaceHolder == nsCRT::LF && *(fCurrentTokenPlaceHolder+1)) { // This is a static buffer, with a CRLF between the literal size ({91}) and diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 7b26604b3a00..d6ab70f29300 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -2517,7 +2517,7 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream, end = PL_strstr(start, "\r"); if (!end) end = PL_strstr(start, "\n"); - else if (*(end+1) == LF && linebreak_len == 0) + else if (*(end+1) == nsCRT::LF && linebreak_len == 0) linebreak_len = 2; if (linebreak_len == 0) // not initialize yet diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index 74fc99013812..5a375b978e3b 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -2882,8 +2882,8 @@ void nsImapProtocol::HandleMessageDownLoadLine(const char *line, PRBool chunkEnd if (MSG_LINEBREAK_LEN == 1 && !canonicalLineEnding) { if ((endOfLine - localMessageLine) >= 2 && - endOfLine[-2] == CR && - endOfLine[-1] == LF) + endOfLine[-2] == nsCRT::CR && + endOfLine[-1] == nsCRT::LF) { /* CRLF -> CR or LF */ endOfLine[-2] = MSG_LINEBREAK[0]; @@ -2891,7 +2891,7 @@ void nsImapProtocol::HandleMessageDownLoadLine(const char *line, PRBool chunkEnd } else if (endOfLine > localMessageLine + 1 && endOfLine[-1] != MSG_LINEBREAK[0] && - ((endOfLine[-1] == CR) || (endOfLine[-1] == LF))) + ((endOfLine[-1] == nsCRT::CR) || (endOfLine[-1] == nsCRT::LF))) { /* CR -> LF or LF -> CR */ endOfLine[-1] = MSG_LINEBREAK[0]; @@ -2904,10 +2904,10 @@ void nsImapProtocol::HandleMessageDownLoadLine(const char *line, PRBool chunkEnd } else { - if (((endOfLine - localMessageLine) >= 2 && endOfLine[-2] != CR) || - ((endOfLine - localMessageLine) >= 1 && endOfLine[-1] != LF)) + if (((endOfLine - localMessageLine) >= 2 && endOfLine[-2] != nsCRT::CR) || + ((endOfLine - localMessageLine) >= 1 && endOfLine[-1] != nsCRT::LF)) { - if ((endOfLine[-1] == CR) || (endOfLine[-1] == LF)) + if ((endOfLine[-1] == nsCRT::CR) || (endOfLine[-1] == nsCRT::LF)) { /* LF -> CRLF or CR -> CRLF */ endOfLine[-1] = MSG_LINEBREAK[0]; diff --git a/mailnews/imap/src/nsImapServerResponseParser.cpp b/mailnews/imap/src/nsImapServerResponseParser.cpp index f0fe1da890fa..3f07f18b3f38 100644 --- a/mailnews/imap/src/nsImapServerResponseParser.cpp +++ b/mailnews/imap/src/nsImapServerResponseParser.cpp @@ -2427,7 +2427,7 @@ PRBool nsImapServerResponseParser::msg_fetch_literal(PRBool chunk, PRInt32 origi AdvanceToNextLine(); if (ContinueParse()) { - if (lastCRLFwasCRCRLF && (*fCurrentLine == CR)) + if (lastCRLFwasCRCRLF && (*fCurrentLine == nsCRT::CR)) { char *usableCurrentLine = PL_strdup(fCurrentLine + 1); PR_FREEIF(fCurrentLine); @@ -2453,11 +2453,11 @@ PRBool nsImapServerResponseParser::msg_fetch_literal(PRBool chunk, PRInt32 origi *displayEndOfLine = 0; fServerConnection.HandleMessageDownLoadLine(fCurrentLine, !lastChunk); *displayEndOfLine = saveit; - lastCRLFwasCRCRLF = (*(displayEndOfLine - 1) == CR); + lastCRLFwasCRCRLF = (*(displayEndOfLine - 1) == nsCRT::CR); } else { - lastCRLFwasCRCRLF = (*(fCurrentLine + nsCRT::strlen(fCurrentLine) - 1) == CR); + lastCRLFwasCRCRLF = (*(fCurrentLine + nsCRT::strlen(fCurrentLine) - 1) == nsCRT::CR); fServerConnection.HandleMessageDownLoadLine(fCurrentLine, !lastChunk && (charsReadSoFar == numberOfCharsInThisChunk)); } } diff --git a/mailnews/import/eudora/src/nsEudoraImport.cpp b/mailnews/import/eudora/src/nsEudoraImport.cpp index f0e3491211c3..e5cf25405a52 100644 --- a/mailnews/import/eudora/src/nsEudoraImport.cpp +++ b/mailnews/import/eudora/src/nsEudoraImport.cpp @@ -414,7 +414,7 @@ NS_IMETHODIMP ImportMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISupportsArray void ImportMailImpl::AddLinebreak( nsString *pStream) { if (pStream) - pStream->AppendWithConversion( LF); + pStream->AppendWithConversion( char(nsCRT::LF)); } void ImportMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream) diff --git a/mailnews/import/oexpress/nsOEImport.cpp b/mailnews/import/oexpress/nsOEImport.cpp index e887c641de68..76672c16f5ec 100644 --- a/mailnews/import/oexpress/nsOEImport.cpp +++ b/mailnews/import/oexpress/nsOEImport.cpp @@ -373,7 +373,7 @@ NS_IMETHODIMP ImportMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISupportsArray void ImportMailImpl::AddLinebreak( nsString *pStream) { if (pStream) - pStream->AppendWithConversion( LF); + pStream->AppendWithConversion( char(nsCRT::LF)); } void ImportMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream) diff --git a/mailnews/import/outlook/src/nsOutlookImport.cpp b/mailnews/import/outlook/src/nsOutlookImport.cpp index f29ffeeb0fb0..bc5dfcc93405 100644 --- a/mailnews/import/outlook/src/nsOutlookImport.cpp +++ b/mailnews/import/outlook/src/nsOutlookImport.cpp @@ -378,7 +378,7 @@ NS_IMETHODIMP ImportMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISupportsArray void ImportMailImpl::AddLinebreak( nsString *pStream) { if (pStream) - pStream->AppendWithConversion( LF); + pStream->AppendWithConversion( char(nsCRT::LF)); } void ImportMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream) diff --git a/mailnews/import/text/src/nsTextImport.cpp b/mailnews/import/text/src/nsTextImport.cpp index 553893250bdd..d15c14dd2761 100644 --- a/mailnews/import/text/src/nsTextImport.cpp +++ b/mailnews/import/text/src/nsTextImport.cpp @@ -408,7 +408,7 @@ void ImportAddressImpl::ReportSuccess( nsString& name, nsString *pStream) pStream->Append( pText); nsTextFormatter::smprintf_free( pText); nsTextStringBundle::FreeString( pFmt); - pStream->AppendWithConversion( LF); + pStream->AppendWithConversion( char(nsCRT::LF)); NS_IF_RELEASE( pBundle); } @@ -423,7 +423,7 @@ void ImportAddressImpl::ReportError( PRInt32 errorNum, nsString& name, nsString pStream->Append( pText); nsTextFormatter::smprintf_free( pText); nsTextStringBundle::FreeString( pFmt); - pStream->AppendWithConversion( LF); + pStream->AppendWithConversion( char(nsCRT::LF)); NS_IF_RELEASE( pBundle); } diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 7742033c8696..d7590024c717 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -2167,7 +2167,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::CopyData(nsIInputStream *aIStream, PRInt32 a end = PL_strstr(start, "\r"); if (!end) end = PL_strstr(start, "\n"); - else if (*(end+1) == LF && linebreak_len == 0) + else if (*(end+1) == nsCRT::LF && linebreak_len == 0) linebreak_len = 2; if (linebreak_len == 0) // not set yet @@ -2227,7 +2227,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::CopyData(nsIInputStream *aIStream, PRInt32 a end = PL_strstr(start, "\r"); if (end) { - if (*(end+1) == LF) //need to set the linebreak_len each time + if (*(end+1) == nsCRT::LF) //need to set the linebreak_len each time linebreak_len = 2; //CRLF else linebreak_len = 1; //only CR @@ -2727,7 +2727,7 @@ nsresult nsMsgLocalMailFolder::DeleteMsgsOnPop3Server(nsISupportsArray *messages // Remove CR or LF at end of line char *lastChar = uidl + len - 1; - while ( (lastChar > uidl) && (*lastChar == LF || *lastChar == CR) ) { + while ( (lastChar > uidl) && (*lastChar == nsCRT::LF || *lastChar == nsCRT::CR) ) { *lastChar = '\0'; lastChar --; } diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp index 65ce75c1fc80..9fb567e37a0b 100644 --- a/mailnews/local/src/nsParseMailbox.cpp +++ b/mailnews/local/src/nsParseMailbox.cpp @@ -876,14 +876,14 @@ int nsParseMailMessageState::ParseHeaders () header->value = value; SEARCH_NEWLINE: - while (*buf != 0 && *buf != CR && *buf != LF) + while (*buf != 0 && *buf != nsCRT::CR && *buf != nsCRT::LF) buf++; if (buf+1 >= buf_end) ; /* If "\r\n " or "\r\n\t" is next, that doesn't terminate the header. */ else if (buf+2 < buf_end && - (buf[0] == CR && buf[1] == LF) && + (buf[0] == nsCRT::CR && buf[1] == nsCRT::LF) && (buf[2] == ' ' || buf[2] == '\t')) { buf += 3; @@ -891,7 +891,7 @@ int nsParseMailMessageState::ParseHeaders () } /* If "\r " or "\r\t" or "\n " or "\n\t" is next, that doesn't terminate the header either. */ - else if ((buf[0] == CR || buf[0] == LF) && + else if ((buf[0] == nsCRT::CR || buf[0] == nsCRT::LF) && (buf[1] == ' ' || buf[1] == '\t')) { buf += 2; @@ -901,10 +901,10 @@ int nsParseMailMessageState::ParseHeaders () if (header) header->length = buf - header->value; - if (*buf == CR || *buf == LF) + if (*buf == nsCRT::CR || *buf == nsCRT::LF) { char *last = buf; - if (*buf == CR && buf[1] == LF) + if (*buf == nsCRT::CR && buf[1] == nsCRT::LF) buf++; buf++; *last = 0; /* short-circuit const, and null-terminate header. */ diff --git a/mailnews/local/src/nsPop3Protocol.cpp b/mailnews/local/src/nsPop3Protocol.cpp index 20f8a153539e..342abd28c750 100644 --- a/mailnews/local/src/nsPop3Protocol.cpp +++ b/mailnews/local/src/nsPop3Protocol.cpp @@ -178,7 +178,7 @@ net_pop3_load_state(const char* searchhost, while (!fileStream.eof() && !fileStream.failed() && fileStream.is_open()) { fileStream.readline(buf, 512); - if (*buf == '#' || *buf == CR || *buf == LF || *buf == 0) + if (*buf == '#' || *buf == nsCRT::CR || *buf == nsCRT::LF || *buf == 0) continue; if (buf[0] == '*') { /* It's a host&user line. */ @@ -2384,7 +2384,7 @@ nsPop3Protocol::HandleLine(char *line, PRUint32 line_length) } if ((line[0] == '.') && - ((line[1] == CR) || (line[1] == LF))) + ((line[1] == nsCRT::CR) || (line[1] == nsCRT::LF))) { m_pop3ConData->assumed_end = PR_TRUE; /* in case byte count from server is */ /* wrong, mark we may have had the end */ diff --git a/mailnews/local/src/nsPop3Sink.cpp b/mailnews/local/src/nsPop3Sink.cpp index f40dc02029bf..99570df1a94c 100644 --- a/mailnews/local/src/nsPop3Sink.cpp +++ b/mailnews/local/src/nsPop3Sink.cpp @@ -338,7 +338,7 @@ nsPop3Sink::GetDummyEnvelope(void) now = 0x7FFFFFFF; #endif ct = ctime(&now); - PR_ASSERT(ct[24] == CR || ct[24] == LF); + PR_ASSERT(ct[24] == nsCRT::CR || ct[24] == nsCRT::LF); ct[24] = 0; /* This value must be in ctime() format, with English abbreviations. strftime("... %c ...") is no good, because it is localized. */ diff --git a/mailnews/mime/cthandlers/vcard/mimevcrd.cpp b/mailnews/mime/cthandlers/vcard/mimevcrd.cpp index f440de184765..9ae9558b2f9d 100644 --- a/mailnews/mime/cthandlers/vcard/mimevcrd.cpp +++ b/mailnews/mime/cthandlers/vcard/mimevcrd.cpp @@ -1735,7 +1735,7 @@ FindCharacterSet(MimeObject *obj) return nsnull; } - while ( (*cTypePtr) && (*cTypePtr != CR) && (*cTypePtr != LF) ) + while ( (*cTypePtr) && (*cTypePtr != nsCRT::CR) && (*cTypePtr != nsCRT::LF) ) { tCharSet = (char *) PL_strcasestr(cTypePtr, "charset="); if (tCharSet ) @@ -1753,7 +1753,7 @@ FindCharacterSet(MimeObject *obj) while (*ptr) { - if ( (*ptr == ' ') || (*ptr == ';') || (*ptr == CR) || (*ptr == LF) ) + if ( (*ptr == ' ') || (*ptr == ';') || (*ptr == nsCRT::CR) || (*ptr == nsCRT::LF) ) { *ptr = '\0'; break; @@ -1861,14 +1861,14 @@ MIME_StripContinuations(char *original) while(*p2) { /* p2 runs ahead at (CR and/or LF) + */ - if ((p2[0] == CR) || (p2[0] == LF)) + if ((p2[0] == nsCRT::CR) || (p2[0] == nsCRT::LF)) { /* move past (CR and/or LF) + whitespace following */ do { p2++; } - while((*p2 == CR) || (*p2 == LF) || IS_SPACE(*p2)); + while((*p2 == nsCRT::CR) || (*p2 == nsCRT::LF) || IS_SPACE(*p2)); if (*p2 == '\0') continue; /* drop out of loop at end of string*/ } diff --git a/mailnews/mime/cthandlers/vcard/nsVCardObj.cpp b/mailnews/mime/cthandlers/vcard/nsVCardObj.cpp index 2091fdda9811..a2485e0c1d49 100644 --- a/mailnews/mime/cthandlers/vcard/nsVCardObj.cpp +++ b/mailnews/mime/cthandlers/vcard/nsVCardObj.cpp @@ -1180,7 +1180,7 @@ static void writeQPString(OFile *fp, const char *s) if (needsQuotedPrintable (s)) { while (*p) { - if (*p == CR || *p == LF) + if (*p == nsCRT::CR || *p == nsCRT::LF) { /* Whitespace cannot be allowed to occur at the end of the line. So we encode " \n" as " =\n\n", that is, the whitespace, a @@ -1209,7 +1209,7 @@ static void writeQPString(OFile *fp, const char *s) } /* If its CRLF, swallow two chars instead of one. */ - if (*p == CR && *(p+1) == LF) + if (*p == nsCRT::CR && *(p+1) == nsCRT::LF) p++; white = PR_FALSE; current_column = 0; diff --git a/mailnews/mime/src/comi18n.cpp b/mailnews/mime/src/comi18n.cpp index e0bfd4df3cfa..cd9503e2b131 100644 --- a/mailnews/mime/src/comi18n.cpp +++ b/mailnews/mime/src/comi18n.cpp @@ -92,23 +92,23 @@ do \ #define OUTPUT_MACHINE_NEW_LINE(c) \ do \ { \ - OUTPUT(CR); \ - OUTPUT(LF); \ + OUTPUT(nsCRT::CR); \ + OUTPUT(nsCRT::LF); \ } while (0) #else #ifdef XP_MAC #define OUTPUT_MACHINE_NEW_LINE(c) \ do \ { \ - OUTPUT(CR); \ - if (c) OUTPUT(LF); \ + OUTPUT(nsCRT::CR); \ + if (c) OUTPUT(nsCRT::LF); \ } while (0) #else #define OUTPUT_MACHINE_NEW_LINE(c) \ do \ { \ - if (c) OUTPUT(CR); \ - OUTPUT(LF); \ + if (c) OUTPUT(nsCRT::CR); \ + OUTPUT(nsCRT::LF); \ } while (0) #endif #endif @@ -129,7 +129,7 @@ do \ #define NEW_LINE(c) \ do \ { \ - if ((*in == CR) && (*(in + 1) == LF)) \ + if ((*in == nsCRT::CR) && (*(in + 1) == nsCRT::LF)) \ { \ in += 2; \ } \ @@ -179,7 +179,7 @@ xp_word_wrap(unsigned char *str, int maxColumn, int checkQuoting, { if (checkQuoting && (in == beginningOfLine) && (*in == '>')) { - while (*in && (*in != CR) && (*in != LF)) + while (*in && (*in != nsCRT::CR) && (*in != nsCRT::LF)) { OUTPUT(*in++); } @@ -199,7 +199,7 @@ xp_word_wrap(unsigned char *str, int maxColumn, int checkQuoting, } else { - if ((*in == CR) || (*in == LF)) + if ((*in == nsCRT::CR) || (*in == nsCRT::LF)) { if (in != beginningOfLine) { @@ -711,7 +711,7 @@ convert_and_encode: if ( ( maxLineLen - line_len < 30 ) || bChop ) { /* chop first, then continue */ buf1 = retbuf + retbuflen; - *buf1++ = CR; *buf1++ = LF; *buf1++ = '\t'; + *buf1++ = nsCRT::CR; *buf1++ = nsCRT::LF; *buf1++ = '\t'; line_len = 0; retbuflen += 3; *buf1 = '\0'; @@ -862,8 +862,8 @@ convert_and_encode: if ((line_len > 10) && ((line_len + convlen) > maxLineLen)) { - *buf1++ = CR; - *buf1++ = LF; + *buf1++ = nsCRT::CR; + *buf1++ = nsCRT::LF; *buf1++ = '\t'; line_len = 0; iThreshold = default_iThreshold; @@ -905,8 +905,8 @@ convert_and_encode: if ((line_len > 10) && ((line_len + len) > maxLineLen)) { - *buf1++ = CR; - *buf1++ = LF; + *buf1++ = nsCRT::CR; + *buf1++ = nsCRT::LF; *buf1++ = '\t'; line_len = 0; iThreshold = default_iThreshold; @@ -914,7 +914,7 @@ convert_and_encode: /* copy buffer from begin to buf1 stripping CRLFTAB */ for (p = begin; *p; p++) { - if (*p == CR || *p == LF || *p == TAB) + if (*p == nsCRT::CR || *p == nsCRT::LF || *p == TAB) len --; else *buf1++ = *p; @@ -924,7 +924,7 @@ convert_and_encode: } buf1 = buf1 + nsCRT::strlen(buf1); - if (sep == CR || sep == LF || sep == TAB) /* strip CR,LF,TAB */ + if (sep == nsCRT::CR || sep == nsCRT::LF || sep == TAB) /* strip CR,LF,TAB */ *buf1 = '\0'; else { diff --git a/mailnews/mime/src/mimebuf.cpp b/mailnews/mime/src/mimebuf.cpp index 356b865ccdcc..176f9fbbc295 100644 --- a/mailnews/mime/src/mimebuf.cpp +++ b/mailnews/mime/src/mimebuf.cpp @@ -126,23 +126,23 @@ convert_and_send_buffer(char* buf, int length, PRBool convert_newlines_p, * terminated by CR then a second line that contains only NULL+LF. We need to ignore this second * line. See bug http://bugzilla.mozilla.org/show_bug.cgi?id=61412 for more information. ***/ - if (length == 2 && buf[0] == 0x00 && buf[1] == LF) + if (length == 2 && buf[0] == 0x00 && buf[1] == nsCRT::LF) return 0; #endif PR_ASSERT(buf && length > 0); if (!buf || length <= 0) return -1; newline = buf + length; - PR_ASSERT(newline[-1] == CR || newline[-1] == LF); - if (newline[-1] != CR && newline[-1] != LF) return -1; + PR_ASSERT(newline[-1] == nsCRT::CR || newline[-1] == nsCRT::LF); + if (newline[-1] != nsCRT::CR && newline[-1] != nsCRT::LF) return -1; if (!convert_newlines_p) { } #if (MSG_LINEBREAK_LEN == 1) else if ((newline - buf) >= 2 && - newline[-2] == CR && - newline[-1] == LF) + newline[-2] == nsCRT::CR && + newline[-1] == nsCRT::LF) { /* CRLF -> CR or LF */ buf [length - 2] = MSG_LINEBREAK[0]; @@ -155,8 +155,8 @@ convert_and_send_buffer(char* buf, int length, PRBool convert_newlines_p, buf [length - 1] = MSG_LINEBREAK[0]; } #else - else if (((newline - buf) >= 2 && newline[-2] != CR) || - ((newline - buf) >= 1 && newline[-1] != LF)) + else if (((newline - buf) >= 2 && newline[-2] != nsCRT::CR) || + ((newline - buf) >= 1 && newline[-1] != nsCRT::LF)) { /* LF -> CRLF or CR -> CRLF */ length++; @@ -177,8 +177,8 @@ mime_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size, void *closure) { int status = 0; - if (*buffer_fpP > 0 && *bufferP && (*bufferP)[*buffer_fpP - 1] == CR && - net_buffer_size > 0 && net_buffer[0] != LF) { + if (*buffer_fpP > 0 && *bufferP && (*bufferP)[*buffer_fpP - 1] == nsCRT::CR && + net_buffer_size > 0 && net_buffer[0] != nsCRT::LF) { /* The last buffer ended with a CR. The new buffer does not start with a LF. This old buffer should be shipped out and discarded. */ PR_ASSERT((PRUint32) *buffer_sizeP > *buffer_fpP); @@ -205,10 +205,10 @@ mime_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size, seeing a line terminator. This is to catch the case of the buffers splitting a CRLF pair, as in "FOO\r\nBAR\r" "\nBAZ\r\n". */ - if (*s == CR || *s == LF) + if (*s == nsCRT::CR || *s == nsCRT::LF) { newline = s; - if (newline[0] == CR) + if (newline[0] == nsCRT::CR) { if (s == net_buffer_end - 1) { @@ -216,7 +216,7 @@ mime_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size, newline = 0; break; } - else if (newline[1] == LF) + else if (newline[1] == nsCRT::LF) /* CRLF seen; swallow both. */ newline++; } diff --git a/mailnews/mime/src/mimeebod.cpp b/mailnews/mime/src/mimeebod.cpp index c9f4d3bc161b..19b8800503d5 100644 --- a/mailnews/mime/src/mimeebod.cpp +++ b/mailnews/mime/src/mimeebod.cpp @@ -143,7 +143,7 @@ MimeExternalBody_parse_line (char *line, PRInt32 length, MimeObject *obj) /* If this line is blank, we're now done parsing headers, and should create a dummy body to show that. Gag. */ - if (*line == CR || *line == LF) + if (*line == nsCRT::CR || *line == nsCRT::LF) { bod->body = nsCRT::strdup(""); if (!bod->body) return MIME_OUT_OF_MEMORY; diff --git a/mailnews/mime/src/mimeenc.cpp b/mailnews/mime/src/mimeenc.cpp index ea7c6334aa92..1110525c8c65 100644 --- a/mailnews/mime/src/mimeenc.cpp +++ b/mailnews/mime/src/mimeenc.cpp @@ -114,10 +114,10 @@ mime_decode_qp_buffer (MimeDecoderData *data, const char *buffer, PRInt32 length c = token[1] - ('A' - 10); else if (token[1] >= 'a' && token[1] <= 'f') c = token[1] - ('a' - 10); - else if (token[1] == CR || token[1] == LF) + else if (token[1] == nsCRT::CR || token[1] == nsCRT::LF) { /* =\n means ignore the newline. */ - if (token[1] == CR && token[2] == LF) + if (token[1] == nsCRT::CR && token[2] == nsCRT::LF) ; /* swallow all three chars */ else { @@ -346,13 +346,13 @@ mime_decode_uue_buffer (MimeDecoderData *data, *out++ = *input_buffer++; input_length--; - if (out[-1] == CR || out[-1] == LF) + if (out[-1] == nsCRT::CR || out[-1] == nsCRT::LF) { /* If we just copied a CR, and an LF is waiting, grab it too. */ - if (out[-1] == CR && + if (out[-1] == nsCRT::CR && input_length > 0 && - *input_buffer == LF) + *input_buffer == nsCRT::LF) input_buffer++, input_length--; /* We have a line. */ @@ -363,7 +363,7 @@ mime_decode_uue_buffer (MimeDecoderData *data, /* Ignore blank lines. */ - if (*line == CR || *line == LF) + if (*line == nsCRT::CR || *line == nsCRT::LF) { *line = 0; continue; @@ -376,14 +376,14 @@ mime_decode_uue_buffer (MimeDecoderData *data, if (out == line_end) { out--; - out[-1] = CR; + out[-1] = nsCRT::CR; out[0] = 0; } /* If we didn't get a complete line, simply return; we'll be called with the rest of this line next time. */ - if (out[-1] != CR && out[-1] != LF) + if (out[-1] != nsCRT::CR && out[-1] != nsCRT::LF) { PR_ASSERT (input_length == 0); break; @@ -399,8 +399,8 @@ mime_decode_uue_buffer (MimeDecoderData *data, line[0] == 'e' && line[1] == 'n' && line[2] == 'd' && - (line[3] == CR || - line[3] == LF)) + (line[3] == nsCRT::CR || + line[3] == nsCRT::LF)) { /* done! */ data->uue_state = UUE_END; @@ -645,8 +645,8 @@ mime_uuencode_write_line(MimeEncoderData *data) data->uue_line_buf[0] = ENC(data->line_byte_count); /* Tack a CRLF onto the end. */ - data->uue_line_buf[data->current_column++] = CR; - data->uue_line_buf[data->current_column++] = LF; + data->uue_line_buf[data->current_column++] = nsCRT::CR; + data->uue_line_buf[data->current_column++] = nsCRT::LF; /* Write the line to output. */ data->write_buffer((const char*)data->uue_line_buf, data->current_column, @@ -885,7 +885,7 @@ mime_encode_qp_buffer (MimeEncoderData *data, const char *buffer, PRInt32 size) */ for (; in < end; in++) { - if (*in == CR || *in == LF) + if (*in == nsCRT::CR || *in == nsCRT::LF) { /* Whitespace cannot be allowed to occur at the end of @@ -902,8 +902,8 @@ mime_encode_qp_buffer (MimeEncoderData *data, const char *buffer, PRInt32 size) } /* Now write out the newline. */ - *out++ = CR; - *out++ = LF; + *out++ = nsCRT::CR; + *out++ = nsCRT::LF; white = PR_FALSE; status = data->write_buffer (out_buffer, (out - out_buffer), @@ -912,7 +912,7 @@ mime_encode_qp_buffer (MimeEncoderData *data, const char *buffer, PRInt32 size) out = out_buffer; /* If its CRLF, swallow two chars instead of one. */ - if (in[0] == CR && in[1] == LF) + if (in[0] == nsCRT::CR && in[1] == nsCRT::LF) in++; out = out_buffer; @@ -973,8 +973,8 @@ mime_encode_qp_buffer (MimeEncoderData *data, const char *buffer, PRInt32 size) if (data->current_column >= 73) /* soft line break: "=\r\n" */ { *out++ = '='; - *out++ = CR; - *out++ = LF; + *out++ = nsCRT::CR; + *out++ = nsCRT::LF; status = data->write_buffer (out_buffer, (out - out_buffer), data->closure); @@ -1030,8 +1030,8 @@ MimeEncoderDestroy (MimeEncoderData *data, PRBool abort_p) if (data->in_buffer_count > 1) n = n | (((PRUint32) data->in_buffer[1]) << 8); - buf2[0] = CR; - buf2[1] = LF; + buf2[0] = nsCRT::CR; + buf2[1] = nsCRT::LF; for (j = 18; j >= 0; j -= 6) { diff --git a/mailnews/mime/src/mimehdrs.cpp b/mailnews/mime/src/mimehdrs.cpp index b357528dcce2..a388b219b2ab 100644 --- a/mailnews/mime/src/mimehdrs.cpp +++ b/mailnews/mime/src/mimehdrs.cpp @@ -126,7 +126,7 @@ MimeHeaders_parse_line (const char *buffer, PRInt32 size, MimeHeaders *hdrs) PR_ASSERT(!hdrs->done_p); if (hdrs->done_p) return -1; - if (!buffer || size == 0 || *buffer == CR || *buffer == LF) + if (!buffer || size == 0 || *buffer == nsCRT::CR || *buffer == nsCRT::LF) { /* If this is a blank line, we're done. */ @@ -237,10 +237,10 @@ MimeHeaders_build_heads_list(MimeHeaders *hdrs) end = hdrs->all_headers + hdrs->all_headers_fp; for (s = hdrs->all_headers; s <= end-1; s++) { - if (s <= (end-1) && s[0] == CR && s[1] == LF) /* CRLF -> LF */ + if (s <= (end-1) && s[0] == nsCRT::CR && s[1] == nsCRT::LF) /* CRLF -> LF */ s++; - if ((s[0] == CR || s[0] == LF) && /* we're at a newline, and */ + if ((s[0] == nsCRT::CR || s[0] == nsCRT::LF) && /* we're at a newline, and */ (s >= (end-1) || /* we're at EOF, or */ !(s[1] == ' ' || s[1] == '\t'))) /* next char is nonwhite */ hdrs->heads_size++; @@ -265,7 +265,7 @@ MimeHeaders_build_heads_list(MimeHeaders *hdrs) while (s <= end) { SEARCH_NEWLINE: - while (s <= end-1 && *s != CR && *s != LF) + while (s <= end-1 && *s != nsCRT::CR && *s != nsCRT::LF) s++; if (s+1 >= end) @@ -273,7 +273,7 @@ MimeHeaders_build_heads_list(MimeHeaders *hdrs) /* If "\r\n " or "\r\n\t" is next, that doesn't terminate the header. */ else if (s+2 < end && - (s[0] == CR && s[1] == LF) && + (s[0] == nsCRT::CR && s[1] == nsCRT::LF) && (s[2] == ' ' || s[2] == '\t')) { s += 3; @@ -281,7 +281,7 @@ MimeHeaders_build_heads_list(MimeHeaders *hdrs) } /* If "\r " or "\r\t" or "\n " or "\n\t" is next, that doesn't terminate the header either. */ - else if ((s[0] == CR || s[0] == LF) && + else if ((s[0] == nsCRT::CR || s[0] == nsCRT::LF) && (s[1] == ' ' || s[1] == '\t')) { s += 2; @@ -291,8 +291,8 @@ MimeHeaders_build_heads_list(MimeHeaders *hdrs) /* At this point, `s' points before a header-terminating newline. Move past that newline, and store that new position in `heads'. */ - if (*s == CR) s++; - if (*s == LF) s++; + if (*s == nsCRT::CR) s++; + if (*s == nsCRT::LF) s++; if (s < end) { @@ -790,7 +790,7 @@ MIME_StripContinuations(char *original) while(*p2) { /* p2 runs ahead at (CR and/or LF) */ - if ((p2[0] == CR) || (p2[0] == LF)) + if ((p2[0] == nsCRT::CR) || (p2[0] == nsCRT::LF)) { p2++; } else { @@ -824,7 +824,7 @@ mime_decode_filename(char *name, const char *charset, { /* Remove backslashes when they are used to escape special characters. */ if ((*s == '\\') && - ((*(s+1) == CR) || (*(s+1) == LF) || (*(s+1) == '"') || (*(s+1) == '\\'))) + ((*(s+1) == nsCRT::CR) || (*(s+1) == nsCRT::LF) || (*(s+1) == '"') || (*(s+1) == '\\'))) s++; /* take whatever char follows the backslash */ if (*s) *d++ = *s++; diff --git a/mailnews/mime/src/mimemoz2.cpp b/mailnews/mime/src/mimemoz2.cpp index d86b8299246d..0ea615f13be4 100644 --- a/mailnews/mime/src/mimemoz2.cpp +++ b/mailnews/mime/src/mimemoz2.cpp @@ -1871,7 +1871,7 @@ ResetChannelCharset(MimeObject *obj) { char *ptr2 = cSet; while ( (*cSet) && (*cSet != ' ') && (*cSet != ';') && - (*cSet != CR) && (*cSet != LF) && (*cSet != '"') ) + (*cSet != nsCRT::CR) && (*cSet != nsCRT::LF) && (*cSet != '"') ) ptr2++; if (*cSet) { diff --git a/mailnews/mime/src/mimemsg.cpp b/mailnews/mime/src/mimemsg.cpp index c638da4144e7..54f854072bbd 100644 --- a/mailnews/mime/src/mimemsg.cpp +++ b/mailnews/mime/src/mimemsg.cpp @@ -149,7 +149,7 @@ MimeMessage_parse_line (char *line, PRInt32 length, MimeObject *obj) char *tPtr = obj->headers->munged_subject; while (*tPtr) { - if ( (*tPtr == CR) || (*tPtr == LF) ) + if ( (*tPtr == nsCRT::CR) || (*tPtr == nsCRT::LF) ) { *tPtr = '\0'; break; @@ -180,7 +180,7 @@ MimeMessage_parse_line (char *line, PRInt32 length, MimeObject *obj) called with a line that doesn't end in a newline is when that line is the last line. */ - nl = (length > 0 && (line[length-1] == CR || line[length-1] == LF)); + nl = (length > 0 && (line[length-1] == nsCRT::CR || line[length-1] == nsCRT::LF)); #ifdef MIME_DRAFTS if ( !mime_typep (kid, (MimeObjectClass*) &mimeMessageClass) && @@ -250,7 +250,7 @@ MimeMessage_parse_line (char *line, PRInt32 length, MimeObject *obj) /* If this line is blank, we're now done parsing headers, and should examine our content-type to create our "body" part. */ - if (*line == CR || *line == LF) + if (*line == nsCRT::CR || *line == nsCRT::LF) { status = MimeMessage_close_headers(obj); if (status < 0) return status; diff --git a/mailnews/mime/src/mimemsig.cpp b/mailnews/mime/src/mimemsig.cpp index 8803fca7a0a7..1ae454c6dfb0 100644 --- a/mailnews/mime/src/mimemsig.cpp +++ b/mailnews/mime/src/mimemsig.cpp @@ -316,8 +316,8 @@ MimeMultipartSigned_parse_line (char *line, PRInt32 length, MimeObject *obj) */ /* Remove the trailing newline... */ - if (length > 0 && line[length-1] == LF) length--; - if (length > 0 && line[length-1] == CR) length--; + if (length > 0 && line[length-1] == nsCRT::LF) length--; + if (length > 0 && line[length-1] == nsCRT::CR) length--; PR_ASSERT(sig->xlation_closure); @@ -524,8 +524,8 @@ MimeMultipartSigned_parse_child_line (MimeObject *obj, */ /* Remove the trailing newline... */ - if (length > 0 && line[length-1] == LF) length--; - if (length > 0 && line[length-1] == CR) length--; + if (length > 0 && line[length-1] == nsCRT::LF) length--; + if (length > 0 && line[length-1] == nsCRT::CR) length--; PR_ASSERT(sig->part_buffer); PR_ASSERT(first_line_p == diff --git a/mailnews/mime/src/mimemult.cpp b/mailnews/mime/src/mimemult.cpp index 7764657f997a..f0c045dc4672 100644 --- a/mailnews/mime/src/mimemult.cpp +++ b/mailnews/mime/src/mimemult.cpp @@ -198,7 +198,7 @@ MimeMultipart_parse_line (char *line, PRInt32 length, MimeObject *obj) // If this line is blank, we're now done parsing headers, and should // now examine the content-type to create this "body" part. // - if (*line == CR || *line == LF) + if (*line == nsCRT::CR || *line == nsCRT::LF) { status = ((MimeMultipartClass *) obj->clazz)->create_child(obj); if (status < 0) return status; @@ -531,8 +531,8 @@ MimeMultipart_parse_child_line (MimeObject *obj, char *line, PRInt32 length, */ /* Remove the trailing newline... */ - if (length > 0 && line[length-1] == LF) length--; - if (length > 0 && line[length-1] == CR) length--; + if (length > 0 && line[length-1] == nsCRT::LF) length--; + if (length > 0 && line[length-1] == nsCRT::CR) length--; if (!first_line_p) { diff --git a/mailnews/mime/src/mimesun.cpp b/mailnews/mime/src/mimesun.cpp index 0152cea14a3f..b9f41e731577 100644 --- a/mailnews/mime/src/mimesun.cpp +++ b/mailnews/mime/src/mimesun.cpp @@ -96,7 +96,7 @@ MimeSunAttachment_check_boundary(MimeObject *obj, const char *line, line[0] == '-' && line[1] == '-' && line[2] == '-' && line[3] == '-' && line[4] == '-' && line[5] == '-' && line[6] == '-' && line[7] == '-' && line[8] == '-' && line[9] == '-' && - (line[10] == CR || line[10] == LF)) + (line[10] == nsCRT::CR || line[10] == nsCRT::LF)) return MimeMultipartBoundaryTypeSeparator; else return MimeMultipartBoundaryTypeNone; diff --git a/mailnews/mime/src/mimeunty.cpp b/mailnews/mime/src/mimeunty.cpp index 200d80b8661f..d415a002f33a 100644 --- a/mailnews/mime/src/mimeunty.cpp +++ b/mailnews/mime/src/mimeunty.cpp @@ -159,8 +159,8 @@ MimeUntypedText_parse_line (char *line, PRInt32 length, MimeObject *obj) // just eat it and continue and if we really get more data, we'll open // up the subpart then. // - if (line[0] == CR) return 0; - if (line[0] == LF) return 0; + if (line[0] == nsCRT::CR) return 0; + if (line[0] == nsCRT::LF) return 0; PR_ASSERT(!begin_line_p); status = MimeUntypedText_open_subpart (obj, @@ -412,8 +412,8 @@ MimeUntypedText_uu_begin_line_p(const char *line, PRInt32 length, name[(line+length)-s] = 0; /* take off newline. */ - if (name[nsCRT::strlen(name)-1] == LF) name[nsCRT::strlen(name)-1] = 0; - if (name[nsCRT::strlen(name)-1] == CR) name[nsCRT::strlen(name)-1] = 0; + if (name[nsCRT::strlen(name)-1] == nsCRT::LF) name[nsCRT::strlen(name)-1] = 0; + if (name[nsCRT::strlen(name)-1] == nsCRT::CR) name[nsCRT::strlen(name)-1] = 0; /* Now try and figure out a type. */ @@ -493,8 +493,8 @@ MimeUntypedText_binhex_begin_line_p(const char *line, PRInt32 length, static PRBool MimeUntypedText_binhex_end_line_p(const char *line, PRInt32 length) { - if (length > 0 && line[length-1] == LF) length--; - if (length > 0 && line[length-1] == CR) length--; + if (length > 0 && line[length-1] == nsCRT::LF) length--; + if (length > 0 && line[length-1] == nsCRT::CR) length--; if (length != 0 && length != 64) return PR_TRUE; diff --git a/mailnews/mime/src/nsMsgHeaderParser.cpp b/mailnews/mime/src/nsMsgHeaderParser.cpp index a6a2cc7e24f3..0458b4a1b354 100644 --- a/mailnews/mime/src/nsMsgHeaderParser.cpp +++ b/mailnews/mime/src/nsMsgHeaderParser.cpp @@ -1407,8 +1407,8 @@ msg_format_Header_addresses (const char *names, const char *addrs, { if (out > result && out[-1] == ' ') out--; - *out++ = CR; - *out++ = LF; + *out++ = nsCRT::CR; + *out++ = nsCRT::LF; *out++ = '\t'; column = 8; } diff --git a/mailnews/news/src/nsNewsFolder.cpp b/mailnews/news/src/nsNewsFolder.cpp index b9dc58021b92..c36c633b422e 100644 --- a/mailnews/news/src/nsNewsFolder.cpp +++ b/mailnews/news/src/nsNewsFolder.cpp @@ -1114,7 +1114,7 @@ nsMsgNewsFolder::HandleNewsrcLine(char* line, PRUint32 line_size) nsresult rv; /* guard against blank line lossage */ - if (line[0] == '#' || line[0] == CR || line[0] == LF) return 0; + if (line[0] == '#' || line[0] == nsCRT::CR || line[0] == nsCRT::LF) return 0; line[line_size] = 0; diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 5786a9051e67..2b464909578d 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -859,7 +859,7 @@ nsFtpState::Process() { mNextState = FTP_ERROR; PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) FAILED\n", this)); } else { - char *lf = PL_strchr(mResponseMsg.get(), LF); + char *lf = PL_strchr(mResponseMsg.get(), nsCRT::LF); if (lf && lf+1 && *(lf+1)) // we have a double response // need to read again... @@ -1542,7 +1542,7 @@ nsFtpState::R_retr() { // this can happen if the server sends back two // responses before we've processed the first one. PRInt32 loc = -1; - loc = mResponseMsg.FindChar(LF); + loc = mResponseMsg.FindChar(nsCRT::LF); if (loc > -1) { PRInt32 err; nsCAutoString response; diff --git a/netwerk/protocol/http/src/nsHTTPChannel.cpp b/netwerk/protocol/http/src/nsHTTPChannel.cpp index ff4ee255ffad..e9b94ce8384b 100644 --- a/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -2519,7 +2519,7 @@ nsHTTPChannel::Authenticate(const char *aChallenge, PRBool aProxyAuth) // go thru each to see if we support that. for (const char *eol = aChallenge-1; eol != 0;) { const char* bol = eol+1; - eol = PL_strchr(bol, LF); + eol = PL_strchr(bol, nsCRT::LF); if (eol) authLine.Assign(bol, eol-bol); else diff --git a/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp b/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp index c26ddd4764ba..be20c1863e9a 100644 --- a/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp +++ b/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp @@ -166,7 +166,7 @@ nsresult nsHTTPHeaderArray::SetHeader(nsIAtom* aHeader, // we can't use the standard comma because there // set-cookie headers that include commas in the cookie value // contrary to the specs not allowing it. - entry->mValue.Append(LF); + entry->mValue.Append(char(nsCRT::LF)); entry->mValue.Append(aValue); } else { // delimit each value from the others using a comma diff --git a/netwerk/protocol/http/src/nsHTTPResponseListener.cpp b/netwerk/protocol/http/src/nsHTTPResponseListener.cpp index 7eac0cb677f1..68e5ebf11788 100644 --- a/netwerk/protocol/http/src/nsHTTPResponseListener.cpp +++ b/netwerk/protocol/http/src/nsHTTPResponseListener.cpp @@ -859,7 +859,7 @@ nsWriteLineToString(nsIInputStream* in, for (; count>0; --count) { c = *p++; (*writeCount)++; - if (c == LF) { + if (c == nsCRT::LF) { info->haveLF = PR_TRUE; break; } @@ -910,7 +910,7 @@ nsresult nsHTTPServerListener::ParseStatusLine(nsIInputStream* in, } // Wait for more data to arrive before processing the header... - if (bL > 0 && mHeaderBuffer.CharAt(bL - 1) != LF) return NS_OK; + if (bL > 0 && mHeaderBuffer.CharAt(bL - 1) != nsCRT::LF) return NS_OK; LOG(("\tParseStatusLine [this=%x].\tGot Status-Line:%s\n", this, mHeaderBuffer.get())); @@ -983,7 +983,7 @@ nsresult nsHTTPServerListener::ParseHTTPHeader(nsIInputStream* in, // If last character in the header string is a LF, then the header // may be complete... // - newlineOffset = mHeaderBuffer.FindChar(LF, PR_FALSE, newlineOffset); + newlineOffset = mHeaderBuffer.FindChar(nsCRT::LF, PR_FALSE, newlineOffset); if (newlineOffset == -1) return NS_OK; diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp index db35f9233e50..9aacdd252774 100644 --- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp @@ -128,7 +128,7 @@ nsFTPDirListingConv::Convert(nsIInputStream *aFromStream, convertedData.Append("300: "); convertedData.Append(spec); - convertedData.Append(LF); + convertedData.Append(char(nsCRT::LF)); // END 300: // build up the column heading; 200: @@ -304,7 +304,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, indexFormat.Append("300: "); indexFormat.Append(spec); - indexFormat.Append(LF); + indexFormat.Append(char(nsCRT::LF)); nsMemory::Free(spec); // END 300: @@ -731,9 +731,9 @@ nsFTPDirListingConv::DigestBufferLines(char *aBuffer, nsCAutoString &aString) { PRBool cr = PR_FALSE; // while we have new lines, parse 'em into application/http-index-format. - while ( line && (eol = PL_strchr(line, LF)) ) { + while ( line && (eol = PL_strchr(line, nsCRT::LF)) ) { // yank any carriage returns too. - if (eol > line && *(eol-1) == CR) { + if (eol > line && *(eol-1) == nsCRT::CR) { eol--; *eol = '\0'; cr = PR_TRUE; @@ -984,7 +984,7 @@ nsFTPDirListingConv::DigestBufferLines(char *aBuffer, nsCAutoString &aString) { } aString.Append(' '); - aString.Append(LF); // complete this line + aString.Append(char(nsCRT::LF)); // complete this line // END 201: NS_DELETEXPCOM(thisEntry); diff --git a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp b/netwerk/streamconv/converters/nsGopherDirListingConv.cpp index b8d7f76c479e..47de68ed07c1 100644 --- a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsGopherDirListingConv.cpp @@ -79,7 +79,7 @@ nsGopherDirListingConv::Convert(nsIInputStream *aFromStream, convertedData.Append("300: "); convertedData.Append(spec); - convertedData.Append(LF); + convertedData.Append(char(nsCRT::LF)); // END 300: //Column headings @@ -197,7 +197,7 @@ nsGopherDirListingConv::OnDataAvailable(nsIRequest *request, indexFormat.Append("300: "); indexFormat.Append(spec.get()); - indexFormat.Append(LF); + indexFormat.Append(char(nsCRT::LF)); // END 300: // build up the column heading; 200: @@ -278,9 +278,9 @@ nsGopherDirListingConv::DigestBufferLines(char* aBuffer, nsCAutoString& aString) PRBool cr = PR_FALSE; // while we have new lines, parse 'em into application/http-index-format. - while (line && (eol = PL_strchr(line, LF)) ) { + while (line && (eol = PL_strchr(line, nsCRT::LF)) ) { // yank any carriage returns too. - if (eol > line && *(eol-1) == CR) { + if (eol > line && *(eol-1) == nsCRT::CR) { eol--; *eol = '\0'; cr = PR_TRUE; @@ -393,7 +393,7 @@ nsGopherDirListingConv::DigestBufferLines(char* aBuffer, nsCAutoString& aString) aString.Append("DIRECTORY"); else aString.Append("FILE"); - aString.Append(LF); + aString.Append(char(nsCRT::LF)); } } else { NS_WARNING("Error parsing gopher directory response.\n"); diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index 523d35c4823b..1d1f623badd0 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -218,7 +218,7 @@ nsMultiMixedConv::OnDataAvailable(nsIRequest *request, nsISupports *context, // if we don't have a channel already, then we don't even // have enough info to start a part, go ahead and buffer // enough to collect a boundary token. - if (!mPartChannel || !(cursor[bufLen-1] == LF) ) + if (!mPartChannel || !(cursor[bufLen-1] == nsCRT::LF) ) bufAmt = PR_MIN(mTokenLen - 1, bufLen); } @@ -443,8 +443,8 @@ nsMultiMixedConv::SendData(char *aBuffer, PRUint32 aLen) { PRInt8 nsMultiMixedConv::PushOverLine(char *&aPtr, PRUint32 &aLen) { PRInt8 chars = 0; - if (*aPtr == CR || *aPtr == LF) { - if (aPtr[1] == LF) + if (*aPtr == nsCRT::CR || *aPtr == nsCRT::LF) { + if (aPtr[1] == nsCRT::LF) chars++; chars++; } @@ -464,9 +464,9 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr, PRUint8 lineFeedIncrement = 1; while ( (cursorLen > 0) - && (newLine = PL_strchr(cursor, LF)) ) { + && (newLine = PL_strchr(cursor, nsCRT::LF)) ) { // adjust for linefeeds - if ( (newLine > cursor) && (newLine[-1] == CR) ) { // CRLF + if ( (newLine > cursor) && (newLine[-1] == nsCRT::CR) ) { // CRLF lineFeedIncrement = 2; newLine--; } diff --git a/parser/htmlparser/src/nsExpatTokenizer.cpp b/parser/htmlparser/src/nsExpatTokenizer.cpp index d92220132d26..f360db5997ef 100644 --- a/parser/htmlparser/src/nsExpatTokenizer.cpp +++ b/parser/htmlparser/src/nsExpatTokenizer.cpp @@ -588,7 +588,7 @@ void Tokenizer_HandleCharacterData(void *userData, const XML_Char *s, int len) { switch(((PRUnichar*)s)[0]){ case kNewLine: - case CR: + case nsCRT::CR: newToken = state->tokenAllocator->CreateTokenOfType(eToken_newline,eHTMLTag_unknown); break; case kSpace: diff --git a/profile/pref-migrator/src/nsPrefMigration.cpp b/profile/pref-migrator/src/nsPrefMigration.cpp index 16204cad8c3c..8d7df2d98c7b 100644 --- a/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/profile/pref-migrator/src/nsPrefMigration.cpp @@ -1694,8 +1694,8 @@ Fix4xCookies(nsIFileSpec * profilePath) { while (GetCookieLine(inStream,inBuffer) != -1){ /* skip line if it is a comment or null line */ - if (inBuffer.CharAt(0) == '#' || inBuffer.CharAt(0) == CR || - inBuffer.CharAt(0) == LF || inBuffer.CharAt(0) == 0) { + if (inBuffer.CharAt(0) == '#' || inBuffer.CharAt(0) == nsCRT::CR || + inBuffer.CharAt(0) == nsCRT::LF || inBuffer.CharAt(0) == 0) { PutCookieLine(outStream, inBuffer); continue; } diff --git a/xpcom/ds/nsCRT.h b/xpcom/ds/nsCRT.h index 5d8bec4ba151..6dd1dddc5c3b 100644 --- a/xpcom/ds/nsCRT.h +++ b/xpcom/ds/nsCRT.h @@ -29,16 +29,6 @@ #include "prtypes.h" #include "nsCppSharedAllocator.h" -#define CR '\015' // \r -#define LF '\012' // \n -#define VTAB '\013' -#define FF '\014' -#define TAB '\011' - -#define CRSTR "\015" -#define LFSTR "\012" -#define CRLF "\015\012" /* A CR LF equivalent string */ - #ifdef XP_MAC # define NS_LINEBREAK "\015" # define NS_LINEBREAK_LEN 1 @@ -54,10 +44,8 @@ # endif /* XP_PC */ #endif /* XP_MAC */ - extern const PRUnichar kIsoLatin1ToUCS2[256]; - // This macro can be used in a class declaration for classes that want // to ensure that their instance memory is zeroed. #define NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW \ @@ -97,6 +85,13 @@ extern const PRUnichar kIsoLatin1ToUCS2[256]; class NS_COM nsCRT { public: + enum { + TAB='\t' /* Horizontal Tab */, + LF='\n' /* Line Feed */, + VTAB='\v' /* Vertical Tab */, + FF='\f' /* Form Feed */, + CR='\r' /* Carriage Return */ + }; /** Copy bytes from aSrc to aDest. @param aDest the destination address @@ -274,6 +269,11 @@ public: static PRBool IsAsciiSpace(PRUnichar aChar); }; +#define FF '\014' +#define TAB '\011' + +#define CRSTR "\015" +#define LFSTR "\012" +#define CRLF "\015\012" /* A CR LF equivalent string */ + #endif /* nsCRT_h___ */ - - diff --git a/xpcom/io/nsLinebreakConverter.cpp b/xpcom/io/nsLinebreakConverter.cpp index c89612164928..14242c9ba1ba 100644 --- a/xpcom/io/nsLinebreakConverter.cpp +++ b/xpcom/io/nsLinebreakConverter.cpp @@ -235,9 +235,9 @@ static T* ConvertUnknownBreaks(const T* inSrc, PRInt32& ioLen, const char* destB while (src < srcEnd) { - if (*src == CR) + if (*src == nsCRT::CR) { - if (src < srcEnd && src[1] == LF) + if (src < srcEnd && src[1] == nsCRT::LF) { // CRLF finalLen += destBreakLen; @@ -249,7 +249,7 @@ static T* ConvertUnknownBreaks(const T* inSrc, PRInt32& ioLen, const char* destB finalLen += destBreakLen; } } - else if (*src == LF) + else if (*src == nsCRT::LF) { // Lone LF finalLen += destBreakLen; @@ -271,9 +271,9 @@ static T* ConvertUnknownBreaks(const T* inSrc, PRInt32& ioLen, const char* destB while (src < srcEnd) { - if (*src == CR) + if (*src == nsCRT::CR) { - if (src < srcEnd && src[1] == LF) + if (src < srcEnd && src[1] == nsCRT::LF) { // CRLF AppendLinebreak(dst, destBreak); @@ -285,7 +285,7 @@ static T* ConvertUnknownBreaks(const T* inSrc, PRInt32& ioLen, const char* destB AppendLinebreak(dst, destBreak); } } - else if (*src == LF) + else if (*src == nsCRT::LF) { // Lone LF AppendLinebreak(dst, destBreak);