bug 100649: Length() being used where IsEmpty() is meant

treewide changes to convert incorrect usages of string.Length() to string.IsEmpty().

thanks to afatecha@idea.com.py (Ariel Fatecha) for the patch. r=dwitte, sr=jst.

got the ok from Asa to land into a closed tree.
This commit is contained in:
dwitte%stanford.edu 2003-05-23 21:34:47 +00:00
Родитель 5ee35526e9
Коммит 270d3909ca
129 изменённых файлов: 462 добавлений и 469 удалений

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

@ -301,13 +301,13 @@ nsBasePrincipal::GetPreferences(char** aPrefName, char** aID,
capList->granted = &grantedListStr;
capList->denied = &deniedListStr;
mCapabilities->Enumerate(AppendCapability, (void*)capList);
if (grantedListStr.Length() > 0)
if (!grantedListStr.IsEmpty())
{
grantedListStr.Truncate(grantedListStr.Length()-1);
*aGrantedList = ToNewCString(grantedListStr);
if (!*aGrantedList) return NS_ERROR_OUT_OF_MEMORY;
}
if (deniedListStr.Length() > 0)
if (!deniedListStr.IsEmpty())
{
deniedListStr.Truncate(deniedListStr.Length()-1);
*aDeniedList = ToNewCString(deniedListStr);

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

@ -484,7 +484,7 @@ SplitURL(nsIURI *aChromeURI, nsCString& aPackage, nsCString& aProvider, nsCStrin
aProvider.Right(aFile, aProvider.Length() - (idx + 1));
aProvider.Truncate(idx);
PRBool nofile = (aFile.Length() == 0);
PRBool nofile = aFile.IsEmpty();
if (nofile) {
// If there is no file, then construct the default file
aFile = aPackage;

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

@ -705,7 +705,7 @@ DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsString& oCharse
}
break;
} // switch
return oCharset.Length() > 0;
return !oCharset.IsEmpty();
}

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

@ -91,7 +91,7 @@ nsLDAPURL::GetSpec(nsACString &_retval)
spec = ((mOptions & OPT_SECURE) ? kLDAPSSLScheme : kLDAPScheme);
spec.Append("://");
if (mHost.Length() > 0) {
if (!mHost.IsEmpty()) {
spec.Append(mHost);
}
if (mPort > 0) {
@ -99,7 +99,7 @@ nsLDAPURL::GetSpec(nsACString &_retval)
spec.AppendInt(mPort);
}
spec.Append('/');
if (mDN.Length() > 0) {
if (!mDN.IsEmpty()) {
spec.Append(mDN);
}
@ -115,7 +115,7 @@ nsLDAPURL::GetSpec(nsACString &_retval)
}
}
if ((mScope) || mFilter.Length()) {
if (mScope || !mFilter.IsEmpty()) {
spec.Append((count ? "?" : "??"));
if (mScope) {
if (mScope == SCOPE_ONELEVEL) {
@ -124,7 +124,7 @@ nsLDAPURL::GetSpec(nsACString &_retval)
spec.Append("sub");
}
}
if (mFilter.Length()) {
if (!mFilter.IsEmpty()) {
spec.Append('?');
spec.Append(mFilter);
}

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

@ -314,7 +314,7 @@ PRBool nsDefaultURIFixup::MakeAlternateURI(nsIURI *aURI)
// Security - URLs with user / password info should NOT be fixed up
nsCAutoString userpass;
aURI->GetUserPass(userpass);
if (userpass.Length() > 0) {
if (!userpass.IsEmpty()) {
return PR_FALSE;
}
@ -364,12 +364,12 @@ PRBool nsDefaultURIFixup::MakeAlternateURI(nsIURI *aURI)
}
else if (numDots == 1)
{
if (prefix.Length() > 0 &&
if (!prefix.IsEmpty() &&
oldHost.EqualsIgnoreCase(prefix.get(), prefix.Length())) {
newHost.Assign(oldHost);
newHost.Append(suffix);
}
else if (suffix.Length() > 0) {
else if (!suffix.IsEmpty()) {
newHost.Assign(prefix);
newHost.Append(oldHost);
}

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

@ -192,7 +192,7 @@ nsresult SetDocTitleTxn::SetDomTitle(const nsAString& aTitle)
// Append a text node under the TITLE
// only if the title text isn't empty
if (titleNode && aTitle.Length() > 0)
if (titleNode && !aTitle.IsEmpty())
{
nsCOMPtr<nsIDOMText> textNode;
res = domDoc->CreateTextNode(aTitle, getter_AddRefs(textNode));

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

@ -1069,8 +1069,8 @@ nsHTMLCSSUtils::HasClassOrID(nsIDOMElement * aElement, PRBool & aReturn)
// we need to make sure that if the element has an id or a class attribute,
// the attribute is not the empty string
aReturn = ((isClassSet && (0 != classVal.Length())) ||
(isIdSet && (0 != idVal.Length())));
aReturn = ((isClassSet && !classVal.IsEmpty()) ||
(isIdSet && !idVal.IsEmpty()));
return NS_OK;
}

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

@ -2073,7 +2073,7 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText,
NS_NAMED_LITERAL_STRING(citestr, "cite");
newElement->SetAttribute(NS_LITERAL_STRING("type"), citestr);
if (aCitation.Length() > 0)
if (!aCitation.IsEmpty())
newElement->SetAttribute(citestr, aCitation);
// Set the selection inside the blockquote so aQuotedText will go there:

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

@ -296,7 +296,7 @@ nsHTMLEditUtils::IsLink(nsIDOMNode *aNode)
if (anchor)
{
nsAutoString tmpText;
if (NS_SUCCEEDED(anchor->GetHref(tmpText)) && tmpText.get() && tmpText.Length() != 0)
if (NS_SUCCEEDED(anchor->GetHref(tmpText)) && !tmpText.IsEmpty())
return PR_TRUE;
}
return PR_FALSE;
@ -310,7 +310,7 @@ nsHTMLEditUtils::IsNamedAnchor(nsIDOMNode *aNode)
if (anchor)
{
nsAutoString tmpText;
if (NS_SUCCEEDED(anchor->GetName(tmpText)) && tmpText.get() && tmpText.Length() != 0)
if (NS_SUCCEEDED(anchor->GetName(tmpText)) && !tmpText.IsEmpty())
return PR_TRUE;
}
return PR_FALSE;

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

@ -2602,7 +2602,7 @@ nsHTMLEditor::GetHTMLBackgroundColorState(PRBool *aMixed, nsAString &aOutColor)
if (NS_FAILED(res)) return res;
// Done if we have a color explicitly set
if (aOutColor.Length() > 0)
if (!aOutColor.IsEmpty())
return NS_OK;
// Once we hit the body, we're done
@ -2995,7 +2995,7 @@ nsHTMLEditor::Align(const nsAString& aAlignType)
NS_IMETHODIMP
nsHTMLEditor::GetElementOrParentByTagName(const nsAString& aTagName, nsIDOMNode *aNode, nsIDOMElement** aReturn)
{
if (aTagName.Length() == 0 || !aReturn )
if (aTagName.IsEmpty() || !aReturn )
return NS_ERROR_NULL_POINTER;
nsresult res = NS_OK;
@ -3525,7 +3525,7 @@ nsHTMLEditor::SetHTMLBackgroundColor(const nsAString& aColor)
getter_AddRefs(element));
if (NS_FAILED(res)) return res;
PRBool setColor = (aColor.Length() > 0);
PRBool setColor = !aColor.IsEmpty();
NS_NAMED_LITERAL_STRING(bgcolor, "bgcolor");
if (element)
@ -4608,7 +4608,7 @@ void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
{
element->GetAttribute(*aAttribute, value);
if (outValue) *outValue = value;
if (value.Length())
if (!value.IsEmpty())
{
if (!aValue) {
found = PR_TRUE;

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

@ -1144,10 +1144,10 @@ NS_IMETHODIMP nsHTMLEditor::GetInlineProperty(nsIAtom *aProperty,
if (!aProperty || !aFirst || !aAny || !aAll)
return NS_ERROR_NULL_POINTER;
const nsAString *att = nsnull;
if (aAttribute.Length())
if (!aAttribute.IsEmpty())
att = &aAttribute;
const nsAString *val = nsnull;
if (aValue.Length())
if (!aValue.IsEmpty())
val = &aValue;
return GetInlinePropertyBase( aProperty, att, val, aFirst, aAny, aAll, nsnull);
}
@ -1164,10 +1164,10 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
if (!aProperty || !aFirst || !aAny || !aAll)
return NS_ERROR_NULL_POINTER;
const nsAString *att = nsnull;
if (aAttribute.Length())
if (!aAttribute.IsEmpty())
att = &aAttribute;
const nsAString *val = nsnull;
if (aValue.Length())
if (!aValue.IsEmpty())
val = &aValue;
return GetInlinePropertyBase( aProperty, att, val, aFirst, aAny, aAll, &outValue);
}
@ -1863,7 +1863,7 @@ nsHTMLEditor::HasStyleOrIdOrClass(nsIDOMElement * aElement, PRBool *aHasStyleOrI
*aHasStyleOrIdOrClass = PR_TRUE;
nsresult res = GetAttributeValue(aElement, NS_LITERAL_STRING("style"), styleVal, &isStyleSet);
if (NS_FAILED(res)) return res;
if (!isStyleSet || (0 == styleVal.Length())) {
if (!isStyleSet || styleVal.IsEmpty()) {
res = mHTMLCSSUtils->HasClassOrID(aElement, *aHasStyleOrIdOrClass);
if (NS_FAILED(res)) return res;
}

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

@ -273,7 +273,7 @@ nsInternetCiter::Rewrap(const nsAString& aInString,
// Special case: if this is a blank line, maintain a blank line
// (retain the original paragraph breaks)
if (tString[posInString] == nl && aOutString.Length() > 0)
if (tString[posInString] == nl && !aOutString.IsEmpty())
{
if (aOutString.Last() != nl)
aOutString.Append(nl);

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

@ -319,7 +319,7 @@ nsPlaintextEditor::SetDocumentCharacterSet(const nsAString & characterSet)
return NS_ERROR_FAILURE;
// Set attributes to the created element
if (resultNode && characterSet.Length() > 0) {
if (resultNode && !characterSet.IsEmpty()) {
metaElement = do_QueryInterface(resultNode);
if (metaElement) {
// not undoable, undo should undo CreateNode
@ -1266,7 +1266,7 @@ nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn)
// If we have other style left, trim off any existing semicolons
// or whitespace, then add a known semicolon-space:
if (styleValue.Length() > 0)
if (!styleValue.IsEmpty())
{
styleValue.Trim("; \t", PR_FALSE, PR_TRUE);
styleValue.Append(NS_LITERAL_STRING("; "));
@ -1451,7 +1451,7 @@ nsPlaintextEditor::GetAndInitDocEncoder(const nsAString& aFormatType,
rv = docEncoder->Init(doc, aFormatType, aFlags);
NS_ENSURE_SUCCESS(rv, rv);
if (aCharset.Length() != 0
if (!aCharset.IsEmpty()
&& !(aCharset.Equals(NS_LITERAL_STRING("null"))))
docEncoder->SetCharset(aCharset);

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

@ -324,7 +324,7 @@ void CMozillaBrowser::ShowURIPropertyDlg(const nsAString &aURI, const nsAString
CPPageDlg linkDlg;
dlg.AddPage(&linkDlg);
if (aURI.Length() > 0)
if (!aURI.IsEmpty())
{
linkDlg.mType = aContentType;
linkDlg.mURL = aURI;
@ -844,7 +844,7 @@ LRESULT CMozillaBrowser::OnLinkOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
anchorElement->GetHref(uri);
}
if (uri.Length() > 0)
if (!uri.IsEmpty())
{
CComBSTR bstrURI(uri.get());
CComVariant vFlags(0);
@ -865,7 +865,7 @@ LRESULT CMozillaBrowser::OnLinkOpenInNewWindow(WORD wNotifyCode, WORD wID, HWND
anchorElement->GetHref(uri);
}
if (uri.Length() > 0)
if (!uri.IsEmpty())
{
CComBSTR bstrURI(uri.get());
CComVariant vFlags(navOpenInNewWindow);
@ -886,7 +886,7 @@ LRESULT CMozillaBrowser::OnLinkCopyShortcut(WORD wNotifyCode, WORD wID, HWND hWn
anchorElement->GetHref(uri);
}
if (uri.Length() > 0 && OpenClipboard())
if (!uri.IsEmpty() && OpenClipboard())
{
EmptyClipboard();

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

@ -1327,7 +1327,7 @@ nsWebBrowserPersist::GetDocEncoderContentType(nsIDOMDocument *aDocument, const P
if (nsDoc)
{
nsAutoString type;
if (NS_SUCCEEDED(nsDoc->GetContentType(type)) && type.Length() > 0)
if (NS_SUCCEEDED(nsDoc->GetContentType(type)) && !type.IsEmpty())
{
contentType.Assign(type);
}
@ -1344,7 +1344,7 @@ nsWebBrowserPersist::GetDocEncoderContentType(nsIDOMDocument *aDocument, const P
// text/html
// text/plain
if (contentType.Length() > 0 &&
if (!contentType.IsEmpty() &&
!contentType.Equals(defaultContentType, nsCaseInsensitiveStringComparator()))
{
// Check if there is an encoder for the desired content type
@ -1542,7 +1542,7 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal(
// Get the content type to save with
nsXPIDLString realContentType;
GetDocEncoderContentType(aDocument,
(mContentType.Length() > 0) ? mContentType.get() : nsnull,
!mContentType.IsEmpty() ? mContentType.get() : nsnull,
getter_Copies(realContentType));
nsCAutoString contentType; contentType.AssignWithConversion(realContentType);
@ -1599,7 +1599,7 @@ nsresult nsWebBrowserPersist::SaveDocuments()
// Get the content type
nsXPIDLString realContentType;
GetDocEncoderContentType(docData->mDocument,
(mContentType.Length() > 0) ? mContentType.get() : nsnull,
!mContentType.IsEmpty() ? mContentType.get() : nsnull,
getter_Copies(realContentType));
nsCAutoString contentType; contentType.AssignWithConversion(realContentType.get());
@ -1903,7 +1903,7 @@ nsWebBrowserPersist::CalculateAndAppendFileExt(nsIURI *aURI, nsIChannel *aChanne
aChannel->GetContentType(contentType);
// Get the content type from the MIME service
if (contentType.Length() == 0)
if (contentType.IsEmpty())
{
nsCOMPtr<nsIURI> uri;
aChannel->GetOriginalURI(getter_AddRefs(uri));
@ -1914,7 +1914,7 @@ nsWebBrowserPersist::CalculateAndAppendFileExt(nsIURI *aURI, nsIChannel *aChanne
}
// Append the extension onto the file
if (contentType.Length())
if (!contentType.IsEmpty())
{
nsCOMPtr<nsIMIMEInfo> mimeInfo;
mMIMEService->GetFromMIMEType(
@ -3206,7 +3206,7 @@ nsWebBrowserPersist::SaveDocumentWithFixup(
encoder->SetWrapColumn(mWrapColumn);
nsAutoString charsetStr(aSaveCharset);
if (charsetStr.Length() == 0)
if (charsetStr.IsEmpty())
{
rv = aDocument->GetDocumentCharacterSet(charsetStr);
if(NS_FAILED(rv))

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

@ -1403,7 +1403,7 @@ nsWindowWatcher::FindItemWithName(
*aFoundItem = 0;
/* special cases */
if(name.Length() == 0)
if(name.IsEmpty())
return NS_OK;
if(name.EqualsIgnoreCase("_blank") || name.EqualsIgnoreCase("_new"))
return NS_OK;

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

@ -107,7 +107,7 @@ SplitURL(nsIURI *aChromeURI, nsCString& aPackage, nsCString& aProvider, nsCStrin
aProvider.Right(aFile, aProvider.Length() - (idx + 1));
aProvider.Truncate(idx);
PRBool nofile = (aFile.Length() == 0);
PRBool nofile = aFile.IsEmpty();
if (nofile) {
// If there is no file, then construct the default file
aFile = aPackage;

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

@ -657,7 +657,7 @@ mozSqlResult::ClearRows()
nsresult
mozSqlResult::EnsureTableName()
{
if (mTableName.Length() > 0)
if (!mTableName.IsEmpty())
return NS_OK;
nsAString::const_iterator start, end;

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

@ -55,7 +55,7 @@ mozSqlConnectionPgsql::GetPrimaryKeys(const nsAString& aSchema, const nsAString&
select = NS_LITERAL_STRING("SELECT n.nspname AS TABLE_SCHEM, ");
from = NS_LITERAL_STRING(" FROM pg_catalog.pg_namespace n, pg_catalog.pg_class ct, pg_catalog.pg_class ci, pg_catalog.pg_attribute a, pg_catalog.pg_index i");
where = NS_LITERAL_STRING(" AND ct.relnamespace = n.oid ");
if (aSchema.Length() > 0) {
if (!aSchema.IsEmpty()) {
where.Append(NS_LITERAL_STRING(" AND n.nspname = '") + aSchema);
where.Append(PRUnichar('\''));
}
@ -65,7 +65,7 @@ mozSqlConnectionPgsql::GetPrimaryKeys(const nsAString& aSchema, const nsAString&
from = NS_LITERAL_STRING(" FROM pg_class ct, pg_class ci, pg_attribute a, pg_index i ");
}
if (aTable.Length() > 0) {
if (!aTable.IsEmpty()) {
where.Append(NS_LITERAL_STRING(" AND ct.relname = '") + aTable);
where.Append(PRUnichar('\''));
}

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

@ -82,7 +82,7 @@ NS_IMETHODIMP nsBasicStreamGenerator::GetLevel(float *aLevel) {
NS_IMETHODIMP nsBasicStreamGenerator::GetByte(PRUint32 offset, PRUint8 *retval) {
NS_ENSURE_ARG_POINTER(retval);
nsresult rv = NS_OK;
if (mPassword.Length() == 0) {
if (mPassword.IsEmpty()) {
/* this is the first time, so we need to get the password */
nsCOMPtr<nsIPasswordSink> weakPasswordSink = do_QueryReferent(mWeakPasswordSink);
if (!weakPasswordSink) {

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

@ -1612,7 +1612,7 @@ si_PutData(const char *passwordRealm, nsVoidArray *signonData, PRBool save) {
PRInt32 count = signonData->Count();
for (PRInt32 i=0; i<count; i++) {
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(i));
if (data2->isPassword && data2->value.Length()==0) {
if (data2->isPassword && data2->value.IsEmpty()) {
return;
}
}
@ -2339,8 +2339,8 @@ si_RememberSignonData
data0 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(pswd[0]));
data1 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(pswd[1]));
data2 = NS_STATIC_CAST(si_SignonDataStruct*, signonData->ElementAt(pswd[2]));
if (data0->value.Length() == 0 || data1->value.Length() == 0 ||
data2->value.Length() == 0 || data1->value != data2->value) {
if (data0->value.IsEmpty() || data1->value.IsEmpty() ||
data2->value.IsEmpty() || data1->value != data2->value) {
return;
}
@ -2450,7 +2450,7 @@ si_RestoreSignonData(nsIPrompt* dialog,
LOG((" got [name=%s value=%s]\n",
NS_LossyConvertUCS2toASCII(data->name).get(),
NS_LossyConvertUCS2toASCII(data->value).get()));
if(correctedName.Length() && (data->name == correctedName)) {
if(!correctedName.IsEmpty() && (data->name == correctedName)) {
nameFound = PR_TRUE;
}
}
@ -2473,7 +2473,7 @@ si_RestoreSignonData(nsIPrompt* dialog,
if (user) {
data = NS_STATIC_CAST(si_SignonDataStruct *,
user->signonData_list.ElementAt(0)); /* 1st item on form */
if(data->isPassword && correctedName.Length() && (data->name == correctedName)) {
if(data->isPassword && !correctedName.IsEmpty() && (data->name == correctedName)) {
/* current item is first item on form and is a password */
user = (passwordRealm, MK_SIGNON_PASSWORDS_FETCH);
if (user) {
@ -2505,7 +2505,7 @@ si_RestoreSignonData(nsIPrompt* dialog,
LOG((" got [name=%s value=%s]\n",
NS_LossyConvertUCS2toASCII(data->name).get(),
NS_LossyConvertUCS2toASCII(data->value).get()));
if(correctedName.Length() && (data->name == correctedName)) {
if(!correctedName.IsEmpty() && (data->name == correctedName)) {
nsAutoString password;
if (NS_SUCCEEDED(si_Decrypt(data->value, password))) {
*value = ToNewUnicode(password);
@ -2581,7 +2581,7 @@ si_RestoreOldSignonDataFromBrowser
/* get the data from previous time this URL was visited */
si_lock_signon_list();
if (username.Length() != 0) {
if (!username.IsEmpty()) {
user = si_GetSpecificUser(passwordRealm, username, NS_ConvertASCIItoUCS2(USERNAMEFIELD));
} else {
si_LastFormForWhichUserHasBeenSelected = -1;
@ -2776,17 +2776,17 @@ SINGSIGN_PromptPassword
}
/* get previous password used with this username, pick first user if no username found */
si_RestoreOldSignonDataFromBrowser(dialog, passwordRealm, (username.Length() == 0), username, password);
si_RestoreOldSignonDataFromBrowser(dialog, passwordRealm, username.IsEmpty(), username, password);
*pwd = ToNewUnicode(password);
/* return if a password was found */
if (password.Length() != 0) {
*pwd = ToNewUnicode(password);
if (!password.IsEmpty()) {
*pressedOK = PR_TRUE;
return NS_OK;
}
/* no password found, get new password from user */
*pwd = ToNewUnicode(password);
PRBool checked = PR_FALSE;
res = si_CheckGetPassword(pwd, dialogTitle, text, dialog, savePassword, &checked);
if (NS_FAILED(res)) {
@ -2832,7 +2832,7 @@ SINGSIGN_Prompt
si_RestoreOldSignonDataFromBrowser(dialog, passwordRealm, PR_TRUE, emptyUsername, data);
/* return if data was found */
if (data.Length() != 0) {
if (!data.IsEmpty()) {
*resultText = ToNewUnicode(data);
*pressedOK = PR_TRUE;
return NS_OK;
@ -2968,9 +2968,9 @@ SINGSIGN_HaveData(nsIPrompt* dialog, const char *passwordRealm, const PRUnichar
}
/* get previous data used with this username, pick first user if no username found */
si_RestoreOldSignonDataFromBrowser(dialog, passwordRealm, (usernameForLookup.Length() == 0), usernameForLookup, data);
si_RestoreOldSignonDataFromBrowser(dialog, passwordRealm, usernameForLookup.IsEmpty(), usernameForLookup, data);
if (data.Length()) {
if (!data.IsEmpty()) {
*retval = PR_TRUE;
}

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

@ -2330,14 +2330,14 @@ wallet_GetSchemaFromDisplayableText
text = temp;
/* done if we've obtained enough text from which to determine the schema */
if (text.Length()) {
if (!text.IsEmpty()) {
someTextFound = PR_TRUE;
TextToSchema(text, schema);
if (!schema.IsEmpty()) {
/* schema found, process positional schema if any */
if (!schema.IsEmpty() && schema.First() == '%') {
if (schema.First() == '%') {
wallet_ResolvePositionalSchema(elementNode, schema);
}
@ -2892,7 +2892,7 @@ PRIVATE PRBool
wallet_Capture(nsIDocument* doc, const nsString& field, const nsString& value, nsACString& schema)
{
/* do nothing if there is no value */
if (!value.Length()) {
if (value.IsEmpty()) {
return PR_FALSE;
}
@ -3673,7 +3673,7 @@ wallet_CaptureInputElement(nsIDOMNode* elementNode, nsIDocument* doc) {
}
if (schema.IsEmpty()) {
/* get schema from displayable text if possible */
wallet_GetSchemaFromDisplayableText(inputElement, schema, (value.Length()==0));
wallet_GetSchemaFromDisplayableText(inputElement, schema, value.IsEmpty());
}
if (wallet_Capture(doc, field, value, schema)) {
captured = PR_TRUE;
@ -4034,7 +4034,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
if (NS_SUCCEEDED(rv)) {
data = new si_SignonDataStruct;
data->value = value;
if (field.Length() && field.CharAt(0) == '\\') {
if (!field.IsEmpty() && field.CharAt(0) == '\\') {
/*
* Note that data saved for browser-generated logins (e.g. http
* authentication) use artificial field names starting with
@ -4084,7 +4084,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
for (PRInt32 i=0; i<count; i++) {
mapElementPtr = NS_STATIC_CAST
(wallet_MapElement*, wallet_DistinguishedSchema_list->ElementAt(i));
if (schema.Equals(mapElementPtr->item1, nsCaseInsensitiveCStringComparator()) && value.Length() > 0) {
if (schema.Equals(mapElementPtr->item1, nsCaseInsensitiveCStringComparator()) && !value.IsEmpty()) {
hits++;
if (hits > 1 && newValueFound) {
OKToPrompt = PR_TRUE;

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

@ -1101,7 +1101,7 @@ nsSchemaLoader::GetNewOrUsedType(nsSchema* aSchema,
// namespace associated with the prefix
rv = ParseQualifiedName(aContext, aTypeName, prefix,
localName, namespaceURI);
if ((prefix.Length() > 0) && NS_FAILED(rv)) {
if (!prefix.IsEmpty() && NS_FAILED(rv)) {
// Unknown prefix
return NS_ERROR_SCHEMA_UNKNOWN_PREFIX;
}
@ -1148,7 +1148,7 @@ nsSchemaLoader::ProcessElement(nsSchema* aSchema,
// See if it's a reference or an actual element declaration
nsAutoString ref;
aElement->GetAttribute(NS_LITERAL_STRING("ref"), ref);
if (ref.Length() > 0) {
if (!ref.IsEmpty()) {
nsSchemaElementRef* elementRef;
elementRef = new nsSchemaElementRef(aSchema, ref);
@ -1672,7 +1672,7 @@ nsSchemaLoader::ProcessSimpleContent(nsSchema* aSchema,
if ((tagName == nsSchemaAtoms::sRestriction_atom) ||
(tagName == nsSchemaAtoms::sExtension_atom)) {
childElement->GetAttribute(NS_LITERAL_STRING("base"), baseStr);
if (baseStr.Length() == 0) {
if (baseStr.IsEmpty()) {
return NS_ERROR_SCHEMA_MISSING_TYPE;
}
@ -1931,7 +1931,7 @@ nsSchemaLoader::ProcessComplexContent(nsSchema* aSchema,
if ((tagName == nsSchemaAtoms::sRestriction_atom) ||
(tagName == nsSchemaAtoms::sExtension_atom)) {
childElement->GetAttribute(NS_LITERAL_STRING("base"), baseStr);
if (baseStr.Length() == 0) {
if (baseStr.IsEmpty()) {
return NS_ERROR_SCHEMA_MISSING_TYPE;
}
@ -2118,7 +2118,7 @@ nsSchemaLoader::ProcessSimpleTypeRestriction(nsSchema* aSchema,
nsCOMPtr<nsISchemaType> baseType;
nsAutoString baseStr;
aElement->GetAttribute(NS_LITERAL_STRING("base"), baseStr);
if (baseStr.Length() > 0) {
if (!baseStr.IsEmpty()) {
rv = GetNewOrUsedType(aSchema, aElement, baseStr,
getter_AddRefs(baseType));
if (NS_FAILED(rv)) {
@ -2211,7 +2211,7 @@ nsSchemaLoader::ProcessSimpleTypeList(nsSchema* aSchema,
aElement->GetAttribute(NS_LITERAL_STRING("itemType"), itemTypeStr);
nsCOMPtr<nsISchemaSimpleType> itemType;
if (itemTypeStr.Length() > 0) {
if (!itemTypeStr.IsEmpty()) {
nsCOMPtr<nsISchemaType> type;
rv = GetNewOrUsedType(aSchema, aElement, itemTypeStr,
getter_AddRefs(type));
@ -2273,7 +2273,7 @@ nsSchemaLoader::ProcessSimpleTypeUnion(nsSchema* aSchema,
nsCOMPtr<nsISchemaSimpleType> memberType;
nsAutoString memberTypes;
aElement->GetAttribute(NS_LITERAL_STRING("memberTypes"), memberTypes);
if (memberTypes.Length() > 0) {
if (!memberTypes.IsEmpty()) {
nsReadingIterator<PRUnichar> begin, end, tokenEnd;
memberTypes.BeginReading(tokenEnd);
@ -2356,7 +2356,7 @@ nsSchemaLoader::ProcessModelGroup(nsSchema* aSchema,
aElement->GetAttribute(NS_LITERAL_STRING("ref"), ref);
if ((aTagName == nsSchemaAtoms::sModelGroup_atom) &&
(ref.Length() > 0)) {
!ref.IsEmpty()) {
nsSchemaModelGroupRef* modelGroupRef = new nsSchemaModelGroupRef(aSchema,
ref);
if (!modelGroupRef) {
@ -2583,7 +2583,7 @@ nsSchemaLoader::ProcessAttribute(nsSchema* aSchema,
nsAutoString ref;
aElement->GetAttribute(NS_LITERAL_STRING("ref"), ref);
if (ref.Length() > 0) {
if (!ref.IsEmpty()) {
nsSchemaAttributeRef* attributeRef = new nsSchemaAttributeRef(aSchema,
ref);
if (!attributeRef) {
@ -2633,7 +2633,7 @@ nsSchemaLoader::ProcessAttribute(nsSchema* aSchema,
nsAutoString typeStr;
aElement->GetAttribute(NS_LITERAL_STRING("type"), typeStr);
if (typeStr.Length() > 0) {
if (!typeStr.IsEmpty()) {
nsCOMPtr<nsISchemaType> schemaType;
rv = GetNewOrUsedType(aSchema, aElement, typeStr,
getter_AddRefs(schemaType));
@ -2669,7 +2669,7 @@ nsSchemaLoader::ProcessAttributeGroup(nsSchema* aSchema,
nsAutoString ref;
aElement->GetAttribute(NS_LITERAL_STRING("ref"), ref);
if (ref.Length() > 0) {
if (!ref.IsEmpty()) {
nsSchemaAttributeGroupRef* attrRef = new nsSchemaAttributeGroupRef(aSchema,
ref);
if (!attrRef) {
@ -2782,7 +2782,7 @@ nsSchemaLoader::ProcessFacet(nsSchema* aSchema,
nsAutoString valueStr;
aElement->GetAttribute(NS_LITERAL_STRING("value"), valueStr);
if (valueStr.Length() == 0) {
if (valueStr.IsEmpty()) {
return NS_ERROR_SCHEMA_FACET_VALUE_ERROR;
}
@ -2879,14 +2879,14 @@ nsSchemaLoader::GetMinAndMax(nsIDOMElement* aElement,
aElement->GetAttribute(NS_LITERAL_STRING("maxOccurs"), maxStr);
PRInt32 rv;
if (minStr.Length() > 0) {
if (!minStr.IsEmpty()) {
PRInt32 minVal = minStr.ToInteger(&rv);
if (NS_SUCCEEDED(rv) && (minVal >= 0)) {
*aMinOccurs = (PRUint32)minVal;
}
}
if (maxStr.Length() > 0) {
if (!maxStr.IsEmpty()) {
if (maxStr.Equals(NS_LITERAL_STRING("unbounded"))) {
*aMaxOccurs = nsISchemaParticle::OCCURRENCE_UNBOUNDED;
}

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

@ -130,7 +130,7 @@ NS_IMETHODIMP nsSOAPCall::Invoke(nsISOAPResponse ** _retval)
nsresult rv;
nsCOMPtr < nsISOAPTransport > transport;
if (mTransportURI.Length() == 0) {
if (mTransportURI.IsEmpty()) {
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
}
@ -172,7 +172,7 @@ NS_IMETHODIMP
nsresult rv;
nsCOMPtr < nsISOAPTransport > transport;
if (mTransportURI.Length() == 0) {
if (mTransportURI.IsEmpty()) {
return SOAP_EXCEPTION(NS_ERROR_NOT_INITIALIZED,"SOAP_TRANSPORT_URI", "No transport URI was specified.");
}

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

@ -102,7 +102,7 @@ NS_IMETHODIMP nsSOAPHeaderBlock::GetMustUnderstand(PRBool *
nsSOAPUtils::kMustUnderstandAttribute, m);
if (NS_FAILED(rc))
return rc;
if (m.Length() == 0)
if (m.IsEmpty())
*aMustUnderstand = PR_FALSE;
else if (m.Equals(nsSOAPUtils::kTrue)
|| m.Equals(nsSOAPUtils::kTrueA))

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

@ -544,7 +544,7 @@ NS_IMETHODIMP mozLineTerm::Write(const PRUnichar *buf,
nsAutoString timeStamp;
result = mozXMLTermUtils::TimeStamp(60, mLastTime, timeStamp);
if (NS_SUCCEEDED(result) && (timeStamp.Length() > 0)) {
if (NS_SUCCEEDED(result) && !timeStamp.IsEmpty()) {
char* temStr = ToNewCString(timeStamp);
PR_LogPrint("<TS %s>\n", temStr);
nsMemory::Free(temStr);

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

@ -390,7 +390,7 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
XMLT_LOG(mozXMLTermKeyListener::KeyPress,53,
("escPrefix=%d, keyChar=0x%x, \n", escPrefix, keyChar));
if (JSCommand.Length() > 0) {
if (!JSCommand.IsEmpty()) {
// Execute JS command
nsCOMPtr<nsIDOMDocument> domDocument;
result = mXMLTerminal->GetDocument(getter_AddRefs(domDocument));

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

@ -986,7 +986,7 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
nsAutoString lsCommand;
lsCommand.SetLength(0);
if (commandArgs.Length() > 0) {
if (!commandArgs.IsEmpty()) {
lsCommand.Append(NS_LITERAL_STRING("cd "));
lsCommand.Append(commandArgs);
lsCommand.Append(NS_LITERAL_STRING(";"));
@ -1192,7 +1192,7 @@ NS_IMETHODIMP mozXMLTermSession::ExportHTML(const PRUnichar* aFilename,
nsAutoString filename( aFilename );
if (filename.Length() == 0) {
if (filename.IsEmpty()) {
// Write to STDERR
char* htmlCString = ToNewCString(htmlString);
fprintf(stderr, "mozXMLTermSession::ExportHTML:\n%s\n\n", htmlCString);
@ -1365,7 +1365,7 @@ NS_IMETHODIMP mozXMLTermSession::DisplayInput(const nsString& aString,
// Without this workaround, the cursor is positioned too close to the prompt
// (i.e., too far to the left, ignoring the prompt whitespace)
if ((cursorCol > 0) || (mPromptHTML.Length() > 0)) {
if ((cursorCol > 0) || !mPromptHTML.IsEmpty()) {
// Collapse selection to new cursor location
result = selection->Collapse(mInputTextNode, cursorCol);
@ -1655,7 +1655,7 @@ NS_IMETHODIMP mozXMLTermSession::BreakOutput(PRBool positionCursorBelow)
mFragmentBuffer.SetLength(0);
if (jsOutput.Length() > 0) {
if (!jsOutput.IsEmpty()) {
// Display JS output as HTML fragment
result = InsertFragment(jsOutput, mOutputBlockNode,
mCurrentEntryNumber);
@ -1871,7 +1871,7 @@ NS_IMETHODIMP mozXMLTermSession::LimitOutputLines(PRBool deleteAllOld)
attValue.SetLength(0);
result = mozXMLTermUtils::GetNodeAttribute(nextChild, "class", attValue);
if (NS_FAILED(result)|| (attValue.Length() == 0)) {
if (NS_FAILED(result)|| attValue.IsEmpty())) {
deleteNode = 1;
} else {
@ -2699,7 +2699,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepSanitizeFragment(
attValue.SetLength(0);
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
if (NS_SUCCEEDED(result) && !attValue.IsEmpty()) {
// Save allowed event attribute value for re-insertion
eventAttrVals[j] = attValue;
}
@ -2762,7 +2762,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepSanitizeFragment(
attValue.SetLength(0);
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
if (NS_SUCCEEDED(result) && !attValue.IsEmpty()) {
// Modify attribute value
SubstituteCommandNumber(attValue, entryNumber);
domElement->SetAttribute(attName, attValue);
@ -2775,7 +2775,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepSanitizeFragment(
attName.AppendWithConversion(sessionEventNames[j]);
attValue = eventAttrVals[j];
if (attValue.Length() > 0) {
if (!attValue.IsEmpty()) {
SubstituteCommandNumber(attValue, entryNumber);
// Sanitize attribute value
@ -2836,7 +2836,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepRefreshEventHandlers(
attValue.SetLength(0);
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
if (NS_SUCCEEDED(result) && !attValue.IsEmpty()) {
// Refresh attribute value
domElement->SetAttribute(attName, attValue);
}
@ -2904,7 +2904,7 @@ NS_IMETHODIMP mozXMLTermSession::FlushOutput(FlushActionType flushAction)
// Clear incomplete PRE text
mPreTextIncomplete.SetLength(0);
if ((mPreTextBufferLines == 0) && (mPreTextBuffered.Length() == 0)) {
if ((mPreTextBufferLines == 0) && mPreTextBuffered.IsEmpty()) {
// Remove lone text node
nsCOMPtr<nsIDOMNode> resultNode;
result = mOutputDisplayNode->RemoveChild(mOutputTextNode,
@ -2956,7 +2956,7 @@ NS_IMETHODIMP mozXMLTermSession::FlushOutput(FlushActionType flushAction)
mOutputTextNode = nsnull;
if ( (flushAction == SPLIT_INCOMPLETE_FLUSH) &&
(preTextSplit.Length() > 0) ) {
!preTextSplit.IsEmpty() ) {
// Create new PRE element with incomplete text
nsAutoString styleStr; styleStr.SetLength(0);
@ -3334,7 +3334,7 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
nsCOMPtr<nsIDOMNode> resultNode;
if (mPromptHTML.Length() == 0) {
if (mPromptHTML.IsEmpty()) {
#define DEFAULT_ICON_PROMPT
#ifdef DEFAULT_ICON_PROMPT // Experimental code; has scrolling problems
@ -3971,7 +3971,7 @@ NS_IMETHODIMP mozXMLTermSession::NewAnchor(const nsString& classAttribute,
nsAutoString hrefVal(NS_LITERAL_STRING("#"));
newElement->SetAttribute(hrefAtt, hrefVal);
if (classAttribute.Length() > 0) {
if (!classAttribute.IsEmpty()) {
nsAutoString classStr(NS_LITERAL_STRING("class"));
newElement->SetAttribute(classStr, classAttribute);
@ -4028,7 +4028,7 @@ NS_IMETHODIMP mozXMLTermSession::NewElement(const nsString& tagName,
if (NS_FAILED(result) || !newElement)
return NS_ERROR_FAILURE;
if (name.Length() > 0) {
if (!name.IsEmpty()) {
// Set attributes
nsAutoString classAtt(NS_LITERAL_STRING("class"));
nsAutoString classVal(name);
@ -4164,19 +4164,19 @@ NS_IMETHODIMP mozXMLTermSession::NewIFrame(nsIDOMNode* parentNode,
attValue.AppendInt(frameBorder,10);
newElement->SetAttribute(attName, attValue);
if (src.Length() > 0) {
if (!src.IsEmpty()) {
// Set SRC attribute
attName.Assign(NS_LITERAL_STRING("src"));
newElement->SetAttribute(attName, src);
}
if (width.Length() > 0) {
if (!width.IsEmpty()) {
// Set WIDTH attribute
attName.Assign(NS_LITERAL_STRING("width"));
newElement->SetAttribute(attName, width);
}
if (height.Length() > 0) {
if (!height.IsEmpty()) {
// Set HEIGHT attribute
attName.Assign(NS_LITERAL_STRING("height"));
newElement->SetAttribute(attName, height);
@ -4379,7 +4379,7 @@ NS_IMETHODIMP mozXMLTermSession::ToHTMLString(nsIDOMNode* aNode,
}
result = attr->GetValue(attrValue);
if (NS_SUCCEEDED(result) && (attrName.Length() > 0)) {
if (NS_SUCCEEDED(result) && !attrName.IsEmpty()) {
htmlString.Append(NS_LITERAL_STRING("=\""));
htmlString.Append(attrValue);
htmlString.Append(NS_LITERAL_STRING("\""));
@ -4412,7 +4412,7 @@ NS_IMETHODIMP mozXMLTermSession::ToHTMLString(nsIDOMNode* aNode,
break;
}
if (htmlInner.Length() > 0) {
if (!htmlInner.IsEmpty()) {
if (insidePRENode)
htmlString.Append(NS_LITERAL_STRING("\n>"));
else
@ -4587,7 +4587,7 @@ void mozXMLTermSession::TraverseDOMTree(FILE* fileStream,
attValue.SetLength(0);
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
if (NS_SUCCEEDED(result) && !attValue.IsEmpty()) {
// Print attribute value
char* tagCString2 = ToNewCString(attValue);
fprintf(fileStream, " %s=%s", printAttributeNames[j], tagCString2);

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

@ -373,8 +373,8 @@ NS_IMETHODIMP nsDeviceContextMac :: GetSystemFont(nsSystemFontID aID, nsFont *aF
::TECDisposeConverter(converter);
}
}
NS_ASSERTION(aFont->name.Length() > 0, "empty font name");
if (aFont->name.Length() == 0)
NS_ASSERTION(!aFont->name.IsEmpty(), "empty font name");
if (aFont->name.IsEmpty())
{
aFont->name.AssignWithConversion( (char*)&fontName[1], fontName[0] );
}

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

@ -526,7 +526,7 @@ nsresult DeviceContextImpl::AliasFont(const nsString& aFont,
result = NS_ERROR_OUT_OF_MEMORY;
}
}
else if ((0 < aAltAlias.Length()) && NS_SUCCEEDED(CheckFontExistence(aAltAlias))) {
else if (!aAltAlias.IsEmpty() && NS_SUCCEEDED(CheckFontExistence(aAltAlias))) {
nsString* entry = new nsString(aAltAlias);
if (nsnull != entry) {
FontAliasKey key(aFont);

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

@ -178,12 +178,12 @@ PRBool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const
if (PR_FALSE == quoted) {
familyStr.CompressWhitespace(PR_FALSE, PR_TRUE);
if (0 < familyStr.Length()) {
if (!familyStr.IsEmpty()) {
generic = IsGenericFontFamily(familyStr);
}
}
if (0 < familyStr.Length()) {
if (!familyStr.IsEmpty()) {
running = (*aFunc)(familyStr, generic, aData);
}

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

@ -231,7 +231,7 @@ NS_IMETHODIMP nsPrinterListEnumerator::GetNext(nsISupports **aPrinter)
NS_IMETHODIMP
nsPrintOptions::SetFontNamePointSize(nsString& aFontName, PRInt32 aPointSize)
{
if (sDefaultFont != nsnull && aFontName.Length() > 0 && aPointSize > 0) {
if (sDefaultFont != nsnull && !aFontName.IsEmpty() && aPointSize > 0) {
sDefaultFont->name = aFontName;
sDefaultFont->size = NSIntPointsToTwips(aPointSize);
}

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

@ -442,7 +442,7 @@ NS_IMETHODIMP nsPrintSettings::SetPrintRange(PRInt16 aPrintRange)
NS_IMETHODIMP nsPrintSettings::GetTitle(PRUnichar * *aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
if (mTitle.Length() > 0) {
if (!mTitle.IsEmpty()) {
*aTitle = ToNewUnicode(mTitle);
} else {
*aTitle = nsnull;
@ -463,7 +463,7 @@ NS_IMETHODIMP nsPrintSettings::SetTitle(const PRUnichar * aTitle)
NS_IMETHODIMP nsPrintSettings::GetDocURL(PRUnichar * *aDocURL)
{
NS_ENSURE_ARG_POINTER(aDocURL);
if (mURL.Length() > 0) {
if (!mURL.IsEmpty()) {
*aDocURL = ToNewUnicode(mURL);
} else {
*aDocURL = nsnull;
@ -694,7 +694,7 @@ NS_IMETHODIMP nsPrintSettings::SetShowPrintProgress(PRBool aShowPrintProgress)
NS_IMETHODIMP nsPrintSettings::GetPaperName(PRUnichar * *aPaperName)
{
NS_ENSURE_ARG_POINTER(aPaperName);
if (mPaperName.Length()) {
if (!mPaperName.IsEmpty()) {
*aPaperName = ToNewUnicode(mPaperName);
} else {
*aPaperName = nsnull;

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

@ -993,7 +993,7 @@ AppendGenericFontFromPref(nsString& aFontname,
MAKE_FONT_PREF_KEY(pref, "font.name.", generic_dot_langGroup);
res = gPref->CopyUnicharPref(pref.get(), getter_Copies(value));
if (NS_SUCCEEDED(res)) {
if(aFontname.Length() > 0)
if(!aFontname.IsEmpty())
aFontname.Append((PRUnichar)',');
aFontname.Append(value);
}
@ -1003,7 +1003,7 @@ AppendGenericFontFromPref(nsString& aFontname,
MAKE_FONT_PREF_KEY(pref, "font.name-list.", generic_dot_langGroup);
res = gPref->CopyUnicharPref(pref.get(), getter_Copies(value));
if (NS_SUCCEEDED(res)) {
if(aFontname.Length() > 0)
if(!aFontname.IsEmpty())
aFontname.Append((PRUnichar)',');
aFontname.Append(value);
}

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

@ -1607,7 +1607,7 @@ void nsFT2Type8Generator::GeneratePSFont(FILE* aFile)
return;
int wmode = 0;
if (mSubset.Length() > 0)
if (!mSubset.IsEmpty())
FT2SubsetToType8(face, mSubset.get(), mSubset.Length(), wmode, aFile);
}
#endif //MOZ_ENABLE_FREETYPE2

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

@ -788,7 +788,7 @@ NS_IMETHODIMP nsDeviceContextWin :: BeginDocument(PRUnichar * aTitle, PRUnichar*
char* docName = nsnull;
nsAutoString str(aPrintToFileName);
if (str.Length() > 0) {
if (!str.IsEmpty()) {
docName = ToNewCString(str);
}
docinfo.cbSize = sizeof(docinfo);

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

@ -3300,7 +3300,7 @@ AppendGenericFontFromPref(nsString& aFontname,
MAKE_FONT_PREF_KEY(pref, "font.name.", generic_dot_langGroup);
res = gPref->CopyUnicharPref(pref.get(), getter_Copies(value));
if (NS_SUCCEEDED(res)) {
if(aFontname.Length() > 0)
if(!aFontname.IsEmpty())
aFontname.Append((PRUnichar)',');
aFontname.Append(value);
}
@ -3310,7 +3310,7 @@ AppendGenericFontFromPref(nsString& aFontname,
MAKE_FONT_PREF_KEY(pref, "font.name-list.", generic_dot_langGroup);
res = gPref->CopyUnicharPref(pref.get(), getter_Copies(value));
if (NS_SUCCEEDED(res)) {
if(aFontname.Length() > 0)
if(!aFontname.IsEmpty())
aFontname.Append((PRUnichar)',');
aFontname.Append(value);
}

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

@ -956,7 +956,7 @@ nsExpatDriver::CanParse(CParserContext& aParserContext,
result=ePrimaryDetect;
}
else {
if (0 == aParserContext.mMimeType.Length() &&
if (aParserContext.mMimeType.IsEmpty() &&
kNotFound != aBuffer.Find("<?xml ")) {
aParserContext.SetMimeType(NS_LITERAL_CSTRING(kXMLTextContentType));
result=eValidDetect;

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

@ -609,7 +609,7 @@ nsLoggingSink::WriteAttributes(const nsIParserNode& aNode) {
tmp.Truncate();
tmp.Append(v);
if(tmp.Length() > 0) {
if(!tmp.IsEmpty()) {
PRUnichar first = tmp.First();
if ((first == '"') || (first == '\'')) {
if (tmp.Last() == first) {
@ -669,7 +669,7 @@ nsLoggingSink::WillWriteAttributes(const nsIParserNode& aNode)
PRInt32 lineNo = 0;
dtd->CollectSkippedContent(aNode.GetNodeType(), content, lineNo);
if (content.Length() > 0) {
if (!content.IsEmpty()) {
return PR_TRUE;
}
}
@ -778,7 +778,7 @@ nsLoggingSink::GetNewCString(const nsAString& aValue, char** aResult)
nsAutoString temp;
result=QuoteText(aValue,temp);
if(NS_SUCCEEDED(result)) {
if(temp.Length()>0) {
if(!temp.IsEmpty()) {
*aResult = ToNewCString(temp);
}
}

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

@ -1567,7 +1567,7 @@ nsParser::Parse(const nsAString& aSourceBuffer,
nsresult result=NS_OK;
if(aLastCall && (0==aSourceBuffer.Length())) {
if(aLastCall && aSourceBuffer.IsEmpty()) {
// Nothing is being passed to the parser so return
// immediately. mUnusedInput will get processed when
// some data is actually passed in.
@ -1583,7 +1583,7 @@ nsParser::Parse(const nsAString& aSourceBuffer,
// till we're completely done.
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
if(aSourceBuffer.Length() || mUnusedInput.Length()) {
if(!aSourceBuffer.IsEmpty() || !mUnusedInput.IsEmpty()) {
if (aVerifyEnabled) {
mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION;
@ -1747,7 +1747,7 @@ nsresult nsParser::ResumeParse(PRBool allowIteration, PRBool aIsFinalChunk, PRBo
while((result==NS_OK) && (theIterationIsOk)) {
theFirstTime=PR_FALSE;
if(mUnusedInput.Length()>0) {
if(!mUnusedInput.IsEmpty()) {
if(mParserContext->mScanner) {
// -- Ref: Bug# 22485 --
// Insert the unused input into the source buffer
@ -2163,7 +2163,7 @@ static PRBool DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsS
// }
// break;
} // switch
return oCharset.Length() > 0;
return !oCharset.IsEmpty();
}
inline const char GetNextChar(nsACString::const_iterator& aStart,

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

@ -1608,7 +1608,7 @@ HasAttributeContent(nsStyleContext* aStyleContext,
PRInt32 error;
attrNameSpace = nameSpaceVal.ToInteger(&error, 10);
contentString.Cut(0, barIndex + 1);
if (contentString.Length()) {
if (!contentString.IsEmpty()) {
attrName = NS_NewAtom(contentString);
}
}
@ -1773,7 +1773,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
const nsStyleBackground* oldColor = oldContext->GetStyleBackground();
const nsStyleBackground* newColor = newContext->GetStyleBackground();
if (oldColor->mBackgroundImage.Length() > 0 &&
if (!oldColor->mBackgroundImage.IsEmpty() &&
oldColor->mBackgroundImage != newColor->mBackgroundImage) {
// stop the image loading for the frame, the image has changed
aPresContext->StopImagesFor(aFrame);

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

@ -1991,7 +1991,7 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
if (PR_FALSE == type.Equals(textHtml)) {
nsAutoString title;
sheet->GetTitle(title);
if (0 < title.Length()) {
if (!title.IsEmpty()) {
aSheetTitle = title;
index = count; // stop looking
}
@ -2060,7 +2060,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
if (PR_FALSE == type.Equals(textHtml)) {
nsAutoString title;
sheet->GetTitle(title);
if (0 < title.Length()) {
if (!title.IsEmpty()) {
if (-1 == aTitleList.IndexOf(title)) {
aTitleList.AppendString(title);
}

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

@ -867,7 +867,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext,
if (optionElement) {
nsAutoString text;
rv = optionElement->GetLabel(text);
if (NS_CONTENT_ATTR_HAS_VALUE != rv || 0 == text.Length()) {
if (NS_CONTENT_ATTR_HAS_VALUE != rv || text.IsEmpty()) {
if (NS_OK == optionElement->GetText(text)) {
nscoord width;
aReflowState.rendContext->GetWidth(text, width);
@ -1928,7 +1928,7 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
fragment->AppendTo(value);
}
PRBool shouldSetValue = PR_FALSE;
if (NS_FAILED(result) || value.Length() == 0) {
if (NS_FAILED(result) || value.IsEmpty()) {
shouldSetValue = PR_TRUE;
} else {
shouldSetValue = value != textToDisplay;

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

@ -231,7 +231,7 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
if (!mCheckButtonFaceStyle && GetCheckboxState()) {
const nsStyleBackground* myColor = mCheckButtonFaceStyle->GetStyleBackground();
if (myColor->mBackgroundImage.Length() > 0) {
if (!myColor->mBackgroundImage.IsEmpty()) {
const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder();
const nsStylePadding* myPadding = mCheckButtonFaceStyle->GetStylePadding();
const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition();

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

@ -156,7 +156,7 @@ nsIsIndexFrame::UpdatePromptLabel()
}
}
}
if (prompt.Length() == 0) {
if (prompt.IsEmpty()) {
// Generate localized label.
// We can't make any assumption as to what the default would be
// because the value is localized for non-english platforms, thus

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

@ -2194,15 +2194,15 @@ nsListControlFrame::GetOptionText(PRInt32 aIndex, nsAString & aStr)
rv = optionElement->GetLabel(text);
// the return value is always NS_OK from DOMElements
// it is meaningless to check for it
if (text.Length() > 0) {
if (!text.IsEmpty()) {
nsAutoString compressText = text;
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
if (compressText.Length() != 0) {
if (!compressText.IsEmpty()) {
text = compressText;
}
}
if (0 == text.Length()) {
if (text.IsEmpty()) {
// the return value is always NS_OK from DOMElements
// it is meaningless to check for it
optionElement->GetText(text);

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

@ -772,11 +772,11 @@ PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
if (type.get() == nsHTMLAtoms::object) {
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
if (aResult.Length() > 0)
if (!aResult.IsEmpty())
return PR_TRUE;
}else
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aResult)))
if (aResult.Length() > 0)
if (!aResult.IsEmpty())
return PR_TRUE;
return PR_FALSE;
@ -787,7 +787,7 @@ PRBool nsHTMLFrameInnerFrame::GetName(nsIContent* aContent, nsString& aResult)
aResult.SetLength(0);
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::name, aResult))) {
if (aResult.Length() > 0) {
if (!aResult.IsEmpty()) {
return PR_TRUE;
}
}

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

@ -1606,7 +1606,7 @@ nsImageFrame::GetAnchorHREFAndTarget(nsString& aHref, nsString& aTarget)
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(content));
if (anchor) {
anchor->GetHref(aHref);
if (aHref.Length() > 0) {
if (!aHref.IsEmpty()) {
status = PR_TRUE;
}
anchor->GetTarget(aTarget);

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

@ -916,7 +916,7 @@ nsImageMap::AddArea(nsIContent* aArea)
frameManager->SetPrimaryFrameFor(aArea, mImageFrame);
Area* area;
if ((0 == shape.Length()) ||
if (shape.IsEmpty() ||
shape.EqualsIgnoreCase("rect") ||
shape.EqualsIgnoreCase("rectangle")) {
area = new RectArea(aArea, hasURL);
@ -994,7 +994,7 @@ nsImageMap::IsInside(nscoord aX, nscoord aY) const
if (area->IsInside(aX, aY)) {
nsAutoString href;
area->GetHREF(href);
if (href.Length() > 0) {
if (!href.IsEmpty()) {
return PR_TRUE;
}
else {

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

@ -576,7 +576,7 @@ void nsObjectFrame::IsSupportedDocument(nsIContent* aContent, PRBool* aDoc)
nsXPIDLCString value;
rv = catman->GetCategoryEntry("Gecko-Content-Viewers",contentType, getter_Copies(value));
if (NS_SUCCEEDED(rv) && value && *value && (value.Length() > 0))
if (NS_SUCCEEDED(rv) && !value.IsEmpty())
*aDoc = PR_TRUE;
if (contentType)
@ -1158,7 +1158,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
// now try to instantiate a plugin instance based on a mime type
const char* mimeType = mimeTypeStr.get();
if (mimeType || (src.Length() > 0)) {
if (mimeType || !src.IsEmpty()) {
if (!mimeType) {
// we don't have a mime type, try to figure it out from extension
nsXPIDLCString extension;
@ -3015,7 +3015,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// let's NOT count up param tags that don't have a name attribute
nsAutoString name;
domelement->GetAttribute(NS_LITERAL_STRING("name"), name);
if (name.Length() > 0) {
if (!name.IsEmpty()) {
nsCOMPtr<nsIDOMNode> parent;
nsCOMPtr<nsIDOMHTMLObjectElement> domobject;
nsCOMPtr<nsIDOMHTMLAppletElement> domapplet;

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

@ -510,7 +510,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
// first make sure we have a vaild string and that the height of the
// text will fit in the margin
if (aStr.Length() > 0 &&
if (!aStr.IsEmpty() &&
((aHeaderFooter == eHeader && aHeight < mMargin.top) ||
(aHeaderFooter == eFooter && aHeight < mMargin.bottom))) {
nsAutoString str;

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

@ -1608,7 +1608,7 @@ HasAttributeContent(nsStyleContext* aStyleContext,
PRInt32 error;
attrNameSpace = nameSpaceVal.ToInteger(&error, 10);
contentString.Cut(0, barIndex + 1);
if (contentString.Length()) {
if (!contentString.IsEmpty()) {
attrName = NS_NewAtom(contentString);
}
}
@ -1773,7 +1773,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
const nsStyleBackground* oldColor = oldContext->GetStyleBackground();
const nsStyleBackground* newColor = newContext->GetStyleBackground();
if (oldColor->mBackgroundImage.Length() > 0 &&
if (!oldColor->mBackgroundImage.IsEmpty() &&
oldColor->mBackgroundImage != newColor->mBackgroundImage) {
// stop the image loading for the frame, the image has changed
aPresContext->StopImagesFor(aFrame);

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

@ -1606,7 +1606,7 @@ nsImageFrame::GetAnchorHREFAndTarget(nsString& aHref, nsString& aTarget)
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(content));
if (anchor) {
anchor->GetHref(aHref);
if (aHref.Length() > 0) {
if (!aHref.IsEmpty()) {
status = PR_TRUE;
}
anchor->GetTarget(aTarget);

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

@ -916,7 +916,7 @@ nsImageMap::AddArea(nsIContent* aArea)
frameManager->SetPrimaryFrameFor(aArea, mImageFrame);
Area* area;
if ((0 == shape.Length()) ||
if (shape.IsEmpty() ||
shape.EqualsIgnoreCase("rect") ||
shape.EqualsIgnoreCase("rectangle")) {
area = new RectArea(aArea, hasURL);
@ -994,7 +994,7 @@ nsImageMap::IsInside(nscoord aX, nscoord aY) const
if (area->IsInside(aX, aY)) {
nsAutoString href;
area->GetHREF(href);
if (href.Length() > 0) {
if (!href.IsEmpty()) {
return PR_TRUE;
}
else {

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

@ -576,7 +576,7 @@ void nsObjectFrame::IsSupportedDocument(nsIContent* aContent, PRBool* aDoc)
nsXPIDLCString value;
rv = catman->GetCategoryEntry("Gecko-Content-Viewers",contentType, getter_Copies(value));
if (NS_SUCCEEDED(rv) && value && *value && (value.Length() > 0))
if (NS_SUCCEEDED(rv) && !value.IsEmpty())
*aDoc = PR_TRUE;
if (contentType)
@ -1158,7 +1158,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
// now try to instantiate a plugin instance based on a mime type
const char* mimeType = mimeTypeStr.get();
if (mimeType || (src.Length() > 0)) {
if (mimeType || !src.IsEmpty()) {
if (!mimeType) {
// we don't have a mime type, try to figure it out from extension
nsXPIDLCString extension;
@ -3015,7 +3015,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// let's NOT count up param tags that don't have a name attribute
nsAutoString name;
domelement->GetAttribute(NS_LITERAL_STRING("name"), name);
if (name.Length() > 0) {
if (!name.IsEmpty()) {
nsCOMPtr<nsIDOMNode> parent;
nsCOMPtr<nsIDOMHTMLObjectElement> domobject;
nsCOMPtr<nsIDOMHTMLAppletElement> domapplet;

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

@ -510,7 +510,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
// first make sure we have a vaild string and that the height of the
// text will fit in the margin
if (aStr.Length() > 0 &&
if (!aStr.IsEmpty() &&
((aHeaderFooter == eHeader && aHeight < mMargin.top) ||
(aHeaderFooter == eFooter && aHeight < mMargin.bottom))) {
nsAutoString str;

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

@ -1991,7 +1991,7 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
if (PR_FALSE == type.Equals(textHtml)) {
nsAutoString title;
sheet->GetTitle(title);
if (0 < title.Length()) {
if (!title.IsEmpty()) {
aSheetTitle = title;
index = count; // stop looking
}
@ -2060,7 +2060,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
if (PR_FALSE == type.Equals(textHtml)) {
nsAutoString title;
sheet->GetTitle(title);
if (0 < title.Length()) {
if (!title.IsEmpty()) {
if (-1 == aTitleList.IndexOf(title)) {
aTitleList.AppendString(title);
}

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

@ -772,11 +772,11 @@ PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
if (type.get() == nsHTMLAtoms::object) {
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
if (aResult.Length() > 0)
if (!aResult.IsEmpty())
return PR_TRUE;
}else
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aResult)))
if (aResult.Length() > 0)
if (!aResult.IsEmpty())
return PR_TRUE;
return PR_FALSE;
@ -787,7 +787,7 @@ PRBool nsHTMLFrameInnerFrame::GetName(nsIContent* aContent, nsString& aResult)
aResult.SetLength(0);
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::name, aResult))) {
if (aResult.Length() > 0) {
if (!aResult.IsEmpty()) {
return PR_TRUE;
}
}

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

@ -867,7 +867,7 @@ nsComboboxControlFrame::ReflowItems(nsIPresContext* aPresContext,
if (optionElement) {
nsAutoString text;
rv = optionElement->GetLabel(text);
if (NS_CONTENT_ATTR_HAS_VALUE != rv || 0 == text.Length()) {
if (NS_CONTENT_ATTR_HAS_VALUE != rv || text.IsEmpty()) {
if (NS_OK == optionElement->GetText(text)) {
nscoord width;
aReflowState.rendContext->GetWidth(text, width);
@ -1928,7 +1928,7 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
fragment->AppendTo(value);
}
PRBool shouldSetValue = PR_FALSE;
if (NS_FAILED(result) || value.Length() == 0) {
if (NS_FAILED(result) || value.IsEmpty()) {
shouldSetValue = PR_TRUE;
} else {
shouldSetValue = value != textToDisplay;

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

@ -231,7 +231,7 @@ nsGfxCheckboxControlFrame::Paint(nsIPresContext* aPresContext,
if (!mCheckButtonFaceStyle && GetCheckboxState()) {
const nsStyleBackground* myColor = mCheckButtonFaceStyle->GetStyleBackground();
if (myColor->mBackgroundImage.Length() > 0) {
if (!myColor->mBackgroundImage.IsEmpty()) {
const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder();
const nsStylePadding* myPadding = mCheckButtonFaceStyle->GetStylePadding();
const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition();

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

@ -156,7 +156,7 @@ nsIsIndexFrame::UpdatePromptLabel()
}
}
}
if (prompt.Length() == 0) {
if (prompt.IsEmpty()) {
// Generate localized label.
// We can't make any assumption as to what the default would be
// because the value is localized for non-english platforms, thus

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

@ -2194,15 +2194,15 @@ nsListControlFrame::GetOptionText(PRInt32 aIndex, nsAString & aStr)
rv = optionElement->GetLabel(text);
// the return value is always NS_OK from DOMElements
// it is meaningless to check for it
if (text.Length() > 0) {
if (!text.IsEmpty()) {
nsAutoString compressText = text;
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
if (compressText.Length() != 0) {
if (!compressText.IsEmpty()) {
text = compressText;
}
}
if (0 == text.Length()) {
if (text.IsEmpty()) {
// the return value is always NS_OK from DOMElements
// it is meaningless to check for it
optionElement->GetText(text);

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

@ -426,7 +426,7 @@ nsMathMLmactionFrame::MouseClick(nsIDOMEvent* aMouseEvent)
}
}
else if (NS_MATHML_ACTION_TYPE_RESTYLE == mActionType) {
if (0 < mRestyle.Length()) {
if (!mRestyle.IsEmpty()) {
nsCOMPtr<nsIDOMElement> node( do_QueryInterface(mContent) );
if (node.get()) {
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None,

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

@ -147,7 +147,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsIPresContext* aPresContext)
else
data.Truncate();
if (0 < data.Length()) {
if (!data.IsEmpty()) {
mOpenChar = new nsMathMLChar;
if (!mOpenChar) return NS_ERROR_OUT_OF_MEMORY;
mOpenChar->SetData(aPresContext, data);
@ -168,7 +168,7 @@ nsMathMLmfencedFrame::CreateFencesAndSeparators(nsIPresContext* aPresContext)
else
data.Truncate();
if (0 < data.Length()) {
if (!data.IsEmpty()) {
mCloseChar = new nsMathMLChar;
if (!mCloseChar) return NS_ERROR_OUT_OF_MEMORY;
mCloseChar->SetData(aPresContext, data);

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

@ -161,7 +161,7 @@ nsMathMLmfracFrame::CalcLineThickness(nsIPresContext* aPresContext,
nscoord lineThickness = aDefaultRuleThickness;
nscoord minimumThickness = onePixel;
if (0 < aThicknessAttribute.Length()) {
if (!aThicknessAttribute.IsEmpty()) {
if (aThicknessAttribute.Equals(NS_LITERAL_STRING("thin"))) {
lineThickness = NSToCoordFloor(defaultThickness * THIN_FRACTION_LINE);
minimumThickness = onePixel * THIN_FRACTION_LINE_MINIMUM_PIXELS;

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

@ -82,7 +82,7 @@ nsSVGStroke::Build(ArtVpath* path, const nsSVGStrokeStyle& style)
NS_ERROR("not reached");
}
if (style.dasharray.Length() > 0) {
if (!style.dasharray.IsEmpty()) {
ArtVpathDash dash;
dash.offset = style.dashoffset;

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

@ -376,7 +376,7 @@ nsImageBoxFrame::GetImageSource()
// get the list-style-image
const nsStyleList* myList = GetStyleList();
if (myList->mListStyleImage.Length() > 0) {
if (!myList->mListStyleImage.IsEmpty()) {
mSrc = myList->mListStyleImage;
}
}

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

@ -141,7 +141,7 @@ nsStackFrame::GetFrameForPoint(nsIPresContext* aPresContext,
PRBool transparentBG = NS_STYLE_BG_COLOR_TRANSPARENT ==
(color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
PRBool backgroundImage = (color->mBackgroundImage.Length() > 0);
PRBool backgroundImage = !color->mBackgroundImage.IsEmpty();
if (!transparentBG || backgroundImage)
{

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

@ -317,7 +317,7 @@ nsTextBoxFrame::PaintTitle(nsIPresContext* aPresContext,
const nsRect& aDirtyRect,
const nsRect& aRect)
{
if (mTitle.Length() == 0)
if (mTitle.IsEmpty())
return NS_OK;
// determine (cropped) title and underline position
@ -509,7 +509,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nscoord aWidth)
{
if (mTitle.Length() == 0)
if (mTitle.IsEmpty())
return;
nsCOMPtr<nsIDeviceContext> deviceContext;

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

@ -846,7 +846,7 @@ NS_IMETHODIMP nsTreeBodyFrame::GetKeyColumnIndex(PRInt32 *_retval)
first = currCol->GetColIndex();
currCol->GetElement()->GetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection, attr);
if (attr.Length() > 0) { // Use sorted column as the primary
if (!attr.IsEmpty()) { // Use sorted column as the primary
sorted = currCol->GetColIndex();
break;
}
@ -1904,7 +1904,7 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, PRBool aUs
const nsAString* imagePtr;
nsAutoString imageSrc;
mView->GetImageSrc(aRowIndex, aColID, imageSrc);
if (!aUseContext && imageSrc.Length() > 0) {
if (!aUseContext && !imageSrc.IsEmpty()) {
imagePtr = &imageSrc;
aAllowImageRegions = PR_FALSE;
}
@ -1912,7 +1912,7 @@ nsTreeBodyFrame::GetImage(PRInt32 aRowIndex, const PRUnichar* aColID, PRBool aUs
// Obtain the URL from the style context.
aAllowImageRegions = PR_TRUE;
const nsStyleList* myList = aStyleContext->GetStyleList();
if (myList->mListStyleImage.Length() > 0)
if (!myList->mListStyleImage.IsEmpty())
imagePtr = &myList->mListStyleImage;
else
return NS_OK;

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

@ -330,7 +330,7 @@ NS_IMETHODIMP nsAbOutlookCard::EditCardToDatabase(const char *aUru)
GetHomeAddress(getter_Copies(unichar)) ;
GetHomeAddress2(getter_Copies(unichar2)) ;
utility.Assign(unichar.get()) ;
if (utility.Length() > 0) { utility.AppendWithConversion(CRLF) ; }
if (!utility.IsEmpty()) { utility.AppendWithConversion(CRLF) ; }
utility.Append(unichar2.get()) ;
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, utility.get())) {
PRINTF(("Cannot set home address.\n")) ;
@ -338,7 +338,7 @@ NS_IMETHODIMP nsAbOutlookCard::EditCardToDatabase(const char *aUru)
GetWorkAddress(getter_Copies(unichar)) ;
GetWorkAddress2(getter_Copies(unichar2)) ;
utility.Assign(unichar.get()) ;
if (utility.Length() > 0) { utility.AppendWithConversion(CRLF) ; }
if (!utility.IsEmpty()) { utility.AppendWithConversion(CRLF) ; }
utility.Append(unichar2.get()) ;
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, utility.get())) {
PRINTF(("Cannot set work address.\n")) ;

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

@ -309,7 +309,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::DeleteCards(nsISupportsArray *aCardList)
NS_ENSURE_SUCCESS(retCode, retCode) ;
retCode = ExtractCardEntry(card, entryString) ;
if (NS_SUCCEEDED(retCode) && entryString.Length() > 0) {
if (NS_SUCCEEDED(retCode) && !entryString.IsEmpty()) {
cardEntry.Assign(entryString) ;
if (!mapiAddBook->DeleteEntry(*mMapiData, cardEntry)) {
@ -347,7 +347,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::DeleteDirectory(nsIAbDirectory *aDirectory)
if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
retCode = ExtractDirectoryEntry(aDirectory, entryString) ;
if (NS_SUCCEEDED(retCode) && entryString.Length() > 0) {
if (NS_SUCCEEDED(retCode) && !entryString.IsEmpty()) {
nsMapiEntry directoryEntry ;
directoryEntry.Assign(entryString) ;
@ -412,7 +412,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddMailList(nsIAbDirectory *aMailList)
if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
retCode = ExtractDirectoryEntry(aMailList, entryString) ;
if (NS_SUCCEEDED(retCode) && entryString.Length() > 0) {
if (NS_SUCCEEDED(retCode) && !entryString.IsEmpty()) {
nsMapiEntry sourceEntry ;
sourceEntry.Assign(entryString) ;
@ -1256,7 +1256,7 @@ nsresult nsAbOutlookDirectory::CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard
// If we get a RDF resource and it maps onto an Outlook card uri,
// we simply copy the contents of the Outlook card.
retCode = ExtractCardEntry(aData, entryString) ;
if (NS_SUCCEEDED(retCode) && entryString.Length() > 0) {
if (NS_SUCCEEDED(retCode) && !entryString.IsEmpty()) {
nsMapiEntry sourceEntry ;

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

@ -2619,61 +2619,61 @@ nsresult nsAddrDatabase::GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow)
// there is no reason to set / copy all these attributes on the card, when we'll never even
// ask for them.
err = GetStringColumn(cardRow, m_FirstNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetFirstName(tempString.get());
}
err = GetStringColumn(cardRow, m_LastNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetLastName(tempString.get());
}
err = GetStringColumn(cardRow, m_PhoneticFirstNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetPhoneticFirstName(tempString.get());
}
err = GetStringColumn(cardRow, m_PhoneticLastNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetPhoneticLastName(tempString.get());
}
err = GetStringColumn(cardRow, m_DisplayNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetDisplayName(tempString.get());
}
err = GetStringColumn(cardRow, m_NickNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetNickName(tempString.get());
}
err = GetStringColumn(cardRow, m_PriEmailColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetPrimaryEmail(tempString.get());
}
err = GetStringColumn(cardRow, m_2ndEmailColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetSecondEmail(tempString.get());
}
err = GetStringColumn(cardRow, m_DefaultEmailColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetDefaultEmail(tempString.get());
}
err = GetStringColumn(cardRow, m_CardTypeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCardType(tempString.get());
}
@ -2684,234 +2684,234 @@ nsresult nsAddrDatabase::GetCardFromDB(nsIAbCard *newCard, nsIMdbRow* cardRow)
newCard->SetPreferMailFormat(format);
err = GetStringColumn(cardRow, m_WorkPhoneColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkPhone(tempString.get());
}
err = GetStringColumn(cardRow, m_HomePhoneColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomePhone(tempString.get());
}
err = GetStringColumn(cardRow, m_FaxColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetFaxNumber(tempString.get());
}
err = GetStringColumn(cardRow, m_PagerColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetPagerNumber(tempString.get());
}
err = GetStringColumn(cardRow, m_CellularColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCellularNumber(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkPhoneTypeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetWorkPhoneType(tempString.get());
err = GetStringColumn(cardRow, m_HomePhoneTypeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetHomePhoneType(tempString.get());
err = GetStringColumn(cardRow, m_FaxTypeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetFaxNumberType(tempString.get());
err = GetStringColumn(cardRow, m_PagerTypeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetPagerNumberType(tempString.get());
err = GetStringColumn(cardRow, m_CellularTypeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetCellularNumberType(tempString.get());
err = GetStringColumn(cardRow, m_HomeAddressColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomeAddress(tempString.get());
}
err = GetStringColumn(cardRow, m_HomeAddress2ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomeAddress2(tempString.get());
}
err = GetStringColumn(cardRow, m_HomeCityColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomeCity(tempString.get());
}
err = GetStringColumn(cardRow, m_HomeStateColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomeState(tempString.get());
}
err = GetStringColumn(cardRow, m_HomeZipCodeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomeZipCode(tempString.get());
}
err = GetStringColumn(cardRow, m_HomeCountryColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetHomeCountry(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkAddressColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkAddress(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkAddress2ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkAddress2(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkCityColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkCity(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkStateColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkState(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkZipCodeColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkZipCode(tempString.get());
}
err = GetStringColumn(cardRow, m_WorkCountryColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWorkCountry(tempString.get());
}
err = GetStringColumn(cardRow, m_JobTitleColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetJobTitle(tempString.get());
}
err = GetStringColumn(cardRow, m_DepartmentColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetDepartment(tempString.get());
}
err = GetStringColumn(cardRow, m_CompanyColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCompany(tempString.get());
}
// AimScreenName
err = GetStringColumn(cardRow, m_AimScreenNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetAimScreenName(tempString.get());
err = GetStringColumn(cardRow, m_AnniversaryYearColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetAnniversaryYear(tempString.get());
err = GetStringColumn(cardRow, m_AnniversaryMonthColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetAnniversaryMonth(tempString.get());
err = GetStringColumn(cardRow, m_AnniversaryDayColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetAnniversaryDay(tempString.get());
err = GetStringColumn(cardRow, m_SpouseNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetSpouseName(tempString.get());
err = GetStringColumn(cardRow, m_FamilyNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetFamilyName(tempString.get());
err = GetStringColumn(cardRow, m_DefaultAddressColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetDefaultAddress(tempString.get());
err = GetStringColumn(cardRow, m_CategoryColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
newCard->SetCategory(tempString.get());
err = GetStringColumn(cardRow, m_WebPage1ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWebPage1(tempString.get());
}
err = GetStringColumn(cardRow, m_WebPage2ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetWebPage2(tempString.get());
}
err = GetStringColumn(cardRow, m_BirthYearColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetBirthYear(tempString.get());
}
err = GetStringColumn(cardRow, m_BirthMonthColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetBirthMonth(tempString.get());
}
err = GetStringColumn(cardRow, m_BirthDayColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetBirthDay(tempString.get());
}
err = GetStringColumn(cardRow, m_Custom1ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCustom1(tempString.get());
}
err = GetStringColumn(cardRow, m_Custom2ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCustom2(tempString.get());
}
err = GetStringColumn(cardRow, m_Custom3ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCustom3(tempString.get());
}
err = GetStringColumn(cardRow, m_Custom4ColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetCustom4(tempString.get());
}
err = GetStringColumn(cardRow, m_NotesColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newCard->SetNotes(tempString.get());
}
@ -2941,18 +2941,18 @@ nsresult nsAddrDatabase::GetListCardFromDB(nsIAbCard *listCard, nsIMdbRow* listR
nsAutoString tempString;
err = GetStringColumn(listRow, m_ListNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
listCard->SetDisplayName(tempString.get());
listCard->SetLastName(tempString.get());
}
err = GetStringColumn(listRow, m_ListNickNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
listCard->SetNickName(tempString.get());
}
err = GetStringColumn(listRow, m_ListDescriptionColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
listCard->SetNotes(tempString.get());
}
@ -2976,17 +2976,17 @@ nsresult nsAddrDatabase::GetListFromDB(nsIAbDirectory *newList, nsIMdbRow* listR
nsAutoString tempString;
err = GetStringColumn(listRow, m_ListNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newList->SetDirName(tempString.get());
}
err = GetStringColumn(listRow, m_ListNickNameColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newList->SetListNickName(tempString.get());
}
err = GetStringColumn(listRow, m_ListDescriptionColumnToken, tempString);
if (NS_SUCCEEDED(err) && tempString.Length())
if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
{
newList->SetDescription(tempString.get());
}

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

@ -734,8 +734,8 @@ nsresult AddressBookParser::ParseLDIFFile()
}
}
//last row
if (mLine.Length() > 0 && mLine.Find("groupOfNames") == kNotFound)
AddLdifRowToDatabase(PR_FALSE);
if (!mLine.IsEmpty() && mLine.Find("groupOfNames") == kNotFound)
AddLdifRowToDatabase(PR_FALSE);
// mail Lists
PRInt32 i, pos, size;
@ -824,7 +824,7 @@ void AddressBookParser::AddLdifRowToDatabase(PRBool bIsList)
void AddressBookParser::ClearLdifRecordBuffer()
{
if (mLine.Length() > 0)
if (!mLine.IsEmpty())
{
mLine.Truncate();
mLFCount = 0;

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

@ -1079,7 +1079,7 @@ NS_IMETHODIMP nsMsgFilterList::GetShouldDownloadAllHeaders(PRBool *aResult)
nsresult nsMsgFilterList::ComputeArbitraryHeaders()
{
nsresult rv = NS_OK;
if (m_arbitraryHeaders.Length() == 0)
if (m_arbitraryHeaders.IsEmpty())
{
PRUint32 numFilters;
rv = m_filters->Count(&numFilters);
@ -1102,7 +1102,7 @@ nsresult nsMsgFilterList::ComputeArbitraryHeaders()
filter->GetTerm(i, &attrib, nsnull,nsnull,nsnull, getter_Copies(arbitraryHeader));
if (arbitraryHeader && arbitraryHeader[0])
{
if (m_arbitraryHeaders.Length() == 0)
if (m_arbitraryHeaders.IsEmpty())
m_arbitraryHeaders.Assign(arbitraryHeader);
else if (PL_strncasecmp(m_arbitraryHeaders.get(), arbitraryHeader, arbitraryHeader.Length()))
{

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

@ -821,7 +821,7 @@ nsresult nsMsgSearchTerm::MatchBody (nsIMsgSearchScopeTerm *scope, PRUint32 offs
StripQuotedPrintable ((unsigned char*)buf);
nsCString compare(buf);
// ConvertToUnicode(charset, buf, compare);
if (compare.Length() > 0) {
if (!compare.IsEmpty()) {
char startChar = (char) compare.CharAt(0);
if (startChar != nsCRT::CR && startChar != nsCRT::LF)
{

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

@ -1370,8 +1370,8 @@ nsMsgAccountManager::LoadAccounts()
getter_Copies(appendAccountList));
// If there are pre-configured accounts, we need to add them to the existing list.
if (appendAccountList.Length() > 0) {
if (accountList.Length() > 0) {
if (!appendAccountList.IsEmpty()) {
if (!accountList.IsEmpty()) {
nsCStringArray existingAccountsArray;
existingAccountsArray.ParseString(accountList.get(), ACCOUNT_DELIMITER);

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

@ -102,7 +102,7 @@ nsresult nsMsgI18NConvertFromUnicode(const nsCString& aCharset,
nsCOMPtr <nsICharsetAlias> calias = do_GetService(NS_CHARSETALIAS_CONTRACTID, &res);
if (NS_SUCCEEDED(res)) {
nsAutoString aAlias; aAlias.AssignWithConversion(aCharset.get());
if (aAlias.Length()) {
if (!aAlias.IsEmpty()) {
res = calias->GetPreferred(aAlias, convCharset);
}
}
@ -170,7 +170,7 @@ nsresult nsMsgI18NConvertToUnicode(const nsCString& aCharset,
nsCOMPtr <nsICharsetAlias> calias = do_GetService(NS_CHARSETALIAS_CONTRACTID, &res);
if (NS_SUCCEEDED(res)) {
nsAutoString aAlias; aAlias.AssignWithConversion(aCharset.get());
if (aAlias.Length()) {
if (!aAlias.IsEmpty()) {
res = calias->GetPreferred(aAlias, convCharset);
}
}
@ -365,7 +365,7 @@ const char * nsMsgI18NFileSystemCharset()
/* Get a charset used for the file. */
static nsCAutoString fileSystemCharset;
if (fileSystemCharset.Length() < 1)
if (fileSystemCharset.IsEmpty())
{
nsresult rv;
nsCOMPtr <nsIPlatformCharset> platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);

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

@ -316,12 +316,11 @@ nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI, nsCString& p
while (startSlashPos != -1) {
oldPath.Mid(pathPiece, startSlashPos + 1, endSlashPos - startSlashPos);
// skip leading '/' (and other // style things)
if (pathPiece.Length() > 0) {
if (!pathPiece.IsEmpty()) {
// add .sbd onto the previous path
if (haveFirst) {
pathString+=".sbd";
pathString += "/";
pathString += ".sbd/";
}
NS_MsgHashIfNecessary(pathPiece);

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

@ -473,7 +473,7 @@ nsSmtpService::loadSmtpServers()
// Get the list of smtp servers (either from regular pref i.e, mail.smtpservers or
// from preconfigured pref mail.smtpservers.appendsmtpservers) and create a keyed
// server list.
if ((serverList.Length() > 0) || (appendServerList.Length() > 0)) {
if (!serverList.IsEmpty() || !appendServerList.IsEmpty()) {
/**
* Check to see if we need to add pre-configured smtp servers.
* Following prefs are important to note in understanding the procedure here.
@ -508,8 +508,8 @@ nsSmtpService::loadSmtpServers()
// Update the smtp server list if needed
if ((appendSmtpServersCurrentVersion <= appendSmtpServersDefaultVersion)) {
// If there are pre-configured servers, add them to the existing server list
if (appendServerList.Length() > 0) {
if (serverList.Length() > 0) {
if (!appendServerList.IsEmpty()) {
if (!serverList.IsEmpty()) {
nsCStringArray existingSmtpServersArray;
existingSmtpServersArray.ParseString(serverList.get(), SERVER_DELIMITER);

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

@ -3488,7 +3488,7 @@ nsresult nsMsgDatabase::ThreadNewHdr(nsMsgHdr* newHdr, PRBool &newThread)
// but we have to handle case of promoting new header to top-level
// in case the top-level header comes after a reply.
if (reference.Length() == 0)
if (reference.IsEmpty())
break;
thread = getter_AddRefs(GetThreadForReference(reference, getter_AddRefs(replyToHdr))) ;

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

@ -210,7 +210,7 @@ nsresult nsMsgOfflineImapOperation::GetCopiesFromDB()
nsresult rv = m_mdb->GetProperty(m_mdbRow, PROP_COPY_DESTS, getter_Copies(copyDests));
nsCAutoString copyDestsCString((const char *) copyDests);
// use 0x1 as the delimiter between folder names since it's not a legal character
if (NS_SUCCEEDED(rv) && copyDestsCString.Length() > 0)
if (NS_SUCCEEDED(rv) && !copyDestsCString.IsEmpty())
{
PRInt32 curCopyDestStart = 0;
PRInt32 nextCopyDestPos = 0;

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

@ -527,7 +527,7 @@ nsresult nsImapMailFolder::CreateSubFolders(nsFileSpec &path)
{
// use the unicode name as the "pretty" name. Set it so it won't be
// automatically computed from the URI, which is in utf7 form.
if (currentFolderNameStr.Length() > 0)
if (!currentFolderNameStr.IsEmpty())
child->SetPrettyName(currentFolderNameStr.get());
}
@ -876,7 +876,7 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
if (imapFolder)
{
nsCAutoString onlineName(m_onlineFolderName);
if (onlineName.Length() > 0)
if (!onlineName.IsEmpty())
onlineName.Append(char(hierarchyDelimiter));
onlineName.AppendWithConversion(folderNameStr);
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);
@ -1798,7 +1798,7 @@ nsImapMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatab
nsAutoString autoOnlineName;
// autoOnlineName.AssignWithConversion(name);
(*folderInfo)->GetMailboxName(&autoOnlineName);
if (autoOnlineName.Length() == 0)
if (autoOnlineName.IsEmpty())
{
nsXPIDLCString uri;
rv = GetURI(getter_Copies(uri));
@ -3127,13 +3127,13 @@ nsresult nsImapMailFolder::GetFolderOwnerUserName(char **userName)
if (!(mFlags & MSG_FOLDER_FLAG_IMAP_OTHER_USER))
return NS_OK;
if (!m_ownerUserName.Length())
if (m_ownerUserName.IsEmpty())
{
nsXPIDLCString onlineName;
GetOnlineName(getter_Copies(onlineName));
m_ownerUserName = nsIMAPNamespaceList::GetFolderOwnerNameFromPath(GetNamespaceForFolder(), onlineName.get());
}
*userName = (m_ownerUserName.Length()) ? ToNewCString(m_ownerUserName) : nsnull;
*userName = !m_ownerUserName.IsEmpty() ? ToNewCString(m_ownerUserName) : nsnull;
return NS_OK;
}
@ -3148,7 +3148,7 @@ nsresult nsImapMailFolder::GetOwnersOnlineFolderName(char **retName)
{
nsXPIDLCString user;
GetFolderOwnerUserName(getter_Copies(user));
if (onlineName.Length() && user.Length())
if (!onlineName.IsEmpty() && !user.IsEmpty())
{
const char *where = PL_strstr(onlineName.get(), user.get());
NS_ASSERTION(where, "user name not in online name");
@ -3264,7 +3264,7 @@ NS_IMETHODIMP nsImapMailFolder::GetHasAdminUrl(PRBool *aBool)
NS_ENSURE_ARG_POINTER(aBool);
nsXPIDLCString manageMailAccountUrl;
nsresult rv = GetServerAdminUrl(getter_Copies(manageMailAccountUrl));
*aBool = (NS_SUCCEEDED(rv) && manageMailAccountUrl.Length());
*aBool = (NS_SUCCEEDED(rv) && !manageMailAccountUrl.IsEmpty());
return rv;
}
@ -3644,7 +3644,7 @@ NS_IMETHODIMP nsImapMailFolder::DownloadMessagesForOffline(nsISupportsArray *mes
// return DownloadAllForOffline(nsnull, window);
#endif
nsresult rv = BuildIdsAndKeyArray(messages, messageIds, srcKeyArray);
if (NS_FAILED(rv) || messageIds.Length() == 0) return rv;
if (NS_FAILED(rv) || messageIds.IsEmpty()) return rv;
nsCOMPtr<nsIImapService> imapService = do_GetService(NS_IMAPSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
@ -5030,7 +5030,7 @@ nsImapMailFolder::FillInFolderProps(nsIMsgImapFolderProps *aFolderProps)
nsXPIDLCString owner;
nsXPIDLString uniOwner;
GetFolderOwnerUserName(getter_Copies(owner));
if (!owner.Length())
if (owner.IsEmpty())
{
rv = IMAPGetStringByID(folderTypeStringID, getter_Copies(uniOwner));
// Another user's folder, for which we couldn't find an owner name
@ -5060,9 +5060,9 @@ nsImapMailFolder::FillInFolderProps(nsIMsgImapFolderProps *aFolderProps)
if (NS_SUCCEEDED(rv))
aFolderProps->SetFolderType(folderType);
if (!folderTypeDesc.Length() && folderTypeDescStringID != 0)
if (folderTypeDesc.IsEmpty() && folderTypeDescStringID != 0)
rv = IMAPGetStringByID(folderTypeDescStringID, getter_Copies(folderTypeDesc));
if (folderTypeDesc.Length())
if (!folderTypeDesc.IsEmpty())
aFolderProps->SetFolderTypeDescription(folderTypeDesc.get());
nsXPIDLString rightsString;
@ -5167,7 +5167,7 @@ void nsMsgIMAPFolderACL::BuildInitialACLFromCache()
if (startingFlags & IMAP_ACL_ADMINISTER_FLAG)
myrights += "a";
if (myrights.Length())
if (!myrights.IsEmpty())
SetFolderRightsForUser(nsnull, myrights.get());
}
@ -5261,7 +5261,7 @@ const char *nsMsgIMAPFolderACL::GetRightsStringForUser(const char *inUserName)
{
nsXPIDLCString userName;
userName.Assign(inUserName);
if (!userName.Length())
if (userName.IsEmpty())
{
nsCOMPtr <nsIMsgIncomingServer> server;
@ -5437,49 +5437,49 @@ nsresult nsMsgIMAPFolderACL::CreateACLRightsString(PRUnichar **rightsString)
}
if (GetCanIWriteFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_WRITE_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanIInsertInFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_INSERT_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanILookupFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_LOOKUP_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanIStoreSeenInFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_SEEN_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanIDeleteInFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_DELETE_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanICreateSubfolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_CREATE_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanIPostToFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_POST_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
if (GetCanIAdministerFolder())
{
if (rights.Length()) rights += NS_LITERAL_STRING(", ");
if (!rights.IsEmpty()) rights += NS_LITERAL_STRING(", ");
bundle->GetStringFromID(IMAP_ACL_ADMINISTER_RIGHT, getter_Copies(curRight));
rights.Append(curRight);
}
@ -6955,7 +6955,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient(nsIMsgWindow *msgWindow, nsIMsgFold
if (imapFolder)
{
nsCAutoString onlineName(m_onlineFolderName);
if (onlineName.Length() > 0)
if (!onlineName.IsEmpty())
onlineName.Append(char(hierarchyDelimiter));
onlineName.AppendWithConversion(folderNameStr);
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);

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

@ -1844,7 +1844,7 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
{
PRBool isInbox =
PL_strcasecmp("Inbox", folderNameForProposedUrl) == 0;
if (curUrlFolderName.Length() > 0)
if (!curUrlFolderName.IsEmpty())
{
PRBool matched = isInbox ?
PL_strcasecmp(curUrlFolderName.get(),
@ -2252,14 +2252,14 @@ void nsImapProtocol::ProcessSelectedStateURL()
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
m_runningUrl->GetCustomAddFlags(getter_Copies(addFlags));
m_runningUrl->GetCustomSubtractFlags(getter_Copies(subtractFlags));
if (addFlags.Length() > 0)
if (!addFlags.IsEmpty())
{
nsCAutoString storeString("+FLAGS (");
storeString.Append(addFlags);
storeString.Append(")");
Store(messageIdString, storeString.get(), PR_TRUE);
}
if (subtractFlags.Length() > 0)
if (!subtractFlags.IsEmpty())
{
nsCAutoString storeString("-FLAGS (");
storeString.Append(subtractFlags);
@ -3431,7 +3431,7 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
GetCurrentUrl()->CreateListOfMessageIdsString(getter_Copies(undoIdsStr));
undoIds.Assign(undoIdsStr);
if (undoIds.Length() > 0)
if (!undoIds.IsEmpty())
{
char firstChar = (char) undoIds.CharAt(0);
undoIds.Cut(0, 1); // remove first character
@ -4351,7 +4351,7 @@ nsImapProtocol::DiscoverMailboxSpec(nsImapMailboxSpec * adoptedBoxSpec)
{
SetConnectionStatus(-1);
}
else if (boxNameCopy.Length() &&
else if (!boxNameCopy.IsEmpty() &&
(GetMailboxDiscoveryStatus() ==
eListMyChildren) &&
(!useSubscription || GetSubscribingNow()))
@ -4364,7 +4364,7 @@ nsImapProtocol::DiscoverMailboxSpec(nsImapMailboxSpec * adoptedBoxSpec)
{
if (m_hierarchyNameState ==
kListingForInfoAndDiscovery &&
boxNameCopy.Length() &&
!boxNameCopy.IsEmpty() &&
!(adoptedBoxSpec->box_flags & kNameSpace))
{
// remember the info here also
@ -5189,7 +5189,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
rv = m_imapExtensionSink->GetMessageId(this, &messageId,
m_runningUrl);
WaitForFEEventCompletion();
if (NS_SUCCEEDED(rv) && messageId.Length() > 0 &&
if (NS_SUCCEEDED(rv) && !messageId.IsEmpty() &&
GetServerStateParser().LastCommandSuccessful())
{
// if the appended to folder isn't selected in the connection,
@ -5846,7 +5846,7 @@ PRBool nsImapProtocol::DeleteSubFolders(const char* selectedMailbox, PRBool &aDe
pattern.Append(onlineDirSeparator);
pattern.Append('*');
if (pattern.Length())
if (!pattern.IsEmpty())
{
List(pattern.get(), PR_FALSE);
}
@ -6100,7 +6100,7 @@ void nsImapProtocol::OnMoveFolderHierarchy(const char * sourceMailbox)
else
oldBoxName.Right(leafName, length-(leafStart+1));
if ( newBoxName.Length() > 0 )
if ( !newBoxName.IsEmpty() )
newBoxName.Append(onlineDirSeparator);
newBoxName.Append(leafName);
PRBool renamed = RenameHierarchyByHand(sourceMailbox,
@ -6240,17 +6240,17 @@ void nsImapProtocol::DiscoverAllAndSubscribedBoxes()
nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryReferent(m_server, &rv);
if (NS_FAILED(rv) || !imapServer) return;
if (allPattern.Length())
if (!allPattern.IsEmpty())
{
imapServer->SetDoingLsub(PR_TRUE);
Lsub(allPattern.get(), PR_TRUE); // LSUB all the subscribed
}
if (topLevelPattern.Length())
if (!topLevelPattern.IsEmpty())
{
imapServer->SetDoingLsub(PR_FALSE);
List(topLevelPattern.get(), PR_TRUE); // LIST the top level
}
if (secondLevelPattern.Length())
if (!secondLevelPattern.IsEmpty())
{
imapServer->SetDoingLsub(PR_FALSE);
List(secondLevelPattern.get(), PR_TRUE); // LIST the second level
@ -7035,7 +7035,7 @@ void nsImapProtocol::SetupMessageFlagsString(nsCString& flagString,
flagString.Append(" ");
}
// eat the last space
if (flagString.Length() > 0)
if (!flagString.IsEmpty())
flagString.SetLength(flagString.Length()-1);
}
@ -7836,7 +7836,7 @@ nsresult nsImapMockChannel::ReadFromMemCache(nsICacheEntryDescriptor *entry)
if (entryKey.FindChar('?') != kNotFound)
{
entry->GetMetaDataElement("contentType", getter_Copies(contentType));
if (contentType.Length() > 0)
if (!contentType.IsEmpty())
SetContentType(contentType);
shouldUseCacheEntry = PR_TRUE;
}

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

@ -420,7 +420,7 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
}
else if (!PL_strcasecmp(commandToken, "FETCH"))
{
if (fZeroLengthMessageUidString.Length())
if (!fZeroLengthMessageUidString.IsEmpty())
{
// "Deleting zero length message");
fServerConnection.Store(fZeroLengthMessageUidString.get(), "+Flags (\\Deleted)", PR_TRUE);
@ -1199,13 +1199,10 @@ void nsImapServerResponseParser::msg_fetch()
char uidString[100];
sprintf(uidString, "%ld", (long)CurrentResponseUID());
if (!fZeroLengthMessageUidString.Length())
fZeroLengthMessageUidString = uidString;
else
{
if (!fZeroLengthMessageUidString.IsEmpty())
fZeroLengthMessageUidString += ",";
fZeroLengthMessageUidString += uidString;
}
fZeroLengthMessageUidString += uidString;
}
// if this token ends in ')', then it is the last token
@ -1379,7 +1376,7 @@ void nsImapServerResponseParser::envelope_data()
nsCAutoString address;
parse_address(address);
headerLine += address;
if (address.Length() == 0)
if (address.IsEmpty())
headerNonNil = PR_FALSE;
}
if (headerNonNil)

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

@ -365,7 +365,7 @@ nsresult
nsImapMoveCopyMsgTxn::AddDstKey(nsMsgKey aKey)
{
m_dstKeyArray.Add(aKey);
if (m_dstMsgIdString.Length() > 0)
if (!m_dstMsgIdString.IsEmpty())
m_dstMsgIdString.Append(",");
m_dstMsgIdString.AppendInt((PRInt32) aKey);
return NS_OK;

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

@ -1038,7 +1038,7 @@ NS_IMETHODIMP nsImapUrl::AllocateCanonicalPath(const char *serverPath, char onli
// If this host has an online server directory configured
onlineDir = (char *)(!aString.IsEmpty() ? ToNewCString(aString) : nsnull);
if (currentPath && onlineDir.Length() > 0)
if (currentPath && !onlineDir.IsEmpty())
{
// By definition, the online dir must be at the root.
if (delimiterToUse && delimiterToUse != kOnlineHierarchySeparatorUnknown)

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

@ -437,7 +437,7 @@ PRBool CAliasData::Process( const char *pLine, PRInt32 len)
if (*pLine == '"') {
if (tCnt && !endCollect) {
str.Trim( kWhitespace);
if (str.Length())
if (!str.IsEmpty())
str.Append( " ", 1);
str.Append( pStart, tCnt);
}
@ -453,7 +453,7 @@ PRBool CAliasData::Process( const char *pLine, PRInt32 len)
else if (*pLine == '<') {
if (tCnt && !endCollect) {
str.Trim( kWhitespace);
if (str.Length())
if (!str.IsEmpty())
str.Append( " ", 1);
str.Append( pStart, tCnt);
}
@ -470,7 +470,7 @@ PRBool CAliasData::Process( const char *pLine, PRInt32 len)
else if (*pLine == '(') {
if (tCnt && !endCollect) {
str.Trim( kWhitespace);
if (str.Length())
if (!str.IsEmpty())
str.Append( " ", 1);
str.Append( pStart, tCnt);
}
@ -495,27 +495,27 @@ PRBool CAliasData::Process( const char *pLine, PRInt32 len)
if (tCnt) {
str.Trim( kWhitespace);
if (str.Length())
if (!str.IsEmpty())
str.Append( " ", 1);
str.Append( pStart, tCnt);
}
str.Trim( kWhitespace);
if (m_realName.Length() && m_email.Length())
if (!m_realName.IsEmpty() && !m_email.IsEmpty())
return( PR_TRUE);
// now we should have a string with any remaining non-delimitted text
// we assume that the last token is the email
// anything before that is realName
if (m_email.Length()) {
if (!m_email.IsEmpty()) {
m_realName = str;
return( PR_TRUE);
}
tCnt = str.RFindChar( ' ');
if (tCnt == -1) {
if (str.Length()) {
if (!str.IsEmpty()) {
m_email = str;
return( PR_TRUE);
}
@ -527,7 +527,7 @@ PRBool CAliasData::Process( const char *pLine, PRInt32 len)
m_realName.Trim( kWhitespace);
m_email.Trim( kWhitespace);
return( (m_email.Length() != 0));
return( !m_email.IsEmpty());
}
#ifdef IMPORT_DEBUG
@ -738,7 +738,7 @@ void nsEudoraAddress::AddSingleCard( CAliasEntry *pEntry, nsVoidArray &emailList
nsCString addressWK, address2WK, cityWK, stateWK, zipWK, countryWK;
nsCString note(pEntry->m_notes);
if (note.Length() > 0)
if (!note.IsEmpty())
{
ExtractNoteField( note, fax, "fax");
ExtractNoteField( note, phone, "phone");

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

@ -598,13 +598,13 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
nsString charSet;
nsString headerVal;
GetHeaderValue( m_pHeaders, m_headerLen, "From:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetFrom( headerVal.get());
GetHeaderValue( m_pHeaders, m_headerLen, "To:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetTo( headerVal.get());
GetHeaderValue( m_pHeaders, m_headerLen, "Subject:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetSubject( headerVal.get());
GetHeaderValue( m_pHeaders, m_headerLen, "Content-type:", headerVal);
bodyType = headerVal;
@ -613,12 +613,12 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
// Use platform charset as default if the msg doesn't specify one
// (ie, no 'charset' param in the Content-Type: header). As the last
// resort we'll use the mail defaul charset.
if (! headerVal.Length())
if (headerVal.IsEmpty())
{
headerVal.AssignWithConversion(nsMsgI18NFileSystemCharset());
if (! headerVal.Length())
if (headerVal.IsEmpty())
{ // last resort
if (!m_defCharset.Length())
if (m_defCharset.IsEmpty())
{
nsXPIDLString defaultCharset;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
@ -632,18 +632,18 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
m_pMsgFields->SetCharacterSet( NS_LossyConvertUCS2toASCII(headerVal).get() );
charSet = headerVal;
GetHeaderValue( m_pHeaders, m_headerLen, "CC:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetCc( headerVal.get());
GetHeaderValue( m_pHeaders, m_headerLen, "Message-ID:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetMessageId( NS_LossyConvertUCS2toASCII(headerVal).get() );
GetHeaderValue( m_pHeaders, m_headerLen, "Reply-To:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetReplyTo( headerVal.get());
// what about all of the other headers?!?!?!?!?!?!
char *pMimeType = nsnull;
if (bodyType.Length())
if (!bodyType.IsEmpty())
pMimeType = ToNewCString(bodyType);
// IMPORT_LOG0( "Outlook compose calling CreateAndSendMessage\n");
@ -1083,7 +1083,7 @@ nsresult nsEudoraCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCopi
do {
GetNthHeader( m_pHeaders, m_headerLen, n, header, val, PR_FALSE);
// GetNthHeader( newHeaders.m_pBuffer, newHeaders.m_writeOffset, n, header, val, PR_FALSE);
if (header.Length()) {
if (!header.IsEmpty()) {
if ((specialHeader = IsSpecialHeader( header.get())) != -1) {
header.Append( ':');
GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE);
@ -1095,10 +1095,10 @@ nsresult nsEudoraCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCopi
header.Append( ':');
GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), replaceVal, PR_FALSE);
header.Truncate( header.Length() - 1);
if (replaceVal.Length())
if (!replaceVal.IsEmpty())
val = replaceVal;
}
if (val.Length()) {
if (!val.IsEmpty()) {
// See if we're writing out a Date: header.
if (!nsCRT::strcasecmp(header.get(), "Date"))
hasDateHeader = PR_TRUE;
@ -1113,7 +1113,7 @@ nsresult nsEudoraCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCopi
}
}
n++;
} while (NS_SUCCEEDED( rv) && (header.Length() != 0));
} while (NS_SUCCEEDED( rv) && !header.IsEmpty());
// If we don't have Date: header so far then use the default one (taken from Eudora "From " line).
if (!hasDateHeader)
@ -1129,7 +1129,7 @@ nsresult nsEudoraCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCopi
header.Append( ':');
GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE);
header.Truncate( header.Length() - 1);
if (val.Length()) {
if (!val.IsEmpty()) {
rv = pDst->Write( header.get(), header.Length(), &written);
if (NS_SUCCEEDED( rv))
rv = pDst->Write( ": ", 2, &written);

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

@ -383,7 +383,7 @@ nsresult nsEudoraWin32::ScanDescmap( nsIFileSpec *pFolder, nsISupportsArray *pAr
IMPORT_LOG2( "name: %s, fName: %s\n", name.get(), fName.get());
if (fName.Length() && name.Length() && (type.Length() == 1)) {
if (!fName.IsEmpty() && !name.IsEmpty() && (type.Length() == 1)) {
entry->FromFileSpec( pFolder);
rv = entry->AppendRelativeUnixPath( fName.get());
if (NS_SUCCEEDED( rv)) {
@ -583,7 +583,7 @@ PRBool nsEudoraWin32::ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **loc
nsIMsgAccount * pAccount;
do {
if (sectionName.Length()) {
if (!sectionName.IsEmpty()) {
pAccount = nsnull;
valInt = ::GetPrivateProfileInt( sectionName.get(), "UsesPOP", 1, iniPath.get());
if (valInt) {
@ -721,7 +721,7 @@ PRBool nsEudoraWin32::BuildPOPAccount( nsIMsgAccountManager *accMgr, const char
GetServerAndUserName( pSection, pIni, serverName, userName, valBuff);
if (!serverName.Length() || !userName.Length())
if (serverName.IsEmpty() || userName.IsEmpty())
return( PR_FALSE);
PRBool result = PR_FALSE;
@ -783,7 +783,7 @@ PRBool nsEudoraWin32::BuildIMAPAccount( nsIMsgAccountManager *accMgr, const char
GetServerAndUserName( pSection, pIni, serverName, userName, valBuff);
if (!serverName.Length() || !userName.Length())
if (serverName.IsEmpty() || userName.IsEmpty())
return( PR_FALSE);
PRBool result = PR_FALSE;
@ -857,7 +857,7 @@ void nsEudoraWin32::SetIdentities(nsIMsgAccountManager *accMgr, nsIMsgAccount *a
fullName.AssignWithConversion(realName.get());
id->SetFullName( fullName.get());
id->SetIdentityName( fullName.get());
if (email.Length() == 0) {
if (email.IsEmpty()) {
email = userName;
email += "@";
email += serverName;
@ -927,7 +927,7 @@ nsresult nsEudoraWin32::GetAttachmentInfo( const char *pFileName, nsIFileSpec *p
GetMimeTypeFromExtension( ext, mimeType);
}
}
if (!mimeType.Length())
if (mimeType.IsEmpty())
mimeType = "application/octet-stream";
return( NS_OK);
@ -1022,7 +1022,7 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp
::RegCloseKey( sKey);
}
if (mimeType.Length() || !m_mailImportLocation || (ext.Length() > 10))
if (!mimeType.IsEmpty() || !m_mailImportLocation || (ext.Length() > 10))
return;
// TLR: FIXME: We should/could cache the extension to mime type maps we find
@ -1127,7 +1127,7 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp
tStr.Truncate();
tStr.Append( pStart, len);
tStr.Trim( kWhitespace);
if (!tStr.Length()) continue;
if (tStr.IsEmpty()) continue;
mimeType.Truncate();
mimeType.Append( tStr.get());
mimeType.Append( "/");
@ -1141,7 +1141,7 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp
tStr.Truncate();
tStr.Append( pStart, len);
tStr.Trim( kWhitespace);
if (!tStr.Length()) continue;
if (tStr.IsEmpty()) continue;
mimeType.Append( tStr.get());
IMPORT_LOG1( "Found Mime Type: %s\n", mimeType.get());
@ -1261,7 +1261,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFileSpec *pRoot, nsISupportsArray *
while ((idx = dirs.FindChar( ';')) != -1) {
dirs.Left( currentDir, idx);
currentDir.Trim( kWhitespace);
if (currentDir.Length()) {
if (!currentDir.IsEmpty()) {
rv = spec->SetNativePath( currentDir.get());
exists = PR_FALSE;
isDir = PR_FALSE;
@ -1278,7 +1278,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFileSpec *pRoot, nsISupportsArray *
dirs = currentDir;
dirs.Trim( kWhitespace);
}
if (dirs.Length()) {
if (!dirs.IsEmpty()) {
rv = spec->SetNativePath( dirs.get());
exists = PR_FALSE;
isDir = PR_FALSE;

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

@ -796,7 +796,7 @@ void nsOEScanBoxes::BuildMailboxList( MailboxEntry *pBox, nsIFileSpec * root, PR
pID->SetDepth( depth);
pID->SetIdentifier( pBox->index);
pID->SetDisplayName( (PRUnichar *)pBox->mailName.get());
if (pBox->fileName.Length() > 0) {
if (!pBox->fileName.IsEmpty()) {
pID->GetFileSpec( &file);
file->FromFileSpec( root);
file->AppendRelativeUnixPath( pBox->fileName.get());

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

@ -593,13 +593,13 @@ nsresult nsOutlookCompose::SendTheMessage( nsIFileSpec *pMsg, nsMsgDeliverMode m
nsCAutoString asciiHeaderVal;
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "From:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetFrom( headerVal.get());
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "To:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetTo( headerVal.get());
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "Subject:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetSubject( headerVal.get());
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "Content-type:", headerVal);
@ -630,20 +630,20 @@ nsresult nsOutlookCompose::SendTheMessage( nsIFileSpec *pMsg, nsMsgDeliverMode m
m_pMsgFields->SetCharacterSet( NS_LossyConvertUCS2toASCII(headerVal).get() );
charSet = headerVal;
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "CC:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetCc( headerVal.get());
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "Message-ID:", headerVal);
if (headerVal.Length()) {
if (!headerVal.IsEmpty()) {
asciiHeaderVal.AssignWithConversion(headerVal);
m_pMsgFields->SetMessageId(asciiHeaderVal.get());
}
GetHeaderValue( m_Headers.get(), m_Headers.Length(), "Reply-To:", headerVal);
if (headerVal.Length())
if (!headerVal.IsEmpty())
m_pMsgFields->SetReplyTo( headerVal.get());
// what about all of the other headers?!?!?!?!?!?!
char *pMimeType = nsnull;
if (bodyType.Length())
if (!bodyType.IsEmpty())
pMimeType = ToNewCString(bodyType);
// IMPORT_LOG0( "Outlook compose calling CreateAndSendMessage\n");
@ -1023,7 +1023,7 @@ nsresult nsOutlookCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCop
do {
GetNthHeader( m_Headers.get(), m_Headers.Length(), n, header, val, PR_FALSE);
// GetNthHeader( newHeaders.m_pBuffer, newHeaders.m_writeOffset, n, header.get(), val, PR_FALSE);
if (header.Length()) {
if (!header.IsEmpty()) {
if ((specialHeader = IsSpecialHeader( header.get())) != -1) {
header.Append( ':');
GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE);
@ -1039,10 +1039,10 @@ nsresult nsOutlookCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCop
header.Append( ':');
GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), replaceVal, PR_FALSE);
header.Truncate( header.Length() - 1);
if (replaceVal.Length())
if (!replaceVal.IsEmpty())
val = replaceVal;
}
if (val.Length()) {
if (!val.IsEmpty()) {
rv = pDst->Write( header.get(), header.Length(), &written);
if (NS_SUCCEEDED( rv))
rv = pDst->Write( ": ", 2, &written);
@ -1054,7 +1054,7 @@ nsresult nsOutlookCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCop
}
}
n++;
} while (NS_SUCCEEDED( rv) && (header.Length() != 0));
} while (NS_SUCCEEDED( rv) && !header.IsEmpty());
for (i = 0; (i < kMaxSpecialHeaders) && NS_SUCCEEDED( rv); i++) {
if (!specials[i]) {
@ -1062,7 +1062,7 @@ nsresult nsOutlookCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCop
header.Append( ':');
GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE);
header.Truncate( header.Length() - 1);
if (val.Length()) {
if (!val.IsEmpty()) {
rv = pDst->Write( header.get(), header.Length(), &written);
if (NS_SUCCEEDED( rv))
rv = pDst->Write( ": ", 2, &written);

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

@ -496,7 +496,7 @@ nsresult nsTextAddress::ProcessLine( const char *pLine, PRInt32 len, nsString& e
rv = m_fieldMap->GetFieldActive( i, &active);
if (NS_SUCCEEDED( rv) && active) {
if (GetField( pLine, len, i, fieldVal, m_delim)) {
if (fieldVal.Length()) {
if (!fieldVal.IsEmpty()) {
if (!newRow) {
rv = m_database->GetNewRow( &newRow);
if (NS_FAILED( rv)) {
@ -889,7 +889,7 @@ nsresult nsTextAddress::ParseLdifFile( nsIFileSpec *pSrc, PRUint32 *pProgress)
while (NS_SUCCEEDED(GetLdifStringRecord(buf, len, startPos)))
{
if (m_ldifLine.Find("groupOfNames") == -1)
if (m_ldifLine.Find("groupOfNames") == kNotFound)
AddLdifRowToDatabase(PR_FALSE);
else
{
@ -905,7 +905,7 @@ nsresult nsTextAddress::ParseLdifFile( nsIFileSpec *pSrc, PRUint32 *pProgress)
}
}
//last row
if (m_ldifLine.Length() > 0 && m_ldifLine.Find("groupOfNames") == -1)
if (!m_ldifLine.IsEmpty() && m_ldifLine.Find("groupOfNames") == kNotFound)
AddLdifRowToDatabase(PR_FALSE);
// mail Lists
@ -929,7 +929,7 @@ nsresult nsTextAddress::ParseLdifFile( nsIFileSpec *pSrc, PRUint32 *pProgress)
while (NS_SUCCEEDED(GetLdifStringRecord(listBuf, len, startPos)))
{
if (m_ldifLine.Find("groupOfNames") != -1)
if (m_ldifLine.Find("groupOfNames") != kNotFound)
{
AddLdifRowToDatabase(PR_TRUE);
if (NS_SUCCEEDED(pSrc->Seek(0)))
@ -993,7 +993,7 @@ void nsTextAddress::AddLdifRowToDatabase(PRBool bIsList)
void nsTextAddress::ClearLdifRecordBuffer()
{
if (m_ldifLine.Length() > 0)
if (!m_ldifLine.IsEmpty())
{
m_ldifLine.Truncate();
m_LFCount = 0;

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

@ -881,7 +881,7 @@ nsMsgLocalMailFolder::CreateSubfolder(const PRUnichar *folderName, nsIMsgWindow
nsXPIDLCString nativeFolderName;
rv = ConvertFromUnicode(nsMsgI18NFileSystemCharset(), nsAutoString(folderName),
getter_Copies(nativeFolderName));
if (NS_FAILED(rv) || (nativeFolderName.Length() == 0)) {
if (NS_FAILED(rv) || nativeFolderName.IsEmpty()) {
ThrowAlertMsg("folderCreationFailed", msgWindow);
// I'm returning this value so the dialog stays up
return NS_MSG_FOLDER_EXISTS;

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

@ -187,7 +187,7 @@ nsLocalMoveCopyMsgTxn::UndoImapDeleteFlag(nsIMsgFolder* folder,
for (i=0; i < count; i++)
{
if (msgIds.Length() > 0)
if (!msgIds.IsEmpty())
msgIds.Append(',');
msgIds.AppendInt((PRInt32) keyArray.GetAt(i));
}

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

@ -82,7 +82,7 @@ nsresult nsPop3URL::GetPop3Sink(nsIPop3Sink** aPop3Sink)
NS_IMETHODIMP
nsPop3URL::GetMessageUri(char ** aMessageUri)
{
if(!aMessageUri || m_messageUri.Length() == 0)
if(!aMessageUri || m_messageUri.IsEmpty())
return NS_ERROR_NULL_POINTER;
*aMessageUri = ToNewCString(m_messageUri);
return NS_OK;

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

@ -443,19 +443,19 @@ nsresult nsMapiHook::PopulateCompFields(lpnsMapiMessage aMessage,
switch (aMessage->lpRecips[i].ulRecipClass)
{
case MAPI_TO :
if (To.Length() > 0)
if (!To.IsEmpty())
To += Comma ;
To += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
break ;
case MAPI_CC :
if (Cc.Length() > 0)
if (!Cc.IsEmpty())
Cc += Comma ;
Cc += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
Cc += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
break ;
case MAPI_BCC :
if (Bcc.Length() > 0)
if (!Bcc.IsEmpty())
Bcc += Comma ;
Bcc += (PRUnichar *) aMessage->lpRecips[i].lpszAddress ;
break ;
@ -681,19 +681,19 @@ nsresult nsMapiHook::PopulateCompFieldsWithConversion(lpnsMapiMessage aMessage,
switch (aMessage->lpRecips[i].ulRecipClass)
{
case MAPI_TO :
if (To.Length() > 0)
if (!To.IsEmpty())
To += Comma ;
To.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress);
break ;
case MAPI_CC :
if (Cc.Length() > 0)
if (!Cc.IsEmpty())
Cc += Comma ;
Cc.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress);
Cc.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress);
break ;
case MAPI_BCC :
if (Bcc.Length() > 0)
if (!Bcc.IsEmpty())
Bcc += Comma ;
Bcc.AppendWithConversion ((char *) aMessage->lpRecips[i].lpszAddress) ;
break ;
@ -777,7 +777,7 @@ nsresult nsMapiHook::PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompField
nsCString Attachments ;
// only 1 file is to be sent, no delim specified
if ((!strDelimChars.Length()) && (strFilePaths.Length()>0))
if (strDelimChars.IsEmpty() && !strFilePaths.IsEmpty())
{
nsCOMPtr <nsILocalFile> pFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv) ;
if (NS_FAILED(rv) || (!pFile) ) return rv ;
@ -830,7 +830,7 @@ nsresult nsMapiHook::PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompField
NS_GetURLSpecFromFile(pFile, pURL);
if (!pURL.IsEmpty())
{
if (Attachments.Length() > 0)
if (!Attachments.IsEmpty())
Attachments.Append(",") ;
Attachments.Append(pURL) ;
}

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

@ -701,7 +701,7 @@ nsJAR::ParseOneFile(nsISignatureVerifier* verifier,
curItemSF->status = mGlobalStatus;
if (curItemSF->status == nsIJAR::VALID)
{ // Compare digests
if (storedSectionDigest.Length() == 0)
if (storedSectionDigest.IsEmpty())
curItemSF->status = nsIJAR::NOT_SIGNED;
else
{

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

@ -135,7 +135,7 @@ NS_IMETHODIMP
nsSimpleURI::SetSpec(const nsACString &aSpec)
{
nsCAutoString spec;
if (aSpec.Length() == 0) {
if (aSpec.IsEmpty()) {
mScheme.Truncate();
mPath.Truncate();
return NS_OK;

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

@ -1505,7 +1505,7 @@ nsStandardURL::Resolve(const nsACString &in, nsACString &out)
nsCAutoString buf;
relpath = FilterString(relpath, buf);
// Calculate the new relpath length if FilterString modified it
const PRInt32 relpathLen = buf.Length() != 0 ?
const PRInt32 relpathLen = !buf.IsEmpty() ?
buf.Length() : flat.Length();
// XXX hack hack hack
char *p = nsnull;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше