fix for #104498, optimize ParseReferences() / SetReferences().

rs=bienvenu
This commit is contained in:
sspitzer%netscape.com 2001-10-12 23:23:11 +00:00
Родитель 3f52ea1c36
Коммит aa66b41aa7
2 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -72,7 +72,7 @@ protected:
nsresult BuildRecipientsFromArray(const char *names, const char *addresses, PRUint32 numAddresses, nsCAutoString& allRecipients);
// reference and threading stuff.
nsresult ParseReferences(nsCString &references);
nsresult ParseReferences(const char *references);
const char* GetNextReference(const char *startNextRef, nsCString &reference);
const char* GetPrevReference(const char *prevRef, nsCString &reference);

Просмотреть файл

@ -307,9 +307,9 @@ NS_IMETHODIMP nsMsgHdr::GetNumReferences(PRUint16 *result)
return NS_OK;
}
nsresult nsMsgHdr::ParseReferences(nsCString &references)
nsresult nsMsgHdr::ParseReferences(const char *references)
{
const char *startNextRef = references.get();
const char *startNextRef = references;
nsCAutoString resultReference;
while (startNextRef && *startNextRef)
@ -331,7 +331,7 @@ NS_IMETHODIMP nsMsgHdr::GetStringReference(PRInt32 refNum, nsCString &resultRefe
if(NS_SUCCEEDED(err))
{
ParseReferences(references);
ParseReferences(references.get());
m_initedValues |= REFERENCES_INITED;
}
}
@ -366,15 +366,18 @@ NS_IMETHODIMP nsMsgHdr::SetAuthor(const char *author)
NS_IMETHODIMP nsMsgHdr::SetReferences(const char *references)
{
nsCAutoString CStrReference(references);
ParseReferences(CStrReference);
m_numReferences = m_references.Count();
SetUInt32Column(m_numReferences, m_mdb->m_numReferencesColumnToken);
m_initedValues |= REFERENCES_INITED;
return SetStringColumn(references, m_mdb->m_referencesColumnToken);
if (*references == '\0') {
m_numReferences = 0;
}
else {
ParseReferences(references);
m_numReferences = m_references.Count();
}
SetUInt32Column(m_numReferences, m_mdb->m_numReferencesColumnToken);
m_initedValues |= REFERENCES_INITED;
return SetStringColumn(references, m_mdb->m_referencesColumnToken);
}
NS_IMETHODIMP nsMsgHdr::SetRecipients(const char *recipients)