Follow-up for bug 707305 - Fix linking and enable building components for external linkages. r=Neil.
This commit is contained in:
Родитель
ca5a1feed9
Коммит
c2026c0cf0
|
@ -1172,7 +1172,7 @@ nsMsgIncomingServer::InternalSetHostName(const nsACString& aHostname, const char
|
|||
{
|
||||
nsCString hostname;
|
||||
hostname = aHostname;
|
||||
if (hostname.CountChar(':') == 1)
|
||||
if (MsgCountChar(hostname, ':') == 1)
|
||||
{
|
||||
PRInt32 colonPos = hostname.FindChar(':');
|
||||
nsCAutoString portString(Substring(hostname, colonPos));
|
||||
|
@ -1234,13 +1234,11 @@ nsMsgIncomingServer::OnUserOrHostNameChanged(const nsACString& oldName,
|
|||
}
|
||||
|
||||
// switch corresponding part of the account name to the new name...
|
||||
nsString acctPart;
|
||||
if (!hostnameChanged && (atPos != kNotFound))
|
||||
{
|
||||
// ...if username changed and the previous username was equal to the part
|
||||
// of the account name before @
|
||||
acctName.Left(acctPart, atPos);
|
||||
if (acctPart.Equals(NS_ConvertASCIItoUTF16(userName)))
|
||||
if (StringHead(acctName, atPos).Equals(NS_ConvertASCIItoUTF16(userName)))
|
||||
acctName.Replace(0, userName.Length(), NS_ConvertASCIItoUTF16(newName));
|
||||
}
|
||||
if (hostnameChanged)
|
||||
|
@ -1251,8 +1249,7 @@ nsMsgIncomingServer::OnUserOrHostNameChanged(const nsACString& oldName,
|
|||
atPos = 0;
|
||||
else
|
||||
atPos += 1;
|
||||
acctName.Right(acctPart, acctName.Length() - atPos);
|
||||
if (acctPart.Equals(NS_ConvertASCIItoUTF16(hostName))) {
|
||||
if (Substring(acctName, atPos).Equals(NS_ConvertASCIItoUTF16(hostName))) {
|
||||
acctName.Replace(atPos, acctName.Length() - atPos,
|
||||
NS_ConvertASCIItoUTF16(newName));
|
||||
}
|
||||
|
@ -1288,7 +1285,7 @@ nsMsgIncomingServer::GetHostName(nsACString& aResult)
|
|||
{
|
||||
nsresult rv;
|
||||
rv = GetCharValue("hostname", aResult);
|
||||
if (aResult.CountChar(':') == 1)
|
||||
if (MsgCountChar(aResult, ':') == 1)
|
||||
{
|
||||
// gack, we need to reformat the hostname - SetHostName will do that
|
||||
SetHostName(aResult);
|
||||
|
@ -1308,7 +1305,7 @@ nsMsgIncomingServer::GetRealHostName(nsACString& aResult)
|
|||
if (aResult.IsEmpty())
|
||||
return GetHostName(aResult);
|
||||
|
||||
if (aResult.CountChar(':') == 1)
|
||||
if (MsgCountChar(aResult, ':') == 1)
|
||||
{
|
||||
SetRealHostName(aResult);
|
||||
rv = GetCharValue("realhostname", aResult);
|
||||
|
|
|
@ -331,6 +331,8 @@ NS_MSG_BASE nsresult ConvertBufToPlainText(nsString &aConBuf, bool formatFlowed,
|
|||
(aString).ReplaceChar(aNeedle, aReplacement)
|
||||
#define MsgFind(str, what, ignore_case, offset) \
|
||||
(str).Find(what, ignore_case, offset)
|
||||
#define MsgCountChar(aString, aChar) \
|
||||
(aString).CountChar(aChar)
|
||||
|
||||
#else
|
||||
|
||||
|
@ -478,6 +480,22 @@ do_QueryElementAt( nsISupportsArray* array, PRUint32 aIndex, nsresult* aErrorPtr
|
|||
{
|
||||
return MsgQueryElementAt(array, aIndex, aErrorPtr);
|
||||
}
|
||||
/**
|
||||
* Count occurences of specified character in string.
|
||||
*
|
||||
*/
|
||||
inline
|
||||
PRUint32 MsgCountChar(nsACString &aString, PRUnichar aChar) {
|
||||
const char *begin, *end;
|
||||
PRUint32 num_chars = 0;
|
||||
aString.BeginReading(&begin, &end);
|
||||
for (const char *current = begin; current < end; ++current) {
|
||||
if (*current == aChar)
|
||||
++num_chars;
|
||||
}
|
||||
return num_chars;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -77,6 +77,7 @@ EXTRA_DSO_LDOPTS = \
|
|||
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
|
||||
$(call EXPAND_LIBNAME_PATH,rdfutil_external_s,$(LIBXUL_DIST)/lib) \
|
||||
$(NSPR_LIBS) \
|
||||
$(XPCOM_LIBS) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ EXTRA_DSO_LDOPTS += \
|
|||
$(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib) \
|
||||
$(MOZDEPTH)/rdf/util/src/$(LIB_PREFIX)rdfutil_external_s.$(LIB_SUFFIX) \
|
||||
$(NSPR_LIBS) \
|
||||
$(XPCOM_LIBS) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsIInputStream.h"
|
||||
#include "nsILineInputStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#include "TextDebugLog.h"
|
||||
#include "plstr.h"
|
||||
|
@ -141,16 +142,7 @@ nsresult nsTextAddress::ReadRecord(nsILineInputStream *aLineStream, nsCString &a
|
|||
aLine.AppendLiteral(MSG_LINEBREAK);
|
||||
aLine.Append(line);
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
numQuotes += line.CountChar('"');
|
||||
#else
|
||||
const char *begin, *end;
|
||||
line.BeginReading(&begin, &end);
|
||||
for (const char *current = begin; current < end; ++current) {
|
||||
if (*current == '"')
|
||||
++numQuotes;
|
||||
}
|
||||
#endif
|
||||
numQuotes += MsgCountChar(line, '"');
|
||||
}
|
||||
}
|
||||
// Continue whilst everything is ok, and we have an odd number of quotes.
|
||||
|
|
Загрузка…
Ссылка в новой задаче