Bug #379070 --> remove NS_LINEBREAK and NS_LINEBREAK_LEN in mailnews because that won't be available to us using frozen linkage.

sr=bienvenu


git-svn-id: svn://10.0.0.236/trunk@227494 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scott%scott-macgregor.org 2007-06-04 22:37:56 +00:00
parent b70e41b287
commit b27334d4c8
13 changed files with 54 additions and 89 deletions

View File

@ -1517,7 +1517,7 @@ nsresult nsDogbertProfileMigrator::DoSpecialUpdates(nsILocalFile * profilePath)
* security hole.
*/
PRUint32 bytesWritten;
nsCAutoString headerLine(PREF_FILE_HEADER_STRING NS_LINEBREAK);
nsCAutoString headerLine(PREF_FILE_HEADER_STRING MSG_LINEBREAK);
fsStream->Write(headerLine.get(), headerLine.Length(), &bytesWritten) ;
fsStream->Close();

View File

@ -560,9 +560,9 @@ nsAddressBook::ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const
}
}
}
rv = outputStream->Write(NS_LINEBREAK, NS_LINEBREAK_LEN, &writeCount);
rv = outputStream->Write(MSG_LINEBREAK, MSG_LINEBREAK_LEN, &writeCount);
NS_ENSURE_SUCCESS(rv,rv);
if (NS_LINEBREAK_LEN != writeCount)
if (MSG_LINEBREAK_LEN != writeCount)
return NS_ERROR_FAILURE;
rv = aDirectory->GetChildCards(getter_AddRefs(cardsEnumerator));
@ -651,9 +651,9 @@ nsAddressBook::ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const
}
// write out the linebreak that separates the cards
rv = outputStream->Write(NS_LINEBREAK, NS_LINEBREAK_LEN, &writeCount);
rv = outputStream->Write(MSG_LINEBREAK, MSG_LINEBREAK_LEN, &writeCount);
NS_ENSURE_SUCCESS(rv,rv);
if (NS_LINEBREAK_LEN != writeCount)
if (MSG_LINEBREAK_LEN != writeCount)
return NS_ERROR_FAILURE;
}
}
@ -767,7 +767,7 @@ nsAddressBook::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *a
rv = AppendProperty(ldapAttribute.get(), value.get(), valueCStr);
NS_ENSURE_SUCCESS(rv,rv);
valueCStr += NS_LINEBREAK;
valueCStr += MSG_LINEBREAK;
}
else
valueCStr.Truncate();
@ -788,9 +788,9 @@ nsAddressBook::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *a
}
// write out the linebreak that separates the cards
rv = outputStream->Write(NS_LINEBREAK, NS_LINEBREAK_LEN, &writeCount);
rv = outputStream->Write(MSG_LINEBREAK, MSG_LINEBREAK_LEN, &writeCount);
NS_ENSURE_SUCCESS(rv,rv);
if (NS_LINEBREAK_LEN != writeCount)
if (MSG_LINEBREAK_LEN != writeCount)
return NS_ERROR_FAILURE;
}
}
@ -813,9 +813,9 @@ nsresult nsAddressBook::AppendLDIFForMailList(nsIAbCard *aCard, nsIAbLDAPAttribu
rv = AppendDNForCard("dn", aCard, aAttrMap, aResult);
NS_ENSURE_SUCCESS(rv,rv);
aResult += NS_LINEBREAK \
"objectclass: top" NS_LINEBREAK \
"objectclass: groupOfNames" NS_LINEBREAK;
aResult += MSG_LINEBREAK \
"objectclass: top" MSG_LINEBREAK \
"objectclass: groupOfNames" MSG_LINEBREAK;
rv = aCard->GetCardValue(kDisplayNameColumn, attrValue);
NS_ENSURE_SUCCESS(rv,rv);
@ -828,7 +828,7 @@ nsresult nsAddressBook::AppendLDIFForMailList(nsIAbCard *aCard, nsIAbLDAPAttribu
rv = AppendProperty(ldapAttributeName.get(), attrValue.get(), aResult);
NS_ENSURE_SUCCESS(rv,rv);
aResult += NS_LINEBREAK;
aResult += MSG_LINEBREAK;
rv = aAttrMap->GetFirstAttribute(NS_LITERAL_CSTRING(kNicknameColumn),
ldapAttributeName);
@ -840,7 +840,7 @@ nsresult nsAddressBook::AppendLDIFForMailList(nsIAbCard *aCard, nsIAbLDAPAttribu
if (!attrValue.IsEmpty()) {
rv = AppendProperty(ldapAttributeName.get(), attrValue.get(), aResult);
NS_ENSURE_SUCCESS(rv,rv);
aResult += NS_LINEBREAK;
aResult += MSG_LINEBREAK;
}
rv = aAttrMap->GetFirstAttribute(NS_LITERAL_CSTRING(kNotesColumn),
@ -853,7 +853,7 @@ nsresult nsAddressBook::AppendLDIFForMailList(nsIAbCard *aCard, nsIAbLDAPAttribu
if (!attrValue.IsEmpty()) {
rv = AppendProperty(ldapAttributeName.get(), attrValue.get(), aResult);
NS_ENSURE_SUCCESS(rv,rv);
aResult += NS_LINEBREAK;
aResult += MSG_LINEBREAK;
}
nsCOMPtr<nsIRDFService> rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
@ -884,12 +884,12 @@ nsresult nsAddressBook::AppendLDIFForMailList(nsIAbCard *aCard, nsIAbLDAPAttribu
rv = AppendDNForCard("member", listCard, aAttrMap, aResult);
NS_ENSURE_SUCCESS(rv,rv);
aResult += NS_LINEBREAK;
aResult += MSG_LINEBREAK;
}
}
}
aResult += NS_LINEBREAK;
aResult += MSG_LINEBREAK;
return NS_OK;
}
@ -937,14 +937,12 @@ nsresult nsAddressBook::AppendBasicLDIFForCard(nsIAbCard *aCard, nsIAbLDAPAttrib
{
nsresult rv = AppendDNForCard("dn", aCard, aAttrMap, aResult);
NS_ENSURE_SUCCESS(rv,rv);
aResult += NS_LINEBREAK \
"objectclass: top" NS_LINEBREAK \
"objectclass: person" NS_LINEBREAK \
"objectclass: organizationalPerson" NS_LINEBREAK \
"objectclass: inetOrgPerson" NS_LINEBREAK \
"objectclass: " MOZ_AB_OBJECTCLASS NS_LINEBREAK;
aResult += MSG_LINEBREAK \
"objectclass: top" MSG_LINEBREAK \
"objectclass: person" MSG_LINEBREAK \
"objectclass: organizationalPerson" MSG_LINEBREAK \
"objectclass: inetOrgPerson" MSG_LINEBREAK \
"objectclass: " MOZ_AB_OBJECTCLASS MSG_LINEBREAK;
return rv;
}

View File

@ -42,9 +42,7 @@
#define msgCore_h__
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsVoidArray.h"
class nsIMsgDBHdr;
@ -101,7 +99,6 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
#define IS_DIGIT(i) NS_IS_DIGIT(i)
#define IS_ALPHA(VAL) NS_IS_ALPHA(VAL)
/* for retrieving information out of messenger nsresults */
#define NS_IS_MSG_ERROR(err) \
@ -177,8 +174,13 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
#define NS_ERROR_NNTP_NO_CROSS_POSTING NS_MSG_GENERATE_FAILURE(12554)
#define NS_MSGCOMP_ERROR_END 12999
#define MSG_LINEBREAK NS_LINEBREAK
#define MSG_LINEBREAK_LEN NS_LINEBREAK_LEN
#if defined(XP_WIN) || defined(XP_OS2)
#define MSG_LINEBREAK "\015\012"
#define MSG_LINEBREAK_LEN 2
#else
#define MSG_LINEBREAK "\012"
#define MSG_LINEBREAK_LEN 1
#endif
#ifdef MOZ_STATIC_MAIL_BUILD
#define NS_MSG_BASE

View File

@ -292,7 +292,7 @@ NS_IMETHODIMP nsMsgFolderCache::GetCacheElement(const nsACString& pathKey, PRBoo
NS_ENSURE_ARG_POINTER(result);
NS_ENSURE_TRUE(m_cacheElements && !pathKey.IsEmpty(), NS_ERROR_FAILURE);
nsCStringKey hashKey(nsCString(pathKey).get());
nsCStringKey hashKey(pathKey);
*result = (nsIMsgFolderCacheElement *) m_cacheElements->Get(&hashKey);
// nsHashTable already does an address on *result
@ -322,7 +322,7 @@ NS_IMETHODIMP nsMsgFolderCache::GetCacheElement(const nsACString& pathKey, PRBoo
NS_IMETHODIMP nsMsgFolderCache::RemoveElement(const nsACString& key)
{
nsCStringKey hashKey(nsCString(key).get());
nsCStringKey hashKey(key);
nsCOMPtr <nsISupports> supports = getter_AddRefs(m_cacheElements->Get(&hashKey));
if (!supports)
return NS_ERROR_FAILURE;

View File

@ -131,14 +131,14 @@ nsHashKey *nsMsgGroupView::AllocHashKeyForHdr(nsIMsgDBHdr *msgHdr)
{
case nsMsgViewSortType::bySubject:
(void) msgHdr->GetSubject(getter_Copies(cStringKey));
return new nsCStringKey(cStringKey.get());
return new nsCStringKey(cStringKey);
break;
case nsMsgViewSortType::byAuthor:
rv = nsMsgDBView::FetchAuthor(msgHdr, stringKey);
return NS_SUCCEEDED(rv) ? new nsStringKey(stringKey.get()) : nsnull;
case nsMsgViewSortType::byRecipient:
(void) msgHdr->GetRecipients(getter_Copies(cStringKey));
return new nsCStringKey(cStringKey.get());
return new nsCStringKey(cStringKey);
case nsMsgViewSortType::byAccount:
case nsMsgViewSortType::byTags:
{

View File

@ -333,11 +333,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetCharset(nsACString& aCharset)
nsCOMPtr<nsIMsgDatabase> db;
nsresult rv = GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(db));
if(NS_SUCCEEDED(rv))
{
nsCString tmpStr;
rv = folderInfo->GetCharPtrCharacterSet(getter_Copies(tmpStr));
aCharset.Assign(tmpStr);
}
rv = folderInfo->GetCharPtrCharacterSet(getter_Copies(aCharset));
return rv;
}
@ -1747,11 +1743,7 @@ nsMsgDBFolder::GetStringProperty(const char *propertyName, nsACString& propertyV
return NS_MSG_ERROR_FOLDER_MISSING;
rv = GetDBFolderInfoAndDB(getter_AddRefs(folderInfo), getter_AddRefs(db));
if (NS_SUCCEEDED(rv))
{
nsCString tmpStr;
rv = folderInfo->GetCharPtrProperty(propertyName, getter_Copies(tmpStr));
propertyValue.Assign(tmpStr);
}
rv = folderInfo->GetCharPtrProperty(propertyName, getter_Copies(propertyValue));
}
}
return rv;
@ -2260,10 +2252,7 @@ nsMsgDBFolder::Clear(void)
NS_IMETHODIMP
nsMsgDBFolder::GetURI(nsACString& name)
{
nsCString tmpStr;
nsresult rv = nsRDFResource::GetValue(getter_Copies(tmpStr));
name = tmpStr;
return rv;
return nsRDFResource::GetValue(getter_Copies(name));
}
////////////////////////////////////////////////////////////////////////////////
@ -4514,11 +4503,7 @@ nsMsgDBFolder::GetStringFromBundle(const char *msgName, nsString& aResult)
nsCOMPtr <nsIStringBundle> bundle;
rv = GetBaseStringBundle(getter_AddRefs(bundle));
if (NS_SUCCEEDED(rv) && bundle)
{
nsString tmpStr;
rv = bundle->GetStringFromName(NS_ConvertASCIItoUTF16(msgName).get(), getter_Copies(tmpStr));
aResult = tmpStr;
}
rv = bundle->GetStringFromName(NS_ConvertASCIItoUTF16(msgName).get(), getter_Copies(aResult));
return rv;
}
@ -4553,10 +4538,8 @@ nsMsgDBFolder::GetStringWithFolderNameFromBundle(const char * msgName, nsAString
folderName.get(),
kLocalizedBrandShortName
};
nsString tmpStr;
rv = bundle->FormatStringFromName(NS_ConvertASCIItoUTF16(msgName).get(),
formatStrings, 2, getter_Copies(tmpStr));
aResult = tmpStr;
formatStrings, 2, getter_Copies(aResult));
}
return rv;
}

View File

@ -1867,13 +1867,13 @@ nsMsgComposeAndSend::EnsureLineBreaks(const char *body, PRUint32 bodyLen)
// for example, we don't want <a hrLINEBREAKref=""> or <bLINEBREAKr>
// or "MississLINEBREAKippi"
for (i = 0; i < bodyLen-1; i++) {
if (nsCRT::strncmp(body+i, NS_LINEBREAK, NS_LINEBREAK_LEN)) {
if (strncmp(body+i, MSG_LINEBREAK, MSG_LINEBREAK_LEN)) {
charsSinceLineBreak++;
if (charsSinceLineBreak == LINE_BREAK_MAX) {
if (!newBody) {
// in the worse case, the body will be solid, no linebreaks.
// that will require us to insert a line break every LINE_BREAK_MAX bytes
PRUint32 worstCaseLen = bodyLen+((bodyLen/LINE_BREAK_MAX)*NS_LINEBREAK_LEN)+1;
PRUint32 worstCaseLen = bodyLen+((bodyLen/LINE_BREAK_MAX)*MSG_LINEBREAK_LEN)+1;
newBody = (char *) PR_Calloc(1, worstCaseLen);
if (!newBody) return NS_ERROR_OUT_OF_MEMORY;
newBodyPos = newBody;
@ -1881,8 +1881,8 @@ nsMsgComposeAndSend::EnsureLineBreaks(const char *body, PRUint32 bodyLen)
PL_strncpy(newBodyPos, body+lastPos, i - lastPos + 1);
newBodyPos += i - lastPos + 1;
PL_strncpy(newBodyPos, NS_LINEBREAK, NS_LINEBREAK_LEN);
newBodyPos += NS_LINEBREAK_LEN;
PL_strncpy(newBodyPos, MSG_LINEBREAK, MSG_LINEBREAK_LEN);
newBodyPos += MSG_LINEBREAK_LEN;
lastPos = i+1;
charsSinceLineBreak = 0;

View File

@ -2070,13 +2070,9 @@ NS_IMETHODIMP nsImapIncomingServer::GetImapStringByID(PRInt32 aMsgId, nsAString
GetStringBundle();
if (m_stringBundle)
{
nsString tmpStr;
res = m_stringBundle->GetStringFromID(aMsgId, getter_Copies(tmpStr));
res = m_stringBundle->GetStringFromID(aMsgId, getter_Copies(aString));
if (NS_SUCCEEDED(res))
{
aString = tmpStr;
return res;
}
}
aString.AssignLiteral("String ID ");
// mscott: FIX ME
@ -2098,13 +2094,9 @@ NS_IMETHODIMP nsImapIncomingServer::FormatStringWithHostNameByID(PRInt32 aMsgId
{
NS_ConvertASCIItoUTF16 hostStr (hostName);
const PRUnichar *params[] = { hostStr.get() };
nsString tmpStr;
res = m_stringBundle->FormatStringFromID(aMsgId, params, 1, getter_Copies(tmpStr));
res = m_stringBundle->FormatStringFromID(aMsgId, params, 1, getter_Copies(aString));
if (NS_SUCCEEDED(res))
{
aString = tmpStr;
return res;
}
}
}
aString.AssignLiteral("String ID ");

View File

@ -5447,7 +5447,7 @@ const char *nsMsgIMAPFolderACL::GetRightsStringForUser(const nsACString& inUserN
server->GetRealUsername(userName);
}
ToLowerCase(userName);
nsCStringKey userKey(userName.get());
nsCStringKey userKey(userName);
return (const char *)m_rightsHash->Get(&userKey);
}
@ -5599,12 +5599,7 @@ nsresult nsMsgIMAPFolderACL::CreateACLRightsString(nsAString& aRightsString)
NS_ENSURE_SUCCESS(rv, rv);
if (GetDoIHaveFullRightsForFolder())
{
nsString tmpStr;
rv = bundle->GetStringFromID(IMAP_ACL_FULL_RIGHTS, getter_Copies(tmpStr));
aRightsString = tmpStr;
return rv;
}
return bundle->GetStringFromID(IMAP_ACL_FULL_RIGHTS, getter_Copies(aRightsString));
else
{
if (GetCanIReadFolder())

View File

@ -67,7 +67,7 @@
#include "nsTextFormatter.h"
#include "nsIProxyObjectManager.h"
#include "nsProxiedService.h"
#include "msgCore.h"
#include "ImportDebug.h"
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -871,7 +871,7 @@ void nsImportGenericAddressBooks::ReportError(const PRUnichar *pName,
pStream->Append( pText);
nsTextFormatter::smprintf_free( pText);
nsCRT::free(pFmt);
pStream->Append(NS_ConvertASCIItoUTF16(NS_LINEBREAK));
pStream->AppendLiteral(MSG_LINEBREAK);
}
PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)

View File

@ -641,7 +641,7 @@ void nsImportGenericMail::ReportError(PRInt32 id, const PRUnichar *pName, nsStri
pStream->Append( pText);
nsTextFormatter::smprintf_free( pText);
nsCRT::free(pFmt);
pStream->Append(NS_ConvertASCIItoUTF16(NS_LINEBREAK));
pStream->Append(NS_ConvertASCIItoUTF16(MSG_LINEBREAK));
}

View File

@ -47,7 +47,7 @@
#include "TextDebugLog.h"
#include "plstr.h"
#include "nsCRT.h"
#include "msgCore.h"
#define kWhitespace " \t\b\r\n"
@ -165,7 +165,7 @@ nsresult nsTextAddress::ReadRecord(nsILineInputStream *aLineStream, nsCString &a
rv = aLineStream->ReadLine(line, &more);
if (NS_SUCCEEDED(rv)) {
if (!aLine.IsEmpty())
aLine.AppendLiteral(NS_LINEBREAK);
aLine.AppendLiteral(MSG_LINEBREAK);
aLine.Append(line);
numQuotes += line.CountChar('"');

View File

@ -1386,7 +1386,6 @@ nsMsgNewsFolder::GetRawName(nsACString & aRawName)
NS_ENSURE_SUCCESS(rv,rv);
// convert to the server-side encoding
nsCAutoString tmpStr;
nsCOMPtr <nsINntpIncomingServer> nntpServer;
rv = GetNntpServer(getter_AddRefs(nntpServer));
NS_ENSURE_SUCCESS(rv,rv);
@ -1394,11 +1393,10 @@ nsMsgNewsFolder::GetRawName(nsACString & aRawName)
nsCAutoString dataCharset;
rv = nntpServer->GetCharset(dataCharset);
NS_ENSURE_SUCCESS(rv,rv);
rv = nsMsgI18NConvertFromUnicode(dataCharset.get(), name, tmpStr);
rv = nsMsgI18NConvertFromUnicode(dataCharset.get(), name, mRawName);
if (NS_FAILED(rv))
LossyCopyUTF16toASCII(name,tmpStr);
mRawName = tmpStr;
LossyCopyUTF16toASCII(name, mRawName);
}
aRawName = mRawName;
return NS_OK;
@ -1591,10 +1589,7 @@ NS_IMETHODIMP nsMsgNewsFolder::GetMessageIdForKey(nsMsgKey key, nsACString& resu
nsCOMPtr <nsIMsgDBHdr> hdr;
rv = mDatabase->GetMsgHdrForKey(key, getter_AddRefs(hdr));
NS_ENSURE_SUCCESS(rv,rv);
nsCString tmpStr;
rv = hdr->GetMessageId(getter_Copies(tmpStr));
result = tmpStr;
return rv;
return hdr->GetMessageId(getter_Copies(result));
}
NS_IMETHODIMP nsMsgNewsFolder::SetSortOrder(PRInt32 order)