diff --git a/mozilla/caps/src/nsBasePrincipal.cpp b/mozilla/caps/src/nsBasePrincipal.cpp index 1c8fd220596..71e7b75c9cd 100644 --- a/mozilla/caps/src/nsBasePrincipal.cpp +++ b/mozilla/caps/src/nsBasePrincipal.cpp @@ -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); diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index da716564b6d..1f1a8cfceea 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -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; diff --git a/mozilla/content/base/src/nsScriptLoader.cpp b/mozilla/content/base/src/nsScriptLoader.cpp index 6600910dc06..916c1fad3c6 100644 --- a/mozilla/content/base/src/nsScriptLoader.cpp +++ b/mozilla/content/base/src/nsScriptLoader.cpp @@ -705,7 +705,7 @@ DetectByteOrderMark(const unsigned char* aBytes, PRInt32 aLen, nsString& oCharse } break; } // switch - return oCharset.Length() > 0; + return !oCharset.IsEmpty(); } diff --git a/mozilla/directory/xpcom/base/src/nsLDAPURL.cpp b/mozilla/directory/xpcom/base/src/nsLDAPURL.cpp index e4ab32fbf32..9a0e2843e13 100644 --- a/mozilla/directory/xpcom/base/src/nsLDAPURL.cpp +++ b/mozilla/directory/xpcom/base/src/nsLDAPURL.cpp @@ -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); } diff --git a/mozilla/docshell/base/nsDefaultURIFixup.cpp b/mozilla/docshell/base/nsDefaultURIFixup.cpp index e715941f123..bfba2d17558 100644 --- a/mozilla/docshell/base/nsDefaultURIFixup.cpp +++ b/mozilla/docshell/base/nsDefaultURIFixup.cpp @@ -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); } diff --git a/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp b/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp index 3c170894fb4..1db8b0eac23 100644 --- a/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp +++ b/mozilla/editor/libeditor/base/SetDocTitleTxn.cpp @@ -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 textNode; res = domDoc->CreateTextNode(aTitle, getter_AddRefs(textNode)); diff --git a/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp b/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp index a642520859b..4a89c5e97ca 100644 --- a/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -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; } diff --git a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp index c051c352cab..2f686fb0ba1 100644 --- a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -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: diff --git a/mozilla/editor/libeditor/html/nsHTMLEditUtils.cpp b/mozilla/editor/libeditor/html/nsHTMLEditUtils.cpp index ded7b69e454..deedff3da7e 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditUtils.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditUtils.cpp @@ -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; diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 10e8a314786..920718ac4d4 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -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; diff --git a/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp b/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp index 8e647908a6b..bd7bdbabe94 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditorStyle.cpp @@ -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; } diff --git a/mozilla/editor/libeditor/text/nsInternetCiter.cpp b/mozilla/editor/libeditor/text/nsInternetCiter.cpp index b20fb8655e8..67fc41e56ac 100644 --- a/mozilla/editor/libeditor/text/nsInternetCiter.cpp +++ b/mozilla/editor/libeditor/text/nsInternetCiter.cpp @@ -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); diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp index fb1b8b52edf..357a9bf9b42 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp @@ -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); diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp index 68920723367..1b11a68c223 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -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(); diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index bc598c4f831..78eaf0004e1 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -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 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 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)) diff --git a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index d735c4eb01e..c4a69293638 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -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; diff --git a/mozilla/embedding/lite/nsEmbedChromeRegistry.cpp b/mozilla/embedding/lite/nsEmbedChromeRegistry.cpp index 8f2475446ef..325302a1989 100644 --- a/mozilla/embedding/lite/nsEmbedChromeRegistry.cpp +++ b/mozilla/embedding/lite/nsEmbedChromeRegistry.cpp @@ -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; diff --git a/mozilla/extensions/sql/base/src/mozSqlResult.cpp b/mozilla/extensions/sql/base/src/mozSqlResult.cpp index 7e46612bec7..c3c4bc51715 100644 --- a/mozilla/extensions/sql/base/src/mozSqlResult.cpp +++ b/mozilla/extensions/sql/base/src/mozSqlResult.cpp @@ -657,7 +657,7 @@ mozSqlResult::ClearRows() nsresult mozSqlResult::EnsureTableName() { - if (mTableName.Length() > 0) + if (!mTableName.IsEmpty()) return NS_OK; nsAString::const_iterator start, end; diff --git a/mozilla/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp b/mozilla/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp index 7474c07cefc..052db7c5d9d 100644 --- a/mozilla/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp +++ b/mozilla/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp @@ -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('\'')); } diff --git a/mozilla/extensions/wallet/src/nsBasicStreamGenerator.cpp b/mozilla/extensions/wallet/src/nsBasicStreamGenerator.cpp index b5a16ae5807..f855d44f81f 100644 --- a/mozilla/extensions/wallet/src/nsBasicStreamGenerator.cpp +++ b/mozilla/extensions/wallet/src/nsBasicStreamGenerator.cpp @@ -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 weakPasswordSink = do_QueryReferent(mWeakPasswordSink); if (!weakPasswordSink) { diff --git a/mozilla/extensions/wallet/src/singsign.cpp b/mozilla/extensions/wallet/src/singsign.cpp index 17c03f974d2..a55d7257133 100644 --- a/mozilla/extensions/wallet/src/singsign.cpp +++ b/mozilla/extensions/wallet/src/singsign.cpp @@ -1612,7 +1612,7 @@ si_PutData(const char *passwordRealm, nsVoidArray *signonData, PRBool save) { PRInt32 count = signonData->Count(); for (PRInt32 i=0; iElementAt(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; } diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp index b4fef8d8d85..1d79a914f79 100644 --- a/mozilla/extensions/wallet/src/wallet.cpp +++ b/mozilla/extensions/wallet/src/wallet.cpp @@ -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; iElementAt(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; diff --git a/mozilla/extensions/webservices/schema/src/nsSchemaLoader.cpp b/mozilla/extensions/webservices/schema/src/nsSchemaLoader.cpp index 21d96d197eb..181a25c49fa 100644 --- a/mozilla/extensions/webservices/schema/src/nsSchemaLoader.cpp +++ b/mozilla/extensions/webservices/schema/src/nsSchemaLoader.cpp @@ -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 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 itemType; - if (itemTypeStr.Length() > 0) { + if (!itemTypeStr.IsEmpty()) { nsCOMPtr type; rv = GetNewOrUsedType(aSchema, aElement, itemTypeStr, getter_AddRefs(type)); @@ -2273,7 +2273,7 @@ nsSchemaLoader::ProcessSimpleTypeUnion(nsSchema* aSchema, nsCOMPtr memberType; nsAutoString memberTypes; aElement->GetAttribute(NS_LITERAL_STRING("memberTypes"), memberTypes); - if (memberTypes.Length() > 0) { + if (!memberTypes.IsEmpty()) { nsReadingIterator 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 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; } diff --git a/mozilla/extensions/webservices/soap/src/nsSOAPCall.cpp b/mozilla/extensions/webservices/soap/src/nsSOAPCall.cpp index 1987c730d1f..a4f64be20ba 100644 --- a/mozilla/extensions/webservices/soap/src/nsSOAPCall.cpp +++ b/mozilla/extensions/webservices/soap/src/nsSOAPCall.cpp @@ -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."); } diff --git a/mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.cpp b/mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.cpp index 8a03a42f45a..7fbabafa04c 100644 --- a/mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.cpp +++ b/mozilla/extensions/webservices/soap/src/nsSOAPHeaderBlock.cpp @@ -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)) diff --git a/mozilla/extensions/xmlterm/base/mozLineTerm.cpp b/mozilla/extensions/xmlterm/base/mozLineTerm.cpp index 503a54ca837..b7820ab6707 100644 --- a/mozilla/extensions/xmlterm/base/mozLineTerm.cpp +++ b/mozilla/extensions/xmlterm/base/mozLineTerm.cpp @@ -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("\n", temStr); nsMemory::Free(temStr); diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermListeners.cpp b/mozilla/extensions/xmlterm/base/mozXMLTermListeners.cpp index f75443b5471..e2e5838a4a4 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermListeners.cpp +++ b/mozilla/extensions/xmlterm/base/mozXMLTermListeners.cpp @@ -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 domDocument; result = mXMLTerminal->GetDocument(getter_AddRefs(domDocument)); diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp b/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp index 236d65a7b52..77350a2acfc 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp +++ b/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp @@ -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 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 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); diff --git a/mozilla/gfx/src/mac/nsDeviceContextMac.cpp b/mozilla/gfx/src/mac/nsDeviceContextMac.cpp index 859ef43f5a2..c2fd50d23c3 100644 --- a/mozilla/gfx/src/mac/nsDeviceContextMac.cpp +++ b/mozilla/gfx/src/mac/nsDeviceContextMac.cpp @@ -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] ); } diff --git a/mozilla/gfx/src/nsDeviceContext.cpp b/mozilla/gfx/src/nsDeviceContext.cpp index c19cc0138a5..c4be6c7bb3f 100644 --- a/mozilla/gfx/src/nsDeviceContext.cpp +++ b/mozilla/gfx/src/nsDeviceContext.cpp @@ -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); diff --git a/mozilla/gfx/src/nsFont.cpp b/mozilla/gfx/src/nsFont.cpp index 5923ad16799..7289f96d8b2 100644 --- a/mozilla/gfx/src/nsFont.cpp +++ b/mozilla/gfx/src/nsFont.cpp @@ -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); } diff --git a/mozilla/gfx/src/nsPrintOptionsImpl.cpp b/mozilla/gfx/src/nsPrintOptionsImpl.cpp index cd82810ee32..2281513aa9c 100644 --- a/mozilla/gfx/src/nsPrintOptionsImpl.cpp +++ b/mozilla/gfx/src/nsPrintOptionsImpl.cpp @@ -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); } diff --git a/mozilla/gfx/src/nsPrintSettingsImpl.cpp b/mozilla/gfx/src/nsPrintSettingsImpl.cpp index 3c65182f736..baced5ea7fe 100644 --- a/mozilla/gfx/src/nsPrintSettingsImpl.cpp +++ b/mozilla/gfx/src/nsPrintSettingsImpl.cpp @@ -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; diff --git a/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp b/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp index 46c3e108c7a..0fd7457163b 100644 --- a/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp +++ b/mozilla/gfx/src/os2/nsFontMetricsOS2.cpp @@ -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); } diff --git a/mozilla/gfx/src/ps/nsFontMetricsPS.cpp b/mozilla/gfx/src/ps/nsFontMetricsPS.cpp index 7d6562a5ced..1cb593ed7e5 100644 --- a/mozilla/gfx/src/ps/nsFontMetricsPS.cpp +++ b/mozilla/gfx/src/ps/nsFontMetricsPS.cpp @@ -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 diff --git a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp index 91b8093451f..892bdd9e6bf 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextWin.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextWin.cpp @@ -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); diff --git a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp index a360d81e39a..20e45d1e5fa 100644 --- a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp +++ b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp @@ -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); } diff --git a/mozilla/htmlparser/src/nsExpatDriver.cpp b/mozilla/htmlparser/src/nsExpatDriver.cpp index 5461f7ebc0d..711e426b17e 100644 --- a/mozilla/htmlparser/src/nsExpatDriver.cpp +++ b/mozilla/htmlparser/src/nsExpatDriver.cpp @@ -956,7 +956,7 @@ nsExpatDriver::CanParse(CParserContext& aParserContext, result=ePrimaryDetect; } else { - if (0 == aParserContext.mMimeType.Length() && + if (aParserContext.mMimeType.IsEmpty() && kNotFound != aBuffer.Find(" 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); } } diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index 2075731e705..b55ea8e9364 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -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 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, diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 5cf865da09f..469526c6858 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -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); diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 90d6057ba77..c411b9b9692 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -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); } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 388a11be86d..68eef45f445 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp index 0ed1d5be794..dba59377cd3 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -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(); diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index 060acd9cef9..83d96e8ff0a 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -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 diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 27a37283a9d..17edecd6876 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -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); diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index c78628b1280..8986d42e902 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -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; } } diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index db9e9cd4c65..b5710fa6d31 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -1606,7 +1606,7 @@ nsImageFrame::GetAnchorHREFAndTarget(nsString& aHref, nsString& aTarget) nsCOMPtr anchor(do_QueryInterface(content)); if (anchor) { anchor->GetHref(aHref); - if (aHref.Length() > 0) { + if (!aHref.IsEmpty()) { status = PR_TRUE; } anchor->GetTarget(aTarget); diff --git a/mozilla/layout/generic/nsImageMap.cpp b/mozilla/layout/generic/nsImageMap.cpp index 671778936e8..3fe1a6db189 100644 --- a/mozilla/layout/generic/nsImageMap.cpp +++ b/mozilla/layout/generic/nsImageMap.cpp @@ -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 { diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index f2bbfafb8b3..efb9ea8c09d 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -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 parent; nsCOMPtr domobject; nsCOMPtr domapplet; diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 12afd3b3b05..a611cc44268 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -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; diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 5cf865da09f..469526c6858 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -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); diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index db9e9cd4c65..b5710fa6d31 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -1606,7 +1606,7 @@ nsImageFrame::GetAnchorHREFAndTarget(nsString& aHref, nsString& aTarget) nsCOMPtr anchor(do_QueryInterface(content)); if (anchor) { anchor->GetHref(aHref); - if (aHref.Length() > 0) { + if (!aHref.IsEmpty()) { status = PR_TRUE; } anchor->GetTarget(aTarget); diff --git a/mozilla/layout/html/base/src/nsImageMap.cpp b/mozilla/layout/html/base/src/nsImageMap.cpp index 671778936e8..3fe1a6db189 100644 --- a/mozilla/layout/html/base/src/nsImageMap.cpp +++ b/mozilla/layout/html/base/src/nsImageMap.cpp @@ -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 { diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index f2bbfafb8b3..efb9ea8c09d 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -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 parent; nsCOMPtr domobject; nsCOMPtr domapplet; diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 12afd3b3b05..a611cc44268 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -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; diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 90d6057ba77..c411b9b9692 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -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); } diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index c78628b1280..8986d42e902 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -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; } } diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 388a11be86d..68eef45f445 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index 0ed1d5be794..dba59377cd3 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -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(); diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp index 060acd9cef9..83d96e8ff0a 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp @@ -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 diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 27a37283a9d..17edecd6876 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -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); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp index 039c2521499..89469dea942 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -426,7 +426,7 @@ nsMathMLmactionFrame::MouseClick(nsIDOMEvent* aMouseEvent) } } else if (NS_MATHML_ACTION_TYPE_RESTYLE == mActionType) { - if (0 < mRestyle.Length()) { + if (!mRestyle.IsEmpty()) { nsCOMPtr node( do_QueryInterface(mContent) ); if (node.get()) { if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index 32c1b79240b..abce31a1d01 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -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); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp index 421c19ac56f..0a1c235cb80 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfracFrame.cpp @@ -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; diff --git a/mozilla/layout/svg/base/src/nsSVGStroke.cpp b/mozilla/layout/svg/base/src/nsSVGStroke.cpp index 924e39059da..37558e3b4fb 100644 --- a/mozilla/layout/svg/base/src/nsSVGStroke.cpp +++ b/mozilla/layout/svg/base/src/nsSVGStroke.cpp @@ -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; diff --git a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp index d75c1d21772..82f520813ee 100644 --- a/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsImageBoxFrame.cpp @@ -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; } } diff --git a/mozilla/layout/xul/base/src/nsStackFrame.cpp b/mozilla/layout/xul/base/src/nsStackFrame.cpp index eb5758bdb21..1ba23efd875 100644 --- a/mozilla/layout/xul/base/src/nsStackFrame.cpp +++ b/mozilla/layout/xul/base/src/nsStackFrame.cpp @@ -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) { diff --git a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp index a8f7f97ea43..bb6bfb38b2a 100644 --- a/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp @@ -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 deviceContext; diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 8c1106b5245..59e451bc3e3 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -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; diff --git a/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp b/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp index c804692e282..69d69e6205f 100644 --- a/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp @@ -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")) ; diff --git a/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp b/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp index 0bd17362cef..696d1183ed4 100644 --- a/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp @@ -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 ; diff --git a/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp b/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp index 8b2c68d875e..1c3c7613268 100644 --- a/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp +++ b/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp @@ -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()); } diff --git a/mozilla/mailnews/addrbook/src/nsAddressBook.cpp b/mozilla/mailnews/addrbook/src/nsAddressBook.cpp index e020cb274d2..69dd25428ce 100644 --- a/mozilla/mailnews/addrbook/src/nsAddressBook.cpp +++ b/mozilla/mailnews/addrbook/src/nsAddressBook.cpp @@ -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; diff --git a/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp b/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp index d38730a1502..55ce1552d32 100644 --- a/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgFilterList.cpp @@ -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())) { diff --git a/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp b/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp index d0fd4be82d3..b3b85b539a9 100644 --- a/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp @@ -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) { diff --git a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp index 74b01c5ef82..76d678adc45 100644 --- a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp @@ -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); diff --git a/mozilla/mailnews/base/util/nsMsgI18N.cpp b/mozilla/mailnews/base/util/nsMsgI18N.cpp index 98739ee72ad..6d95bf19efd 100644 --- a/mozilla/mailnews/base/util/nsMsgI18N.cpp +++ b/mozilla/mailnews/base/util/nsMsgI18N.cpp @@ -102,7 +102,7 @@ nsresult nsMsgI18NConvertFromUnicode(const nsCString& aCharset, nsCOMPtr 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 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 platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv); diff --git a/mozilla/mailnews/base/util/nsMsgUtils.cpp b/mozilla/mailnews/base/util/nsMsgUtils.cpp index 22def72995b..ad23c8525ef 100644 --- a/mozilla/mailnews/base/util/nsMsgUtils.cpp +++ b/mozilla/mailnews/base/util/nsMsgUtils.cpp @@ -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); diff --git a/mozilla/mailnews/compose/src/nsSmtpService.cpp b/mozilla/mailnews/compose/src/nsSmtpService.cpp index a8e95402bd9..6d7fe24820e 100644 --- a/mozilla/mailnews/compose/src/nsSmtpService.cpp +++ b/mozilla/mailnews/compose/src/nsSmtpService.cpp @@ -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); diff --git a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp index b7b5591da97..de34d0b343c 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -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))) ; diff --git a/mozilla/mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp b/mozilla/mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp index 425d102a54c..eeae0ed071e 100644 --- a/mozilla/mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp @@ -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; diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp index bd36d1bd1c3..635103179ea 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp @@ -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 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 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); diff --git a/mozilla/mailnews/imap/src/nsImapProtocol.cpp b/mozilla/mailnews/imap/src/nsImapProtocol.cpp index b1ca8efbe3e..753c88497b5 100644 --- a/mozilla/mailnews/imap/src/nsImapProtocol.cpp +++ b/mozilla/mailnews/imap/src/nsImapProtocol.cpp @@ -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 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; } diff --git a/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp b/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp index 04daee492d4..2fa50617499 100644 --- a/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp +++ b/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp @@ -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) diff --git a/mozilla/mailnews/imap/src/nsImapUndoTxn.cpp b/mozilla/mailnews/imap/src/nsImapUndoTxn.cpp index a50a117c014..9fa8419e355 100644 --- a/mozilla/mailnews/imap/src/nsImapUndoTxn.cpp +++ b/mozilla/mailnews/imap/src/nsImapUndoTxn.cpp @@ -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; diff --git a/mozilla/mailnews/imap/src/nsImapUrl.cpp b/mozilla/mailnews/imap/src/nsImapUrl.cpp index 9a7897f7b25..9e445591a4d 100644 --- a/mozilla/mailnews/imap/src/nsImapUrl.cpp +++ b/mozilla/mailnews/imap/src/nsImapUrl.cpp @@ -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) diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp index 8391db44545..fab3bb3bc24 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp @@ -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"); diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp index 004c603c735..83460a180c6 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp @@ -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 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); diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp index ed51951b35b..bff63c0bbce 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp @@ -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; diff --git a/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp b/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp index aa906154e8b..09da8c7e2e3 100644 --- a/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp +++ b/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp @@ -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()); diff --git a/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp b/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp index 11102c0c76c..75a466c67c5 100644 --- a/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp +++ b/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp @@ -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); diff --git a/mozilla/mailnews/import/text/src/nsTextAddress.cpp b/mozilla/mailnews/import/text/src/nsTextAddress.cpp index 1b1d1e6f237..68631d43bb4 100644 --- a/mozilla/mailnews/import/text/src/nsTextAddress.cpp +++ b/mozilla/mailnews/import/text/src/nsTextAddress.cpp @@ -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; diff --git a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp index 6f137ea6cc0..5c797c7d8ba 100644 --- a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp @@ -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; diff --git a/mozilla/mailnews/local/src/nsLocalUndoTxn.cpp b/mozilla/mailnews/local/src/nsLocalUndoTxn.cpp index af3fb9ac318..903c386505a 100644 --- a/mozilla/mailnews/local/src/nsLocalUndoTxn.cpp +++ b/mozilla/mailnews/local/src/nsLocalUndoTxn.cpp @@ -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)); } diff --git a/mozilla/mailnews/local/src/nsPop3URL.cpp b/mozilla/mailnews/local/src/nsPop3URL.cpp index 01f960c7b58..ec184868a54 100644 --- a/mozilla/mailnews/local/src/nsPop3URL.cpp +++ b/mozilla/mailnews/local/src/nsPop3URL.cpp @@ -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; diff --git a/mozilla/mailnews/mapi/mapihook/src/msgMapiHook.cpp b/mozilla/mailnews/mapi/mapihook/src/msgMapiHook.cpp index ea117567c76..cbce2d2c9a7 100644 --- a/mozilla/mailnews/mapi/mapihook/src/msgMapiHook.cpp +++ b/mozilla/mailnews/mapi/mapihook/src/msgMapiHook.cpp @@ -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 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) ; } diff --git a/mozilla/modules/libjar/nsJAR.cpp b/mozilla/modules/libjar/nsJAR.cpp index 35426b4cfd0..ef0638c51aa 100644 --- a/mozilla/modules/libjar/nsJAR.cpp +++ b/mozilla/modules/libjar/nsJAR.cpp @@ -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 { diff --git a/mozilla/netwerk/base/src/nsSimpleURI.cpp b/mozilla/netwerk/base/src/nsSimpleURI.cpp index b8623ec02a4..f555edbab2d 100644 --- a/mozilla/netwerk/base/src/nsSimpleURI.cpp +++ b/mozilla/netwerk/base/src/nsSimpleURI.cpp @@ -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; diff --git a/mozilla/netwerk/base/src/nsStandardURL.cpp b/mozilla/netwerk/base/src/nsStandardURL.cpp index 970253c1cf0..9815201da34 100644 --- a/mozilla/netwerk/base/src/nsStandardURL.cpp +++ b/mozilla/netwerk/base/src/nsStandardURL.cpp @@ -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; diff --git a/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp b/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp index 79f844b53ea..a82d6d9b5a5 100644 --- a/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp +++ b/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp @@ -181,7 +181,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::GetMIMEType(char * *aMIMEType) { if (!aMIMEType) return NS_ERROR_NULL_POINTER; - if (mMIMEType.Length() < 1) + if (mMIMEType.IsEmpty()) return NS_ERROR_NOT_INITIALIZED; *aMIMEType = ToNewCString(mMIMEType); @@ -266,7 +266,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions ) mExtensions.AppendCString( ext ); extList.Cut(0, breakLocation+1 ); } - if ( extList.Length() ) + if ( !extList.IsEmpty() ) mExtensions.AppendCString( extList ); return NS_OK; } diff --git a/mozilla/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp b/mozilla/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp index 2232b1ef365..74ea4d10265 100644 --- a/mozilla/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp +++ b/mozilla/netwerk/protocol/keyword/src/nsKeywordProtocolHandler.cpp @@ -186,7 +186,7 @@ nsKeywordProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result) { nsresult rv; - NS_ASSERTION((mKeywordURL.Length() > 0), "someone's trying to use the keyword handler even though it hasn't been init'd"); + NS_ASSERTION(!mKeywordURL.IsEmpty(), "someone's trying to use the keyword handler even though it hasn't been init'd"); nsCAutoString path; rv = uri->GetPath(path); diff --git a/mozilla/netwerk/test/TestPageLoad.cpp b/mozilla/netwerk/test/TestPageLoad.cpp index 15050286ff8..c26284b3386 100644 --- a/mozilla/netwerk/test/TestPageLoad.cpp +++ b/mozilla/netwerk/test/TestPageLoad.cpp @@ -92,7 +92,7 @@ static NS_METHOD streamParse (nsIInputStream* in, int i = 0; char *tmp; - if(globalStream.Length() > 0) { + if(!globalStream.IsEmpty()) { globalStream.AppendWithConversion(fromRawSegment); tmp = ToNewCString(globalStream); //printf("\n>>NOW:\n^^^^^\n%s\n^^^^^^^^^^^^^^", tmp); diff --git a/mozilla/parser/htmlparser/src/nsExpatDriver.cpp b/mozilla/parser/htmlparser/src/nsExpatDriver.cpp index 5461f7ebc0d..711e426b17e 100644 --- a/mozilla/parser/htmlparser/src/nsExpatDriver.cpp +++ b/mozilla/parser/htmlparser/src/nsExpatDriver.cpp @@ -956,7 +956,7 @@ nsExpatDriver::CanParse(CParserContext& aParserContext, result=ePrimaryDetect; } else { - if (0 == aParserContext.mMimeType.Length() && + if (aParserContext.mMimeType.IsEmpty() && kNotFound != aBuffer.Find(" 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); } } diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index 2075731e705..b55ea8e9364 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -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 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, diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index 9f7ed62ce44..e61006c9df2 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -1906,7 +1906,7 @@ Fix4xCookies(nsIFileSpec * profilePath) { while (GetCookieLine(inStream,inBuffer) != -1){ /* skip line if it is a comment or null line */ - if (inBuffer.Length() == 0 || inBuffer.CharAt(0) == '#' || + if (inBuffer.IsEmpty() || inBuffer.CharAt(0) == '#' || inBuffer.CharAt(0) == nsCRT::CR || inBuffer.CharAt(0) == nsCRT::LF) { PutCookieLine(outStream, inBuffer); continue; diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index c0b7525cd95..17ab44233a0 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -459,7 +459,7 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract) GetProfileCount(&numProfiles); - if (profileURLStr.Length() == 0) + if (profileURLStr.IsEmpty()) { // If this flag is TRUE, it makes the multiple profile case // just like the single profile case - the profile will be @@ -515,7 +515,7 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract) profileURLStr = PROFILE_SELECTION_URL; } - if (profileURLStr.Length() != 0) + if (!profileURLStr.IsEmpty()) { if (!canInteract) return NS_ERROR_PROFILE_REQUIRES_INTERACTION; diff --git a/mozilla/profile/src/nsProfileAccess.cpp b/mozilla/profile/src/nsProfileAccess.cpp index d21f9e59e0a..d838d35147b 100644 --- a/mozilla/profile/src/nsProfileAccess.cpp +++ b/mozilla/profile/src/nsProfileAccess.cpp @@ -1503,7 +1503,7 @@ nsresult ProfileStruct::ExternalizeLocation(nsIRegistry *aRegistry, nsRegistryKe regData.get()); } - else if (regLocationData.Length() != 0) + else if (!regLocationData.IsEmpty()) { // Write the original data back out - maybe it can be resolved later. rv = aRegistry->SetString(profKey, diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index da716564b6d..1f1a8cfceea 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -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; diff --git a/mozilla/security/manager/ssl/src/nsOCSPResponder.cpp b/mozilla/security/manager/ssl/src/nsOCSPResponder.cpp index 47e34a6ae4c..0d32e247d5e 100644 --- a/mozilla/security/manager/ssl/src/nsOCSPResponder.cpp +++ b/mozilla/security/manager/ssl/src/nsOCSPResponder.cpp @@ -140,14 +140,14 @@ PRInt32 nsOCSPResponder::CompareEntries(nsIOCSPResponder *a, nsIOCSPResponder *b b->GetServiceURL(getter_Copies(bURL)); bURLAuto.Assign(bURL); - if (aURLAuto.Length() > 0 ) { - if (bURLAuto.Length() > 0) { + if (!aURLAuto.IsEmpty()) { + if (!bURLAuto.IsEmpty()) { return nsOCSPResponder::CmpCAName(a, b); } else { return -1; } } else { - if (bURLAuto.Length() > 0) { + if (!bURLAuto.IsEmpty()) { return 1; } else { return nsOCSPResponder::CmpCAName(a, b); diff --git a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp index 79f844b53ea..a82d6d9b5a5 100644 --- a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp +++ b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp @@ -181,7 +181,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::GetMIMEType(char * *aMIMEType) { if (!aMIMEType) return NS_ERROR_NULL_POINTER; - if (mMIMEType.Length() < 1) + if (mMIMEType.IsEmpty()) return NS_ERROR_NOT_INITIALIZED; *aMIMEType = ToNewCString(mMIMEType); @@ -266,7 +266,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions ) mExtensions.AppendCString( ext ); extList.Cut(0, breakLocation+1 ); } - if ( extList.Length() ) + if ( !extList.IsEmpty() ) mExtensions.AppendCString( extList ); return NS_OK; } diff --git a/mozilla/widget/src/beos/nsFilePicker.cpp b/mozilla/widget/src/beos/nsFilePicker.cpp index 0ebe7991750..acf97e3ef64 100644 --- a/mozilla/widget/src/beos/nsFilePicker.cpp +++ b/mozilla/widget/src/beos/nsFilePicker.cpp @@ -112,14 +112,14 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) if (!ppanel) return PR_FALSE; // set title - if (mTitle.Length() > 0) { + if (!mTitle.IsEmpty()) { char *title_utf8 = ToNewUTF8String(mTitle); ppanel->Window()->SetTitle(title_utf8); Recycle(title_utf8); } // set default text - if (mDefault.Length() > 0) { + if (!mDefault.IsEmpty()) { char *defaultText = ToNewUTF8String(mDefault); ppanel->SetSaveText(defaultText); Recycle(defaultText); @@ -352,7 +352,7 @@ void nsFilePicker::GetFileSystemCharset(nsString & fileSystemCharset) static nsAutoString aCharset; nsresult rv; - if (aCharset.Length() < 1) { + if (aCharset.IsEmpty()) { nsCOMPtr platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset); diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp index afbb70cb2bf..a4414ca00ce 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp @@ -133,7 +133,7 @@ void nsGtkIMEHelper::SetupUnicodeDecoder() nsAutoString charset; charset.Assign(NS_LITERAL_STRING("")); result = platform->GetCharset(kPlatformCharsetSel_Menu, charset); - if (NS_FAILED(result) || (charset.Length() == 0)) { + if (NS_FAILED(result) || charset.IsEmpty()) { charset.Assign(NS_LITERAL_STRING("ISO-8859-1")); // default } nsICharsetConverterManager* manager = nsnull; diff --git a/mozilla/widget/src/mac/nsMacControl.cpp b/mozilla/widget/src/mac/nsMacControl.cpp index 3a7341d226e..111d777bdae 100644 --- a/mozilla/widget/src/mac/nsMacControl.cpp +++ b/mozilla/widget/src/mac/nsMacControl.cpp @@ -613,7 +613,7 @@ void nsMacControl::GetFileSystemCharset(nsString & fileSystemCharset) static nsAutoString aCharset; nsresult rv; - if (aCharset.Length() < 1) { + if (aCharset.IsEmpty()) { nsCOMPtr platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset); diff --git a/mozilla/xpcom/io/nsLinebreakConverter.cpp b/mozilla/xpcom/io/nsLinebreakConverter.cpp index 18df7a4526d..a1e471fabdb 100644 --- a/mozilla/xpcom/io/nsLinebreakConverter.cpp +++ b/mozilla/xpcom/io/nsLinebreakConverter.cpp @@ -469,7 +469,7 @@ nsresult nsLinebreakConverter::ConvertStringLineBreaks(nsString& ioString, NS_ASSERTION(aDestBreaks != eLinebreakAny, "Invalid parameter"); // nothing to do - if (ioString.Length() == 0) return NS_OK; + if (ioString.IsEmpty()) return NS_OK; nsresult rv; diff --git a/mozilla/xpcom/io/nsLocalFileOSX.cpp b/mozilla/xpcom/io/nsLocalFileOSX.cpp index d981f75933b..1954ee14ce4 100644 --- a/mozilla/xpcom/io/nsLocalFileOSX.cpp +++ b/mozilla/xpcom/io/nsLocalFileOSX.cpp @@ -1142,7 +1142,7 @@ NS_IMETHODIMP nsLocalFile::InitWithPath(const nsAString& filePath) /* [noscript] void initWithNativePath (in ACString filePath); */ NS_IMETHODIMP nsLocalFile::InitWithNativePath(const nsACString& filePath) { - if (filePath.First() != '/' || filePath.Length() == 0) + if (filePath.IsEmpty() || filePath.First() != '/') return NS_ERROR_FILE_UNRECOGNIZED_PATH; // On 10.2, huge paths crash CFURLGetFSRef() if (filePath.Length() > PATH_MAX) diff --git a/mozilla/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp b/mozilla/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp index 21e9aec6494..84bf7e9b26c 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellWindowEnumerator.cpp @@ -326,7 +326,7 @@ nsWindowInfo *nsASDOMWindowEarlyToLateEnumerator::FindNext() { nsWindowInfo *info, *listEnd; - PRBool allWindows = mType.Length() == 0; + PRBool allWindows = mType.IsEmpty(); // see nsXULWindowEarlyToLateEnumerator::FindNext if (!mCurrentPosition) @@ -365,7 +365,7 @@ nsWindowInfo *nsASXULWindowEarlyToLateEnumerator::FindNext() { nsWindowInfo *info, *listEnd; - PRBool allWindows = mType.Length() == 0; + PRBool allWindows = mType.IsEmpty(); /* mCurrentPosition null is assumed to mean that the enumerator has run its course and is now basically useless. It could also be interpreted @@ -410,7 +410,7 @@ nsWindowInfo *nsASDOMWindowFrontToBackEnumerator::FindNext() { nsWindowInfo *info, *listEnd; - PRBool allWindows = mType.Length() == 0; + PRBool allWindows = mType.IsEmpty(); // see nsXULWindowEarlyToLateEnumerator::FindNext if (!mCurrentPosition) @@ -450,7 +450,7 @@ nsWindowInfo *nsASXULWindowFrontToBackEnumerator::FindNext() { nsWindowInfo *info, *listEnd; - PRBool allWindows = mType.Length() == 0; + PRBool allWindows = mType.IsEmpty(); // see nsXULWindowEarlyToLateEnumerator::FindNext if (!mCurrentPosition) @@ -490,7 +490,7 @@ nsWindowInfo *nsASDOMWindowBackToFrontEnumerator::FindNext() { nsWindowInfo *info, *listEnd; - PRBool allWindows = mType.Length() == 0; + PRBool allWindows = mType.IsEmpty(); // see nsXULWindowEarlyToLateEnumerator::FindNext if (!mCurrentPosition) @@ -533,7 +533,7 @@ nsWindowInfo *nsASXULWindowBackToFrontEnumerator::FindNext() { nsWindowInfo *info, *listEnd; - PRBool allWindows = mType.Length() == 0; + PRBool allWindows = mType.IsEmpty(); // see nsXULWindowEarlyToLateEnumerator::FindNext if (!mCurrentPosition) diff --git a/mozilla/xpfe/appshell/src/nsChromeTreeOwner.cpp b/mozilla/xpfe/appshell/src/nsChromeTreeOwner.cpp index 63e42b3f654..12f14de776d 100644 --- a/mozilla/xpfe/appshell/src/nsChromeTreeOwner.cpp +++ b/mozilla/xpfe/appshell/src/nsChromeTreeOwner.cpp @@ -116,7 +116,7 @@ NS_IMETHODIMP nsChromeTreeOwner::FindItemWithName(const PRUnichar* aName, PRBool fIs_Content = PR_FALSE; /* Special Cases */ - if(name.Length() == 0) + if(name.IsEmpty()) return NS_OK; if(name.EqualsIgnoreCase("_blank")) return NS_OK; diff --git a/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp b/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp index 2aa5c770523..314d2e05ec1 100644 --- a/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -162,7 +162,7 @@ NS_IMETHODIMP nsContentTreeOwner::FindItemWithName(const PRUnichar* aName, PRBool fIs_Content = PR_FALSE; /* Special Cases */ - if(name.Length() == 0) + if(name.IsEmpty()) return NS_OK; if(name.EqualsIgnoreCase("_blank")) return NS_OK; @@ -603,9 +603,9 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle) nsAutoString title; nsAutoString docTitle(aTitle); - if(docTitle.Length() > 0) + if(!docTitle.IsEmpty()) { - if(mTitlePreface.Length() > 0) + if(!mTitlePreface.IsEmpty()) { // Title will be: "Preface: Doc Title - Mozilla" title.Assign(mTitlePreface); diff --git a/mozilla/xpfe/appshell/src/nsUserInfoUnix.cpp b/mozilla/xpfe/appshell/src/nsUserInfoUnix.cpp index 7b3a48c10fb..84d876e8ca6 100644 --- a/mozilla/xpfe/appshell/src/nsUserInfoUnix.cpp +++ b/mozilla/xpfe/appshell/src/nsUserInfoUnix.cpp @@ -93,7 +93,7 @@ nsUserInfo::GetFullname(PRUnichar **aFullname) // replace ampersand with username if (pw->pw_name) { nsCAutoString username(pw->pw_name); - if (username.Length() > 0 && nsCRT::IsLower(username.CharAt(0))) + if (!username.IsEmpty() && nsCRT::IsLower(username.CharAt(0))) username.SetCharAt(nsCRT::ToUpper(username.CharAt(0)), 0); fullname.ReplaceSubstring("&", username.get()); diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index bbbbab3a721..cfc73323116 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -1422,7 +1422,7 @@ void nsWebShellWindow::LoadContentAreas() { // content URLs are specified in the search part of the URL // as =[;(repeat)] - if (searchSpec.Length() > 0) { + if (!searchSpec.IsEmpty()) { PRInt32 begPos, eqPos, endPos; diff --git a/mozilla/xpfe/appshell/src/nsWindowMediator.cpp b/mozilla/xpfe/appshell/src/nsWindowMediator.cpp index 59540aa1410..efd94e61ed0 100644 --- a/mozilla/xpfe/appshell/src/nsWindowMediator.cpp +++ b/mozilla/xpfe/appshell/src/nsWindowMediator.cpp @@ -335,7 +335,7 @@ nsWindowMediator::MostRecentWindowInfo(const PRUnichar* inType) { PRInt32 lastTimeStamp = -1; nsAutoString typeString(inType); - PRBool allWindows = !inType || typeString.Length() == 0; + PRBool allWindows = !inType || typeString.IsEmpty(); // Find the most window with the highest time stamp that matches // the requested type diff --git a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp index 9f08dd0710a..0bcf6447b7e 100644 --- a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp +++ b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp @@ -3940,7 +3940,7 @@ nsGlobalHistory::OnStartLookup(const PRUnichar *searchString, // there is no need to proceed with the search nsAutoString cut(searchString); AutoCompleteCutPrefix(cut, nsnull); - if (cut.Length() == 0) { + if (cut.IsEmpty()) { listener->OnAutoComplete(results, status); return NS_OK; } diff --git a/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp b/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp index c91b3d87bbf..713be18e650 100644 --- a/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp +++ b/mozilla/xpfe/components/related/src/nsRelatedLinksHandler.cpp @@ -385,7 +385,7 @@ RelatedLinksStreamListener::OnDataAvailable(nsIRequest *request, nsISupports *ct mBuffer.Left(oneLiner, eol); mBuffer.Cut(0, eol+1); } - if (oneLiner.Length() < 1) break; + if (oneLiner.IsEmpty()) break; #if 0 printf("RL: '%s'\n", NS_LossyConvertUCS2toASCII(oneLiner).get()); @@ -458,7 +458,7 @@ RelatedLinksStreamListener::OnDataAvailable(nsIRequest *request, nsISupports *ct if (NS_SUCCEEDED(rv = gRDFService->GetAnonymousResource(getter_AddRefs(newTopic)))) { mDataSource->Assert(newTopic, kRDF_type, kNC_RelatedLinksTopic, PR_TRUE); - if (title.Length() > 0) + if (!title.IsEmpty()) { Unescape(title); @@ -497,7 +497,7 @@ RelatedLinksStreamListener::OnDataAvailable(nsIRequest *request, nsISupports *ct } } - if (child.Length() > 0) + if (!child.IsEmpty()) { #if 0 @@ -511,7 +511,7 @@ RelatedLinksStreamListener::OnDataAvailable(nsIRequest *request, nsISupports *ct if (NS_SUCCEEDED(rv)) { title.Trim(" "); - if (title.Length() > 0) + if (!title.IsEmpty()) { Unescape(title); diff --git a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp index b7803484684..367ce2c43fb 100755 --- a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp +++ b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp @@ -719,7 +719,7 @@ InternetSearchDataSource::FireTimer(nsITimer* aTimer, void* aClosure) if (NS_FAILED(rv = search->GetSearchEngineToPing(getter_AddRefs(searchURI), updateURL))) return; if (!searchURI) return; - if (updateURL.Length() < 1) return; + if (updateURL.IsEmpty()) return; search->busyResource = searchURI; @@ -2443,7 +2443,7 @@ InternetSearchDataSource::saveContents(nsIChannel* channel, nsIInternetSearchCon PRInt32 slashOffset = baseName.RFindChar(PRUnichar('/')); if (slashOffset < 0) return(NS_ERROR_UNEXPECTED); baseName.Cut(0, slashOffset+1); - if (baseName.Length() < 1) return(NS_ERROR_UNEXPECTED); + if (baseName.IsEmpty()) return(NS_ERROR_UNEXPECTED); // make sure that search engines are .src files PRInt32 extensionOffset; @@ -2579,7 +2579,7 @@ InternetSearchDataSource::GetInternetSearchURL(const char *searchEngineURI, MapEncoding(encodingStr, queryEncodingStr); } - if (queryEncodingStr.Length() > 0) + if (!queryEncodingStr.IsEmpty()) { // remember query charset string mQueryEncodingStr = queryEncodingStr; @@ -2618,7 +2618,7 @@ InternetSearchDataSource::GetInternetSearchURL(const char *searchEngineURI, return(rv); if (NS_FAILED(rv = GetInputs(dataUni, userVar, text, input, direction, pageNumber, whichButtons))) return(rv); - if (input.Length() < 1) return(NS_ERROR_UNEXPECTED); + if (input.IsEmpty()) return(NS_ERROR_UNEXPECTED); // we can only handle HTTP GET if (!method.EqualsIgnoreCase("get")) return(NS_ERROR_UNEXPECTED); @@ -2749,7 +2749,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea // look for query option which is the string the user is searching for nsAutoString userVar, inputUnused; if (NS_FAILED(rv = GetInputs(dataUni, userVar, nsAutoString(), inputUnused, 0, 0, 0))) return(rv); - if (userVar.Length() < 1) return(NS_RDF_NO_VALUE); + if (userVar.IsEmpty()) return(NS_RDF_NO_VALUE); nsAutoString queryStr; queryStr = NS_LITERAL_STRING("?") + @@ -2776,7 +2776,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea searchText.Truncate(andOffset); } } - if (searchText.Length() > 0) + if (!searchText.IsEmpty()) { // apply charset conversion to the search text if (!mQueryEncodingStr.IsEmpty()) @@ -2845,7 +2845,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea if (NS_SUCCEEDED(rv = mInner->GetTarget(kNC_LastSearchRoot, kNC_Ref, PR_TRUE, getter_AddRefs(oldNode)))) { - if (engineURI.Length() > 0) + if (!engineURI.IsEmpty()) { const PRUnichar *uriUni = engineURI.get(); nsCOMPtr uriLiteral; @@ -3113,7 +3113,7 @@ InternetSearchDataSource::BeginSearchRequest(nsIRDFResource *source, PRBool doNe // parse up attributes - while(uri.Length() > 0) + while(!uri.IsEmpty()) { nsAutoString item; @@ -3137,7 +3137,7 @@ InternetSearchDataSource::BeginSearchRequest(nsIRDFResource *source, PRBool doNe value = item; value.Cut(0, equalOffset + 1); - if ((attrib.Length() > 0) && (value.Length() > 0)) + if (!attrib.IsEmpty() && !value.IsEmpty()) { if (attrib.EqualsIgnoreCase("engine")) { @@ -3276,7 +3276,7 @@ InternetSearchDataSource::FindData(nsIRDFResource *engine, nsIRDFLiteral **dataL } // save file contents - if (data.Length() < 1) return(NS_ERROR_UNEXPECTED); + if (data.IsEmpty()) return(NS_ERROR_UNEXPECTED); rv = updateDataHintsInGraph(engine, data.get()); @@ -3448,7 +3448,7 @@ InternetSearchDataSource::updateDataHintsInGraph(nsIRDFResource *engine, const P nsAutoString updateStr, updateIconStr, updateCheckDaysStr; GetData(dataUni, "browser", 0, "update", updateStr); - if (updateStr.Length() < 1) + if (updateStr.IsEmpty()) { // fallback to trying "search"|"updateCheckDays" GetData(dataUni, "search", 0, "update", updateStr); @@ -3474,17 +3474,17 @@ InternetSearchDataSource::updateDataHintsInGraph(nsIRDFResource *engine, const P // note: its OK if the "updateIcon" isn't specified GetData(dataUni, "browser", 0, "updateIcon", updateIconStr); } - if (updateStr.Length() > 0) + if (!updateStr.IsEmpty()) { GetData(dataUni, "browser", 0, "updateCheckDays", updateCheckDaysStr); - if (updateCheckDaysStr.Length() < 1) + if (updateCheckDaysStr.IsEmpty()) { // fallback to trying "search"|"updateCheckDays" GetData(dataUni, "search", 0, "updateCheckDays", updateCheckDaysStr); } } - if ((updateStr.Length() > 0) && (updateCheckDaysStr.Length() > 0)) + if (!updateStr.IsEmpty() && !updateCheckDaysStr.IsEmpty()) { nsCOMPtr updateLiteral; if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(updateStr.get(), @@ -3508,7 +3508,7 @@ InternetSearchDataSource::updateDataHintsInGraph(nsIRDFResource *engine, const P rv = updateAtom(mInner, engine, kNC_UpdateCheckDays, updateCheckDaysLiteral, nsnull); } - if (updateIconStr.Length() > 0) + if (!updateIconStr.IsEmpty()) { nsCOMPtr updateIconLiteral; if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(updateIconStr.get(), @@ -3828,7 +3828,7 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin dataLit->GetValueConst(&dataUni); if (!dataUni) return(NS_RDF_NO_VALUE); - if (fullURL.Length() > 0) + if (!fullURL.IsEmpty()) { action.Assign(fullURL); methodStr.Assign(NS_LITERAL_STRING("get")); @@ -3844,14 +3844,14 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin // first look for "interpret/charset"... if that isn't specified, // then fall back to looking for "interpret/resultEncoding" (a decimal) GetData(dataUni, "interpret", 0, "charset", resultEncodingStr); - if (resultEncodingStr.Length() < 1) + if (resultEncodingStr.IsEmpty()) { GetData(dataUni, "interpret", 0, "resultEncoding", encodingStr); // decimal string values MapEncoding(encodingStr, resultEncodingStr); } // rjc note: ignore "interpret/resultTranslationEncoding" as well as // "interpret/resultTranslationFont" since we always convert results to Unicode - if (resultEncodingStr.Length() > 0) + if (!resultEncodingStr.IsEmpty()) { nsCOMPtr charsetConv = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) @@ -3871,12 +3871,12 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin // then fall back to looking for "search/queryEncoding" (a decimal) nsAutoString queryEncodingStr; GetData(dataUni, "search", 0, "queryCharset", queryEncodingStr); - if (queryEncodingStr.Length() < 1) + if (queryEncodingStr.IsEmpty()) { GetData(dataUni, "search", 0, "queryEncoding", encodingStr); // decimal string values MapEncoding(encodingStr, queryEncodingStr); } - if (queryEncodingStr.Length() > 0) + if (!queryEncodingStr.IsEmpty()) { // convert from escaped-UTF_8, to unicode, and then to // the charset indicated by the dataset in question @@ -3907,13 +3907,10 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin } } - if (fullURL.Length() > 0) - { - } - else if (methodStr.EqualsIgnoreCase("get")) + if (fullURL.IsEmpty() && methodStr.EqualsIgnoreCase("get")) { if (NS_FAILED(rv = GetInputs(dataUni, userVar, textTemp, input, 0, 0, 0))) return(rv); - if (input.Length() < 1) return(NS_ERROR_UNEXPECTED); + if (input.IsEmpty()) return(NS_ERROR_UNEXPECTED); // HTTP Get method support action += NS_LITERAL_STRING("?") + input; @@ -4412,7 +4409,7 @@ InternetSearchDataSource::GetNumInterpretSections(const PRUnichar *dataUni, PRUi NS_NAMED_LITERAL_STRING(section, " 0) + while(!buffer.IsEmpty()) { PRInt32 eol = buffer.FindCharInSet("\r\n", 0); if (eol < 0) break; @@ -4422,7 +4419,7 @@ InternetSearchDataSource::GetNumInterpretSections(const PRUnichar *dataUni, PRUi buffer.Left(line, eol); } buffer.Cut(0, eol+1); - if (line.Length() < 1) continue; // skip empty lines + if (line.IsEmpty()) continue; // skip empty lines if (line[0] == PRUnichar('#')) continue; // skip comments line.Trim(" \t"); if (inSection == PR_FALSE) @@ -4461,7 +4458,7 @@ InternetSearchDataSource::GetData(const PRUnichar *dataUni, const char *sectionT section.Assign(NS_LITERAL_STRING("<")); section.AppendWithConversion(sectionToFind); - while(buffer.Length() > 0) + while(!buffer.IsEmpty()) { PRInt32 eol = buffer.FindCharInSet("\r\n", 0); if (eol < 0) break; @@ -4471,7 +4468,7 @@ InternetSearchDataSource::GetData(const PRUnichar *dataUni, const char *sectionT buffer.Left(line, eol); } buffer.Cut(0, eol+1); - if (line.Length() < 1) continue; // skip empty lines + if (line.IsEmpty()) continue; // skip empty lines if (line[0] == PRUnichar('#')) continue; // skip comments line.Trim(" \t"); if (inSection == PR_FALSE) @@ -4516,7 +4513,7 @@ InternetSearchDataSource::GetData(const PRUnichar *dataUni, const char *sectionT { PRUnichar quoteChar = value[0]; value.Cut(0,1); - if (value.Length() > 0) + if (!value.IsEmpty()) { PRInt32 quoteEnd = value.FindChar(quoteChar); if (quoteEnd >= 0) @@ -4553,7 +4550,7 @@ InternetSearchDataSource::GetInputs(const PRUnichar *dataUni, nsString &userVar, PRBool inSection = PR_FALSE; PRBool inDirInput; // directional input: "inputnext" or "inputprev" - while(buffer.Length() > 0) + while(!buffer.IsEmpty()) { PRInt32 eol = buffer.FindCharInSet("\r\n", 0); if (eol < 0) break; @@ -4563,7 +4560,7 @@ InternetSearchDataSource::GetInputs(const PRUnichar *dataUni, nsString &userVar, buffer.Left(line, eol); } buffer.Cut(0, eol+1); - if (line.Length() < 1) continue; // skip empty lines + if (line.IsEmpty()) continue; // skip empty lines if (line[0] == PRUnichar('#')) continue; // skip comments line.Trim(" \t"); if (inSection == PR_FALSE) @@ -4647,7 +4644,7 @@ InternetSearchDataSource::GetInputs(const PRUnichar *dataUni, nsString &userVar, } } } - if (nameAttrib.Length() <= 0) continue; + if (nameAttrib.IsEmpty()) continue; // first look for value attribute nsAutoString valueAttrib; @@ -4696,9 +4693,9 @@ InternetSearchDataSource::GetInputs(const PRUnichar *dataUni, nsString &userVar, if (line.RFind("mode=browser", PR_TRUE) >= 0) continue; - if ((nameAttrib.Length() > 0) && (valueAttrib.Length() > 0)) + if (!nameAttrib.IsEmpty() && !valueAttrib.IsEmpty()) { - if (input.Length() > 0) + if (!input.IsEmpty()) { input.Append(NS_LITERAL_STRING("&")); } @@ -4937,7 +4934,7 @@ InternetSearchDataSource::OnStopRequest(nsIRequest *request, nsISupports *ctxt, // save out new search engine state data into localstore PRBool tempDirty = PR_FALSE; nsCOMPtr newValue; - if (lastModValue.Length() > 0) + if (!lastModValue.IsEmpty()) { gRDFService->GetLiteral(NS_ConvertASCIItoUCS2(lastModValue).get(), getter_AddRefs(newValue)); @@ -4948,7 +4945,7 @@ InternetSearchDataSource::OnStopRequest(nsIRequest *request, nsISupports *ctxt, if (tempDirty == PR_TRUE) updateSearchEngineFile = PR_TRUE; } } - if (contentLengthValue.Length() > 0) + if (!contentLengthValue.IsEmpty()) { gRDFService->GetLiteral(NS_ConvertASCIItoUCS2(contentLengthValue).get(), getter_AddRefs(newValue)); diff --git a/mozilla/xpfe/components/startup/src/nsUserInfoUnix.cpp b/mozilla/xpfe/components/startup/src/nsUserInfoUnix.cpp index 7b3a48c10fb..84d876e8ca6 100644 --- a/mozilla/xpfe/components/startup/src/nsUserInfoUnix.cpp +++ b/mozilla/xpfe/components/startup/src/nsUserInfoUnix.cpp @@ -93,7 +93,7 @@ nsUserInfo::GetFullname(PRUnichar **aFullname) // replace ampersand with username if (pw->pw_name) { nsCAutoString username(pw->pw_name); - if (username.Length() > 0 && nsCRT::IsLower(username.CharAt(0))) + if (!username.IsEmpty() && nsCRT::IsLower(username.CharAt(0))) username.SetCharAt(nsCRT::ToUpper(username.CharAt(0)), 0); fullname.ReplaceSubstring("&", username.get()); diff --git a/mozilla/xpinstall/src/nsInstall.cpp b/mozilla/xpinstall/src/nsInstall.cpp index 33027cc7bf2..b616154b45d 100644 --- a/mozilla/xpinstall/src/nsInstall.cpp +++ b/mozilla/xpinstall/src/nsInstall.cpp @@ -2443,7 +2443,7 @@ nsInstall::CurrentUserNode(nsString& userRegNode) PRBool nsInstall::BadRegName(const nsString& regName) { - if ( regName.Length() == 0 ) + if ( regName.IsEmpty() ) return PR_TRUE; if ((regName.First() == ' ' ) || (regName.Last() == ' ' )) diff --git a/mozilla/xpinstall/src/nsJSFile.cpp b/mozilla/xpinstall/src/nsJSFile.cpp index c4484238a31..384e8ad3f09 100644 --- a/mozilla/xpinstall/src/nsJSFile.cpp +++ b/mozilla/xpinstall/src/nsJSFile.cpp @@ -1116,7 +1116,7 @@ InstallFileOpFileWindowsGetShortName(JSContext *cx, JSObject *obj, uintN argc, j return JS_TRUE; } - if(shortPathName.Length() != 0) + if(!shortPathName.IsEmpty()) *rval = STRING_TO_JSVAL(JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar*, shortPathName.get()), shortPathName.Length())); return JS_TRUE;