diff --git a/mozilla/content/base/src/nsPrintEngine.cpp b/mozilla/content/base/src/nsPrintEngine.cpp index b57acd4277b..fdad55cbf51 100644 --- a/mozilla/content/base/src/nsPrintEngine.cpp +++ b/mozilla/content/base/src/nsPrintEngine.cpp @@ -1405,7 +1405,7 @@ nsPrintEngine::EnumerateDocumentNames(PRUint32* aCount, // Use the URL if the doc is empty if (!docTitleStr || !*docTitleStr) { - if (docURLStr && nsCRT::strlen(docURLStr) > 0) { + if (docURLStr && *docURLStr) { nsMemory::Free(docTitleStr); docTitleStr = docURLStr; } else { @@ -2179,11 +2179,11 @@ nsPrintEngine::GetDisplayTitleAndURL(nsPrintObject* aPO, aPrintSettings->GetTitle(&docTitleStrPS); aPrintSettings->GetDocURL(&docURLStrPS); - if (docTitleStrPS && nsCRT::strlen(docTitleStrPS) > 0) { + if (docTitleStrPS && *docTitleStrPS) { *aTitle = docTitleStrPS; } - if (docURLStrPS && nsCRT::strlen(docURLStrPS) > 0) { + if (docURLStrPS && *docURLStrPS) { *aURLStr = docURLStrPS; } diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 66593fb61c6..b136b8d58c2 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -184,7 +184,7 @@ MyPrefChangedCallback(const char*aPrefName, void* instance_data) rv = prefs->GetLocalizedUnicharPref("intl.charset.detector", &detector_name))) { - if(nsCRT::strlen(detector_name) > 0) { + if(detector_name && *detector_name) { PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,DETECTOR_CONTRACTID_MAX); PL_strncat(g_detector_contractid, NS_ConvertUCS2toUTF8(detector_name).get(),DETECTOR_CONTRACTID_MAX); gPlugDetector = PR_TRUE; @@ -581,7 +581,7 @@ nsHTMLDocument::TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor, nsXPIDLCString cachedCharset; rv = aCacheDescriptor->GetMetaDataElement("charset", getter_Copies(cachedCharset)); - if (NS_SUCCEEDED(rv) && PL_strlen(cachedCharset) > 0) + if (NS_SUCCEEDED(rv) && !cachedCharset.IsEmpty()) { aCharset.Assign(NS_ConvertASCIItoUCS2(cachedCharset)); aCharsetSource = kCharsetFromCache; diff --git a/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp b/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp index e6a6cf33e5f..56257d3f410 100644 --- a/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp +++ b/mozilla/embedding/browser/gtk/tests/TestGtkEmbed.cpp @@ -807,7 +807,7 @@ link_message_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) char *message; g_print("link_message_cb\n"); message = gtk_moz_embed_get_link_message(embed); - if (message && (strlen(message) == 0)) + if (!message || !*message) update_temp_message(browser, 0); else update_temp_message(browser, message); @@ -821,7 +821,7 @@ js_status_cb (GtkMozEmbed *embed, TestGtkBrowser *browser) char *message; g_print("js_status_cb\n"); message = gtk_moz_embed_get_js_status(embed); - if (message && (strlen(message) == 0)) + if (!message || !*message) update_temp_message(browser, 0); else update_temp_message(browser, message); diff --git a/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp b/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp index 5e310f4bfdc..9532010442c 100644 --- a/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp +++ b/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp @@ -1302,7 +1302,7 @@ Boolean CBrowserShell::CanFindNext() nsXPIDLString searchStr; rv = finder->GetSearchString(getter_Copies(searchStr)); - return (NS_SUCCEEDED(rv) && nsCRT::strlen(searchStr) != 0); + return (NS_SUCCEEDED(rv) && !searchStr.IsEmpty()); } diff --git a/mozilla/extensions/xmlterm/base/mozLineTerm.cpp b/mozilla/extensions/xmlterm/base/mozLineTerm.cpp index 734a63a035a..d55eed9247d 100644 --- a/mozilla/extensions/xmlterm/base/mozLineTerm.cpp +++ b/mozilla/extensions/xmlterm/base/mozLineTerm.cpp @@ -94,7 +94,7 @@ mozLineTerm::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) mLoggingInitialized = PR_TRUE; char* logStr = (char*) PR_GetEnv("LTERM_LOG"); - if (logStr && (strlen(logStr) > 0)) { + if (logStr && *logStr) { // Enable LineTerm logging mozLineTerm::mLoggingEnabled = PR_TRUE; } @@ -308,7 +308,7 @@ NS_IMETHODIMP mozLineTerm::OpenAux(const PRUnichar *command, if (NS_FAILED(result)) return NS_ERROR_FAILURE; - if (strlen(securePrincipal) == 0) { + if (!*securePrincipal) { nsMemory::Free(securePrincipal); XMLT_ERROR("mozLineTerm::OpenAux: Error - " "Failed to create LineTerm for insecure document principal\n"); diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp b/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp index 8ba3ab5403f..bbf37adcf83 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp +++ b/mozilla/extensions/xmlterm/base/mozXMLTermStream.cpp @@ -107,7 +107,7 @@ NS_IMETHODIMP mozXMLTermStream::Open(nsIDOMWindowInternal* aDOMWindow, mMaxResizeHeight = maxResizeHeight; - if (frameName && (strlen(frameName) > 0)) { + if (frameName && *frameName) { // Open stream in named subframe of current frame XMLT_LOG(mozXMLTermStream::Open,22,("frameName=%s\n", frameName)); diff --git a/mozilla/extensions/xmlterm/lineterm/ltermEscape.c b/mozilla/extensions/xmlterm/lineterm/ltermEscape.c index 2eca9b1544c..24beeaa4e6a 100644 --- a/mozilla/extensions/xmlterm/lineterm/ltermEscape.c +++ b/mozilla/extensions/xmlterm/lineterm/ltermEscape.c @@ -1175,7 +1175,7 @@ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf, return -1; } - if (strlen(lts->cookie) > 0) { + if (*lts->cookie) { if (ltermSendChar(lts, lts->cookie, strlen(lts->cookie)) != 0) return -1; } diff --git a/mozilla/extensions/xmlterm/linetest/ptytest.c b/mozilla/extensions/xmlterm/linetest/ptytest.c index 2adfcf377ba..9c9cb2e0d73 100644 --- a/mozilla/extensions/xmlterm/linetest/ptytest.c +++ b/mozilla/extensions/xmlterm/linetest/ptytest.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { exit(-1); } - if (strlen(argv[2]) > 0) { + if (*argv[2]) { /* Open TTY for echoing */ if ( (echofd = open(argv[2], O_WRONLY)) == -1) perror("ptytest"); diff --git a/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp b/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp index 574211fdd93..380fb22d336 100644 --- a/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp +++ b/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp @@ -325,10 +325,12 @@ nsUnicodeMappingUtil::PrefEnumCallback(const char* aName, void* aClosure) char* valueInUTF8 = nsnull; Self->mPref->CopyCharPref(aName, &valueInUTF8); - if((nsnull == valueInUTF8) || (PL_strlen(valueInUTF8) == 0)) + if(!valueInUTF8) + return; + if(!*valueInUTF8) { - Recycle(valueInUTF8); - return; + Recycle(valueInUTF8); + return; } PRUnichar valueInUCS2[FACESIZE]= { 0 }; PRUnichar format[] = { '%', 's', 0 }; @@ -352,7 +354,8 @@ nsUnicodeMappingUtil::PrefEnumCallback(const char* aName, void* aClosure) #ifdef DEBUG_ftang_font char* utf8 = ToNewUTF8String(*fontname); printf("font %d %d %s= %s\n",script , type, aName,utf8); - Recycle(utf8); + if (utf8) + Recycle(utf8); #endif } void nsUnicodeMappingUtil::InitFromPref() @@ -388,27 +391,30 @@ void nsUnicodeMappingUtil::InitScriptFontMapping() mPref->CopyCharPref (theNeededPreference,&valueInUTF8); - if ((nsnull == valueInUTF8) || (PL_strlen (valueInUTF8) == 0)) - Recycle (valueInUTF8); - else + if (valueInUTF8) { - PRUnichar valueInUCS2[FACESIZE]= { 0 }; - PRUnichar format[] = { '%', 's', 0 }; - PRUint32 n = nsTextFormatter::snprintf(valueInUCS2, FACESIZE, format, valueInUTF8); - - Recycle (valueInUTF8); - if (n != 0) + if (!*valueInUTF8) + Recycle (valueInUTF8); + else { - nsString *fontname = new nsAutoString (valueInUCS2); + PRUnichar valueInUCS2[FACESIZE]= { 0 }; + PRUnichar format[] = { '%', 's', 0 }; + PRUint32 n = nsTextFormatter::snprintf(valueInUCS2, FACESIZE, format, valueInUTF8); - if (nsnull != fontname) + Recycle (valueInUTF8); + if (n != 0) { - short fontID = 0; + nsString *fontname = new nsAutoString (valueInUCS2); - if (nsDeviceContextMac::GetMacFontNumber (*fontname,fontID)) - mScriptFontMapping[script] = fontID; + if (nsnull != fontname) + { + short fontID = 0; - delete fontname; + if (nsDeviceContextMac::GetMacFontNumber (*fontname,fontID)) + mScriptFontMapping[script] = fontID; + + delete fontname; + } } } } diff --git a/mozilla/gfx/src/os2/nsDeviceContextSpecOS2.cpp b/mozilla/gfx/src/os2/nsDeviceContextSpecOS2.cpp index f6532e85611..485e598ca50 100644 --- a/mozilla/gfx/src/os2/nsDeviceContextSpecOS2.cpp +++ b/mozilla/gfx/src/os2/nsDeviceContextSpecOS2.cpp @@ -835,7 +835,7 @@ HDC PrnOpenDC( PRTQUEUE *pInfo, PSZ pszApplicationName, int copies, int destinat else dcType = OD_QUEUED; } else { - if (file && strlen(file) != 0) + if (file && *file) pszLogAddress = (PSZ) file; else pszLogAddress = "FILE"; diff --git a/mozilla/gfx/src/xprint/nsXPrintContext.cpp b/mozilla/gfx/src/xprint/nsXPrintContext.cpp index 9d0a636ad66..975f7e4e179 100644 --- a/mozilla/gfx/src/xprint/nsXPrintContext.cpp +++ b/mozilla/gfx/src/xprint/nsXPrintContext.cpp @@ -536,7 +536,7 @@ nsXPrintContext::SetupPrintContext(nsIDeviceContextSpecXp *aSpec) PR_LOG(nsXPrintContextLM, PR_LOG_DEBUG, ("print to file '%s'\n", XPU_NULLXSTR(mPrintFile))); - if( (mPrintFile == nsnull) || (strlen(mPrintFile) == 0) ) + if(!mPrintFile || !*mPrintFile) return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE; } diff --git a/mozilla/gfx/src/xprint/xprintutil.c b/mozilla/gfx/src/xprint/xprintutil.c index f26ce655006..9f91b8b4183 100644 --- a/mozilla/gfx/src/xprint/xprintutil.c +++ b/mozilla/gfx/src/xprint/xprintutil.c @@ -353,7 +353,7 @@ int XpuGetOneLongAttribute( Display *pdpy, XPContext pcontext, XPAttributes type return(0); s = XpGetOneAttribute(pdpy, pcontext, type, STRING_AS_WRITABLE(attribute_name)); - if( (s != NULL) && (strlen(s) > 0) ) + if(s && *s) { long tmp; @@ -965,7 +965,7 @@ XpuMediumSourceSizeList XpuGetMediumSourceSizeList( Display *pdpy, XPContext pco /* Default medium ? */ if( (!strcmp(medium_name, default_medium)) && - ((tray_name && (strlen(default_tray) > 0))?(!strcmp(tray_name, default_tray)):(True)) ) + ((tray_name && (*default_tray))?(!strcmp(tray_name, default_tray)):(True)) ) { default_medium_rec_index = rec_count-2; } diff --git a/mozilla/js/src/jsfile.c b/mozilla/js/src/jsfile.c index 318adaca758..144ee094515 100644 --- a/mozilla/js/src/jsfile.c +++ b/mozilla/js/src/jsfile.c @@ -482,7 +482,7 @@ js_canonicalPath(JSContext *cx, char *oldpath) } strcpy(result, base); c = strlen(result); - if (strlen(tmp)>0) { + if (*tmp) { result[c] = FILESEPARATOR; result[c+1] = '\0'; strcat(result, tmp); diff --git a/mozilla/js/src/xpconnect/shell/xpcshell.cpp b/mozilla/js/src/xpconnect/shell/xpcshell.cpp index cbdbff5a580..cf1589403c4 100644 --- a/mozilla/js/src/xpconnect/shell/xpcshell.cpp +++ b/mozilla/js/src/xpconnect/shell/xpcshell.cpp @@ -411,7 +411,7 @@ GetLine(JSContext *cx, char *bufp, FILE *fh, const char *prompt) { char *linep; if ((linep = readline(prompt)) == NULL) return JS_FALSE; - if (strlen(linep) > 0) + if (*linep) add_history(linep); strcpy(bufp, linep); JS_free(cx, linep); diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 538ce8436b1..557e30f796a 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -334,7 +334,7 @@ SubstValueForCode(nsString& aStr, const PRUnichar * aUKey, const PRUnichar * aUS uKeyStr = ToNewUnicode(newKey); } - if (nsCRT::strlen(aUStr) == 0) { + if (!aUStr || !*aUStr) { aStr.SetLength(0); } else { aStr.ReplaceSubstring(uKeyStr, aUStr); @@ -346,7 +346,7 @@ SubstValueForCode(nsString& aStr, const PRUnichar * aUKey, const PRUnichar * aUS } #else - if (nsCRT::strlen(aUStr) == 0) { + if (!aUStr || !*aUStr) { aStr.SetLength(0); } else { aStr.ReplaceSubstring(aUKey, aUStr); diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 538ce8436b1..557e30f796a 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -334,7 +334,7 @@ SubstValueForCode(nsString& aStr, const PRUnichar * aUKey, const PRUnichar * aUS uKeyStr = ToNewUnicode(newKey); } - if (nsCRT::strlen(aUStr) == 0) { + if (!aUStr || !*aUStr) { aStr.SetLength(0); } else { aStr.ReplaceSubstring(uKeyStr, aUStr); @@ -346,7 +346,7 @@ SubstValueForCode(nsString& aStr, const PRUnichar * aUKey, const PRUnichar * aUS } #else - if (nsCRT::strlen(aUStr) == 0) { + if (!aUStr || !*aUStr) { aStr.SetLength(0); } else { aStr.ReplaceSubstring(aUKey, aUStr); diff --git a/mozilla/layout/printing/nsPrintEngine.cpp b/mozilla/layout/printing/nsPrintEngine.cpp index b57acd4277b..fdad55cbf51 100644 --- a/mozilla/layout/printing/nsPrintEngine.cpp +++ b/mozilla/layout/printing/nsPrintEngine.cpp @@ -1405,7 +1405,7 @@ nsPrintEngine::EnumerateDocumentNames(PRUint32* aCount, // Use the URL if the doc is empty if (!docTitleStr || !*docTitleStr) { - if (docURLStr && nsCRT::strlen(docURLStr) > 0) { + if (docURLStr && *docURLStr) { nsMemory::Free(docTitleStr); docTitleStr = docURLStr; } else { @@ -2179,11 +2179,11 @@ nsPrintEngine::GetDisplayTitleAndURL(nsPrintObject* aPO, aPrintSettings->GetTitle(&docTitleStrPS); aPrintSettings->GetDocURL(&docURLStrPS); - if (docTitleStrPS && nsCRT::strlen(docTitleStrPS) > 0) { + if (docTitleStrPS && *docTitleStrPS) { *aTitle = docTitleStrPS; } - if (docURLStrPS && nsCRT::strlen(docURLStrPS) > 0) { + if (docURLStrPS && *docURLStrPS) { *aURLStr = docURLStrPS; } diff --git a/mozilla/mailnews/addrbook/src/nsAbAddressCollecter.cpp b/mozilla/mailnews/addrbook/src/nsAbAddressCollecter.cpp index aac87b89c95..12196c914c3 100644 --- a/mozilla/mailnews/addrbook/src/nsAbAddressCollecter.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbAddressCollecter.cpp @@ -125,7 +125,7 @@ NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *address, PRBool a if (NS_SUCCEEDED(rv) && senderCard) { PRBool modifiedCard; - if (curName && strlen(curName) > 0) { + if (curName && *curName) { rv = SetNamesForCard(senderCard, curName, &modifiedCard); NS_ASSERTION(NS_SUCCEEDED(rv), "failed to set names"); } diff --git a/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp b/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp index 64867a9e97e..716f32a90ba 100644 --- a/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp +++ b/mozilla/mailnews/addrbook/src/nsDirPrefs.cpp @@ -2156,7 +2156,7 @@ static char *DIR_GetStringPref(const char *prefRoot, const char *prefLeaf, char PR_FREEIF(value); /* free old value because we are going to give it a new value.... */ value = defaultValue ? nsCRT::strdup(defaultValue) : nsnull; } - if (PL_strlen(value) == 0) + if (!value || !*value) { PR_FREEIF(value); pPref->CopyDefaultCharPref(scratch, &value); @@ -3053,7 +3053,7 @@ void DIR_GetPrefsForOneServer (DIR_Server *server, PRBool reinitialize, PRBool o if (server->dirType == PABDirectory) { /* make sure there is a PR_TRUE PAB */ - if (PL_strlen (server->serverName) == 0) + if (!server->serverName || !*server->serverName) server->isOffline = PR_FALSE; server->saveResults = PR_TRUE; /* never let someone delete their PAB this way */ } diff --git a/mozilla/mailnews/base/search/src/nsMsgSearchAdapter.cpp b/mozilla/mailnews/base/search/src/nsMsgSearchAdapter.cpp index e4c91b2875e..709ad05b032 100644 --- a/mozilla/mailnews/base/search/src/nsMsgSearchAdapter.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgSearchAdapter.cpp @@ -497,7 +497,7 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real { nsXPIDLCString arbitraryHeaderTerm; term->GetArbitraryHeader(getter_Copies(arbitraryHeaderTerm)); - if (strlen((const char *) arbitraryHeaderTerm) > 0) + if (!arbitraryHeaderTerm.IsEmpty()) { arbitraryHeader = new char [strlen((const char *)arbitraryHeaderTerm) + 6]; // 6 bytes for SPACE \" .... \" SPACE if (!arbitraryHeader) diff --git a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp index 37e545cd9eb..0acb1fa96e8 100644 --- a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp +++ b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp @@ -494,7 +494,7 @@ nsMessengerMigrator::ProceedWithMigration() // otherwise, they don't really have anything to migrate rv = m_prefs->CopyCharPref(PREF_4X_MAIL_POP_NAME, &prefvalue); if (NS_SUCCEEDED(rv)) { - if (!prefvalue || (PL_strlen(prefvalue) == 0)) { + if (!prefvalue || !*prefvalue) { rv = NS_ERROR_FAILURE; } } @@ -504,7 +504,7 @@ nsMessengerMigrator::ProceedWithMigration() // otherwise, they don't really have anything to migrate rv = m_prefs->CopyCharPref(PREF_4X_NETWORK_HOSTS_IMAP_SERVER, &prefvalue); if (NS_SUCCEEDED(rv)) { - if (!prefvalue || (PL_strlen(prefvalue) == 0)) { + if (!prefvalue || !*prefvalue) { rv = NS_ERROR_FAILURE; } } @@ -1023,7 +1023,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch if (NS_SUCCEEDED(rv)) { rv = mail_dir->GetUnixStyleFilePath(&mail_directory_value); } - if (NS_FAILED(rv) || !mail_directory_value || (PL_strlen(mail_directory_value) == 0)) { + if (NS_FAILED(rv) || !mail_directory_value || !*mail_directory_value) { #ifdef DEBUG_MIGRATOR printf("%s was not set, attempting to use %s instead.\n",PREF_PREMIGRATION_MAIL_DIRECTORY,PREF_MAIL_DIRECTORY); #endif @@ -1034,7 +1034,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch rv = mail_dir->GetUnixStyleFilePath(&mail_directory_value); } - if (NS_FAILED(rv) || !mail_directory_value || (PL_strlen(mail_directory_value) == 0)) { + if (NS_FAILED(rv) || !mail_directory_value || !*mail_directory_value) { NS_ASSERTION(0,"failed to get a base value for the mail.directory"); return NS_ERROR_UNEXPECTED; } @@ -1108,7 +1108,7 @@ nsMessengerMigrator::Convert4XUri(const char *old_uri, PRBool for_news, const ch // this meant it was reall / // this insanity only happened on mac and windows. // Need to escape spaces in folder name (ie, "A Folder" --> "A%20Folder"). - if (!folderPath || (PL_strlen(folderPath) == 0)) { + if (!folderPath || !*folderPath) { nsXPIDLCString escaped_default_folder; ESCAPE_FOLDER_NAME(escaped_default_folder, default_folder_name); *new_uri = PR_smprintf("%s/%s/%s",MAILBOX_SCHEMA,usernameAtHostname, escaped_default_folder.get()); diff --git a/mozilla/mailnews/base/src/nsMsgFolderCache.cpp b/mozilla/mailnews/base/src/nsMsgFolderCache.cpp index e13e61eb9cb..78d3f53d27f 100644 --- a/mozilla/mailnews/base/src/nsMsgFolderCache.cpp +++ b/mozilla/mailnews/base/src/nsMsgFolderCache.cpp @@ -350,7 +350,7 @@ NS_IMETHODIMP nsMsgFolderCache::GetCacheElement(const char *pathKey, PRBool crea if (!result || !pathKey || !m_cacheElements) return NS_ERROR_NULL_POINTER; - if (strlen(pathKey) == 0) { + if (!*pathKey) { return NS_ERROR_FAILURE; } diff --git a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp index 53d5b5a43cc..3e3924c641f 100644 --- a/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mozilla/mailnews/base/util/nsMsgIncomingServer.cpp @@ -666,10 +666,10 @@ nsMsgIncomingServer::GetPrettyName(PRUnichar **retval) { if (NS_FAILED(rv)) return rv; // if there's no name, then just return the hostname - if (nsCRT::strlen(val) == 0) + if (val.IsEmpty()) return GetConstructedPrettyName(retval); - else - *retval = nsCRT::strdup(val); + + *retval = nsCRT::strdup(val); return NS_OK; } @@ -1242,7 +1242,7 @@ nsMsgIncomingServer::GetRealHostName(char **aResult) nsresult rv; rv = GetCharValue("realhostname", aResult); NS_ENSURE_SUCCESS(rv, rv); - if (!*aResult || (strlen(*aResult) == 0)) + if (!*aResult || !**aResult) return(GetHostName(aResult)); if (PL_strchr(*aResult, ':')) @@ -1260,7 +1260,7 @@ nsMsgIncomingServer::GetRealUsername(char **aResult) nsresult rv; rv = GetCharValue("realuserName", aResult); NS_ENSURE_SUCCESS(rv, rv); - if (!*aResult || (strlen(*aResult) == 0)) + if (!*aResult || !**aResult) return(GetUsername(aResult)); return rv; diff --git a/mozilla/mailnews/compose/src/nsMsgCopy.cpp b/mozilla/mailnews/compose/src/nsMsgCopy.cpp index 48e8c79744f..f0f1ec469e8 100644 --- a/mozilla/mailnews/compose/src/nsMsgCopy.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCopy.cpp @@ -436,7 +436,7 @@ LocateMessageFolder(nsIMsgIdentity *userIdentity, if (!msgFolder) return NS_ERROR_NULL_POINTER; *msgFolder = nsnull; - if (!aFolderURI || (PL_strlen(aFolderURI) == 0)) { + if (!aFolderURI || !*aFolderURI) { return NS_ERROR_INVALID_ARG; } diff --git a/mozilla/mailnews/compose/src/nsSmtpProtocol.cpp b/mozilla/mailnews/compose/src/nsSmtpProtocol.cpp index 00602271cff..d76c10ecb82 100644 --- a/mozilla/mailnews/compose/src/nsSmtpProtocol.cpp +++ b/mozilla/mailnews/compose/src/nsSmtpProtocol.cpp @@ -851,7 +851,7 @@ PRInt32 nsSmtpProtocol::AuthLoginUsername() rv = smtpServer->GetUsername(getter_Copies(username)); - if (!(const char*) username || strlen((const char*)username) == 0) { + if (username.IsEmpty()) { rv = GetUsernamePassword(getter_Copies(username), getter_Copies(origPassword)); m_usernamePrompted = PR_TRUE; password.Assign(origPassword); @@ -1521,7 +1521,7 @@ nsSmtpProtocol::GetPassword(char **aPassword) rv = smtpServer->GetPassword(aPassword); NS_ENSURE_SUCCESS(rv,rv); - if (PL_strlen(*aPassword) > 0) + if (*aPassword && **aPassword) return rv; // empty password @@ -1619,12 +1619,12 @@ nsSmtpProtocol::GetUsernamePassword(char **aUsername, char **aPassword) rv = smtpServer->GetPassword(aPassword); NS_ENSURE_SUCCESS(rv,rv); - - if (PL_strlen(*aPassword) > 0) { + + if (*aPassword && **aPassword) { rv = smtpServer->GetUsername(aUsername); NS_ENSURE_SUCCESS(rv,rv); - - if (PL_strlen(*aUsername) > 0) + + if (*aUsername && **aUsername) return rv; // empty username diff --git a/mozilla/mailnews/compose/src/nsSmtpService.cpp b/mozilla/mailnews/compose/src/nsSmtpService.cpp index 8fc5e43bc1c..294394960a1 100644 --- a/mozilla/mailnews/compose/src/nsSmtpService.cpp +++ b/mozilla/mailnews/compose/src/nsSmtpService.cpp @@ -861,7 +861,7 @@ nsSmtpService::GetDefaultServer(nsISmtpServer **aServer) rv = pref->CopyCharPref("mail.smtp.defaultserver", getter_Copies(defaultServerKey)); if (NS_SUCCEEDED(rv) && - strlen(defaultServerKey) > 0) { + !defaultServerKey.IsEmpty()) { nsCOMPtr server; rv = GetServerByKey(defaultServerKey, diff --git a/mozilla/mailnews/imap/src/nsIMAPNamespace.cpp b/mozilla/mailnews/imap/src/nsIMAPNamespace.cpp index d11fae2ac3e..a1cc57721c7 100644 --- a/mozilla/mailnews/imap/src/nsIMAPNamespace.cpp +++ b/mozilla/mailnews/imap/src/nsIMAPNamespace.cpp @@ -77,7 +77,7 @@ int nsIMAPNamespace::MailboxMatchesNamespace(const char *boxname) if (!boxname) return -1; // If the namespace is part of the boxname - if (PL_strlen(m_prefix) == 0) + if (!m_prefix || !*m_prefix) return 0; if (PL_strstr(boxname, m_prefix) == boxname) diff --git a/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp b/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp index c726d3597df..a00f684fdbd 100644 --- a/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp +++ b/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp @@ -670,7 +670,7 @@ nsImapIncomingServer::CreateImapConnection(nsIEventQueue *aEventQueue, PR_CEnterMonitor(this); GetRedirectorType(getter_Copies(redirectorType)); - PRBool redirectLogon = ((const char *) redirectorType && strlen((const char *) redirectorType) > 0); + PRBool redirectLogon = !redirectorType.IsEmpty(); PRInt32 maxConnections = 5; // default to be five rv = GetMaximumConnectionsNumber(&maxConnections); @@ -922,8 +922,7 @@ nsImapIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow) rv = GetPassword(getter_Copies(password)); if (NS_FAILED(rv)) return rv; - if (!(const char*) password || - strlen((const char*) password) == 0) + if (password.IsEmpty()) return NS_OK; rv = ResetFoldersToUnverified(nsnull); @@ -1279,7 +1278,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath, if (hierarchyDelimiter != '/') nsImapUrl::UnescapeSlashes(NS_CONST_CAST(char*, dupFolderPath.get())); - if (! (onlineName.get()) || strlen(onlineName.get()) == 0 + if (onlineName.IsEmpty() || nsCRT::strcmp(onlineName.get(), dupFolderPath.get())) imapFolder->SetOnlineName(dupFolderPath.get()); if (hierarchyDelimiter != '/') diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp index 19fb2f238d4..9a7630cff1b 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp @@ -1790,7 +1790,7 @@ nsImapMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatab nsXPIDLCString onlineName; if (NS_SUCCEEDED((*folderInfo)->GetCharPtrProperty("onlineName", getter_Copies(onlineName)))) { - if ((const char*) onlineName && strlen((const char *) onlineName) > 0) + if (!onlineName.IsEmpty()) m_onlineFolderName.Assign(onlineName); else { diff --git a/mozilla/mailnews/imap/src/nsImapProtocol.cpp b/mozilla/mailnews/imap/src/nsImapProtocol.cpp index 1e4cd0105a3..3462d7f7d49 100644 --- a/mozilla/mailnews/imap/src/nsImapProtocol.cpp +++ b/mozilla/mailnews/imap/src/nsImapProtocol.cpp @@ -5057,7 +5057,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec, } nsXPIDLCString oldMsgId; rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(oldMsgId)); - if (NS_SUCCEEDED(rv) && strlen(oldMsgId) > 0) + if (NS_SUCCEEDED(rv) && !oldMsgId.IsEmpty()) { PRBool idsAreUids = PR_TRUE; m_runningUrl->MessageIdsAreUids(&idsAreUids); diff --git a/mozilla/mailnews/imap/src/nsImapService.cpp b/mozilla/mailnews/imap/src/nsImapService.cpp index 2cd0614e070..202fed91dfa 100644 --- a/mozilla/mailnews/imap/src/nsImapService.cpp +++ b/mozilla/mailnews/imap/src/nsImapService.cpp @@ -171,7 +171,7 @@ nsImapService::GetFolderName(nsIMsgFolder* aImapFolder, rv = aFolder->GetOnlineName(getter_Copies(onlineName)); if (NS_FAILED(rv)) return rv; - if ((const char *)onlineName == nsnull || strlen((const char *) onlineName) == 0) + if (onlineName.IsEmpty()) { char *uri = nsnull; rv = aImapFolder->GetURI(&uri); @@ -1790,7 +1790,7 @@ nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue, if (NS_SUCCEEDED(rv)) { - if (folderPath && (strlen(folderPath) > 0)) + if (folderPath && *folderPath) { nsCOMPtr uri = do_QueryInterface(aImapUrl); @@ -1829,7 +1829,7 @@ NS_IMETHODIMP nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue, nsIMsgFolder* aImapMailFolder, nsIUrlListener* aUrlListener, - const char *folderPath, + const char *folderPath, PRInt32 level, nsIURI** aURL) { @@ -1850,22 +1850,20 @@ nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue, if (NS_SUCCEEDED(rv)) { - if (folderPath && (strlen(folderPath) > 0)) - { - nsCOMPtr uri = do_QueryInterface(aImapUrl); - urlSpec.Append("/discoverlevelchildren>"); - urlSpec.AppendInt(level); - urlSpec.Append(char(hierarchySeparator)); // hierarchySeparator "/" - urlSpec.Append(folderPath); + if (!folderPath || !*folderPath) + return NS_ERROR_NULL_POINTER; - rv = uri->SetSpec(urlSpec); - if (NS_SUCCEEDED(rv)) - rv = GetImapConnectionAndLoadUrl(aClientEventQueue, - aImapUrl, - nsnull, aURL); - } - else - rv = NS_ERROR_NULL_POINTER; + nsCOMPtr uri = do_QueryInterface(aImapUrl); + urlSpec.Append("/discoverlevelchildren>"); + urlSpec.AppendInt(level); + urlSpec.Append(char(hierarchySeparator)); // hierarchySeparator "/" + urlSpec.Append(folderPath); + + rv = uri->SetSpec(urlSpec); + if (NS_SUCCEEDED(rv)) + rv = GetImapConnectionAndLoadUrl(aClientEventQueue, + aImapUrl, + nsnull, aURL); } } return rv; @@ -2329,7 +2327,7 @@ nsImapService::CreateFolder(nsIEventQueue* eventQueue, nsIMsgFolder* parent, GetFolderName(parent, getter_Copies(folderName)); urlSpec.Append("/create>"); urlSpec.Append(char(hierarchySeparator)); - if ((const char *) folderName && strlen(folderName) > 0) + if (!folderName.IsEmpty()) { nsXPIDLCString canonicalName; @@ -2380,7 +2378,7 @@ nsImapService::EnsureFolderExists(nsIEventQueue* eventQueue, nsIMsgFolder* paren GetFolderName(parent, getter_Copies(folderName)); urlSpec.Append("/ensureExists>"); urlSpec.Append(char(hierarchySeparator)); - if ((const char *) folderName && strlen(folderName) > 0) + if (!folderName.IsEmpty()) { urlSpec.Append((const char *) folderName); urlSpec.Append(char(hierarchySeparator)); @@ -2430,7 +2428,7 @@ nsImapService::ListFolder(nsIEventQueue* aClientEventQueue, GetFolderName(aImapMailFolder, getter_Copies(folderName)); urlSpec.Append("/listfolder>"); urlSpec.Append(char(hierarchySeparator)); - if ((const char *) folderName && strlen(folderName) > 0) + if (!folderName.IsEmpty()) { urlSpec.Append((const char *) folderName); rv = uri->SetSpec(urlSpec); diff --git a/mozilla/mailnews/local/src/nsMovemailService.cpp b/mozilla/mailnews/local/src/nsMovemailService.cpp index 046c3547cbd..990dd05e412 100644 --- a/mozilla/mailnews/local/src/nsMovemailService.cpp +++ b/mozilla/mailnews/local/src/nsMovemailService.cpp @@ -467,7 +467,7 @@ nsMovemailService::GetNewMail(nsIMsgWindow *aMsgWindow, // then the file mysteriously ended) then abort // parsing. if (numlines == 0 && - nsCRT::strlen(buffer) == 0 && + !*buffer && spoolfile->eof()) { #ifdef MOVEMAIL_DEBUG fprintf(stderr, "*** Utterly empty spool file\n"); diff --git a/mozilla/mailnews/mime/src/mimetpla.cpp b/mozilla/mailnews/mime/src/mimetpla.cpp index c53623fde54..588fcb55a03 100644 --- a/mozilla/mailnews/mime/src/mimetpla.cpp +++ b/mozilla/mailnews/mime/src/mimetpla.cpp @@ -110,7 +110,7 @@ MimeTextBuildPrefixCSS(PRInt32 quotedSizeSetting, // mail.quoted_size break; } - if (citationColor && strlen(citationColor) != 0) + if (citationColor && *citationColor) { formatString += "color: "; formatString += citationColor; diff --git a/mozilla/mailnews/news/src/nsNewsFolder.cpp b/mozilla/mailnews/news/src/nsNewsFolder.cpp index 6d9ff7015d6..648bae5f563 100644 --- a/mozilla/mailnews/news/src/nsNewsFolder.cpp +++ b/mozilla/mailnews/news/src/nsNewsFolder.cpp @@ -557,7 +557,7 @@ NS_IMETHODIMP nsMsgNewsFolder::CreateSubfolder(const PRUnichar *uninewsgroupname nsresult rv = NS_OK; NS_ENSURE_ARG_POINTER(uninewsgroupname); - if (nsCRT::strlen(uninewsgroupname) == 0) return NS_ERROR_FAILURE; + if (!*uninewsgroupname) return NS_ERROR_FAILURE; nsCAutoString newsgroupname; newsgroupname.AssignWithConversion(uninewsgroupname); diff --git a/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp b/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp index a98adde4493..320ef93df1f 100755 --- a/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp +++ b/mozilla/modules/oji/tests/src/TestLoader/OJITestLoader.cpp @@ -149,7 +149,7 @@ char** OJITestLoader::loadTestList() { pos = content; while((pos1 = PL_strchr(pos, '\n'))) { *pos1 = 0; - if(PL_strlen(pos) > 0 && *pos != '#') { + if(*pos && *pos != '#') { //printf("First char: %c\n", *pos); testList[count++] = PL_strdup(pos); } @@ -162,7 +162,7 @@ char** OJITestLoader::loadTestList() { } } //If there is no \n after last line - if (PL_strlen(pos) > 0 && *pos != '#') { + if (*pos && *pos != '#') { testList[count++] = PL_strdup(pos); testList[count] = 0; } diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp index 9741609239f..2ad6ac753ae 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp @@ -228,7 +228,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) // get name and description of this plugin version_info vinfo; if (appinfo.GetVersionInfo(&vinfo, B_APP_VERSION_KIND) == B_OK - && strlen(vinfo.short_info) > 0) { + && *vinfo.short_info) { // XXX convert UTF-8 2byte chars to 1 byte chars, to avoid string corruption info.fName = ToNewCString(NS_ConvertUTF8toUCS2(vinfo.short_info)); info.fDescription = ToNewCString(NS_ConvertUTF8toUCS2(vinfo.long_info)); diff --git a/mozilla/modules/plugin/samples/default/os2/plugin.cpp b/mozilla/modules/plugin/samples/default/os2/plugin.cpp index 685714a38fd..155c745c7e4 100644 --- a/mozilla/modules/plugin/samples/default/os2/plugin.cpp +++ b/mozilla/modules/plugin/samples/default/os2/plugin.cpp @@ -105,28 +105,28 @@ CPlugin::CPlugin(HMODULE hInst, assert(m_hInst != NULL); assert(m_pNPInstance != NULL); - if((pluginType != NULL) && (strlen((PSZ)pluginType) != 0)) + if(pluginType && *pluginType) { m_pNPMIMEType = (NPMIMEType)new char[strlen((PSZ)pluginType) + 1]; if(m_pNPMIMEType != NULL) strcpy((PSZ)m_pNPMIMEType, pluginType); } - if((szPageURL != NULL) && (strlen(szPageURL) != 0)) + if(szPageURL && *szPageURL) { m_szPageURL = new char[strlen(szPageURL) + 1]; if(m_szPageURL != NULL) strcpy(m_szPageURL, szPageURL); } - if((szFileURL != NULL) && (strlen(szFileURL) != 0)) + if(szFileURL && *szFileURL) { m_szFileURL = new char[strlen(szFileURL) + 1]; if(m_szFileURL != NULL) strcpy(m_szFileURL, szFileURL); } - if((szFileExtension != NULL) && (strlen(szFileExtension) != 0)) + if(szFileExtension && *szFileExtension) { m_szFileExtension = new char[strlen(szFileExtension) + 1]; if(m_szFileExtension != NULL) @@ -137,7 +137,7 @@ CPlugin::CPlugin(HMODULE hInst, char szString[1024] = {'\0'}; WinLoadString((HAB)0, m_hInst, IDS_CLICK_TO_GET, sizeof(szString), szString); - if(strlen(szString) != 0) + if(*szString) { m_szCommandMessage = new char[strlen(szString) + 1]; if(m_szCommandMessage != NULL) @@ -446,7 +446,7 @@ void CPlugin::showGetPluginDialog() char szString[1024] = {'\0'}; WinLoadString((HAB)0, m_hInst, IDS_CLICK_WHEN_DONE, sizeof(szString), szString); - if(strlen(szString) != 0) + if(*szString) { m_szCommandMessage = new char[strlen(szString) + 1]; if(m_szCommandMessage != NULL) diff --git a/mozilla/modules/plugin/samples/default/os2/utils.cpp b/mozilla/modules/plugin/samples/default/os2/utils.cpp index 69649a28174..069939577eb 100644 --- a/mozilla/modules/plugin/samples/default/os2/utils.cpp +++ b/mozilla/modules/plugin/samples/default/os2/utils.cpp @@ -100,7 +100,7 @@ static int getWindowStringLength(HWND hWnd, PSZ lpsz) void SetDlgItemTextWrapped(HWND hWnd, int iID, PSZ szText) { HWND hWndStatic = WinWindowFromID(hWnd, iID); - if((szText == NULL) || (strlen(szText) == 0)) + if(!szText || !*szText) { WinSetDlgItemText(hWnd, iID, ""); return; diff --git a/mozilla/modules/plugin/samples/default/windows/plugin.cpp b/mozilla/modules/plugin/samples/default/windows/plugin.cpp index 00ccdbcd536..4613c8d9200 100644 --- a/mozilla/modules/plugin/samples/default/windows/plugin.cpp +++ b/mozilla/modules/plugin/samples/default/windows/plugin.cpp @@ -126,28 +126,28 @@ CPlugin::CPlugin(HINSTANCE hInst, assert(m_hInst != NULL); assert(m_pNPInstance != NULL); - if((pluginType != NULL) && (lstrlen((LPSTR)pluginType) != 0)) + if(pluginType && *pluginType) { m_pNPMIMEType = (NPMIMEType)new char[lstrlen((LPSTR)pluginType) + 1]; if(m_pNPMIMEType != NULL) lstrcpy((LPSTR)m_pNPMIMEType, pluginType); } - if((szPageURL != NULL) && (lstrlen(szPageURL) != 0)) + if(szPageURL && *szPageURL) { m_szPageURL = new char[lstrlen(szPageURL) + 1]; if(m_szPageURL != NULL) lstrcpy(m_szPageURL, szPageURL); } - if((szFileURL != NULL) && (lstrlen(szFileURL) != 0)) + if(szFileURL && *szFileURL) { m_szFileURL = new char[lstrlen(szFileURL) + 1]; if(m_szFileURL != NULL) lstrcpy(m_szFileURL, szFileURL); } - if((szFileExtension != NULL) && (lstrlen(szFileExtension) != 0)) + if(szFileExtension && *szFileExtension) { m_szFileExtension = new char[lstrlen(szFileExtension) + 1]; if(m_szFileExtension != NULL) @@ -158,7 +158,7 @@ CPlugin::CPlugin(HINSTANCE hInst, char szString[1024] = {'\0'}; LoadString(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString)); - if(lstrlen(szString) != 0) + if(*szString) { m_szCommandMessage = new char[lstrlen(szString) + 1]; if(m_szCommandMessage != NULL) @@ -453,7 +453,7 @@ void CPlugin::getPluginSmart() dbgOut3("%#08x '%s'", m_pNPInstance, szJSString); - assert(lstrlen(szJSString) > 0); + assert(*szJSString); NPN_GetURL(m_pNPInstance, szJSString, "smartupdate_plugin_finder"); */ @@ -507,7 +507,7 @@ void CPlugin::getPlugin() char szString[1024] = {'\0'}; LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); - if(lstrlen(szString) != 0) + if(*szString) { m_szCommandMessage = new char[lstrlen(szString) + 1]; if(m_szCommandMessage != NULL) diff --git a/mozilla/modules/plugin/tools/spy/common/logger.cpp b/mozilla/modules/plugin/tools/spy/common/logger.cpp index a9c6b7f7fab..d701ab23cc2 100644 --- a/mozilla/modules/plugin/tools/spy/common/logger.cpp +++ b/mozilla/modules/plugin/tools/spy/common/logger.cpp @@ -331,7 +331,7 @@ void Logger::setOnTop(BOOL ontop) void Logger::setToFile(BOOL tofile, char * filename) { - if(!filename || (strlen(filename) == 0) || (strlen(filename) > _MAX_PATH)) + if(!filename || !*filename || (strlen(filename) > _MAX_PATH)) { bToFile = FALSE; return; diff --git a/mozilla/modules/plugin/tools/tester/common/plugbase.cpp b/mozilla/modules/plugin/tools/tester/common/plugbase.cpp index 5b1b2185428..fcc9d0a2438 100644 --- a/mozilla/modules/plugin/tools/tester/common/plugbase.cpp +++ b/mozilla/modules/plugin/tools/tester/common/plugbase.cpp @@ -123,7 +123,7 @@ void CPluginBase::getLogFileName(LPSTR szLogFileName, int iSize) getModulePath(szFileName, sizeof(szFileName)); strcat(szFileName, szINIFile); XP_GetPrivateProfileString(SECTION_LOG, KEY_FILE_NAME, "", szLogFileName, (DWORD)iSize, szFileName); - if(strlen(szLogFileName) == 0) + if(!*szLogFileName) { strcpy(szLogFileName, m_szScriptCacheFile); diff --git a/mozilla/modules/plugin/tools/tester/common/xp.cpp b/mozilla/modules/plugin/tools/tester/common/xp.cpp index 2627482a1de..959c8157e4e 100644 --- a/mozilla/modules/plugin/tools/tester/common/xp.cpp +++ b/mozilla/modules/plugin/tools/tester/common/xp.cpp @@ -170,7 +170,7 @@ int XP_GetPrivateProfileInt(LPSTR szSection, LPSTR szKey, int iDefault, LPSTR sz #else static char szString[80]; XP_GetPrivateProfileString(szSection, szKey, "", szString, sizeof(szString), szFileName); - if(strlen(szString) == 0) + if(!*szString) return iDefault; int iRet = atoi(szString); return iRet; diff --git a/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp b/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp index 7964cb0884c..018f6f9b887 100644 --- a/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp +++ b/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp @@ -291,7 +291,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr) { PRUnichar *result = nsnull; if (NS_SUCCEEDED(rv = gTextToSubURI->UnEscapeAndConvert(mEncoding.get(), filename.get(), &result)) && (result)) { - if (nsCRT::strlen(result) > 0) { + if (*result) { aIdx->SetLocation(filename.get()); if (!mHasDescription) aIdx->SetDescription(result); diff --git a/mozilla/netwerk/test/urltest.cpp b/mozilla/netwerk/test/urltest.cpp index 33c3ea79a1e..87ebf4226f6 100644 --- a/mozilla/netwerk/test/urltest.cpp +++ b/mozilla/netwerk/test/urltest.cpp @@ -192,7 +192,7 @@ nsresult testURL(const char* i_pURL, PRInt32 urlFactory = URL_FACTORY_DEFAULT) while (testfile.getline(temp,512)) { - if ((*temp == '#') || (PL_strlen(temp)==0)) + if (*temp == '#' || !*temp) continue; if (0 == count%3) diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index bae8de1f54d..6f3ae2ccde1 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -1234,8 +1234,8 @@ nsPrefMigration::CreateNewUser5Tree(nsIFileSpec * oldProfilePath, nsIFileSpec * nsresult rv; PRBool exists; - NS_ASSERTION((PL_strlen(PREF_FILE_NAME_IN_4x) > 0), "don't know how to migrate your platform"); - if (PL_strlen(PREF_FILE_NAME_IN_4x) == 0) { + NS_ASSERTION(*PREF_FILE_NAME_IN_4x, "don't know how to migrate your platform"); + if (!*PREF_FILE_NAME_IN_4x) { return NS_ERROR_UNEXPECTED; } @@ -1320,7 +1320,7 @@ nsPrefMigration::GetDirFromPref(nsIFileSpec * oldProfilePath, nsIFileSpec * newP // the default on the mac was "". doing GetFileXPref on that would return // the current working directory, like viewer_debug. yikes! - if (!(const char*)oldPrefPathStr || (PL_strlen(oldPrefPathStr) == 0)) { + if (oldPrefPathStr.IsEmpty()) { rv = NS_ERROR_FAILURE; } if (NS_FAILED(rv)) return rv; @@ -2322,7 +2322,7 @@ ConvertPrefToUTF8(const char *prefname, nsIPref *prefs, nsAutoString &charSet) rv = prefs->CopyCharPref(prefname, getter_Copies(prefval)); if (NS_FAILED(rv)) return rv; - if (!((const char *)prefval) || (PL_strlen((const char *)prefval) == 0)) { + if (prefval.IsEmpty()) { // no need to convert "" return NS_OK; } diff --git a/mozilla/security/manager/ssl/src/nsPKCS11Slot.cpp b/mozilla/security/manager/ssl/src/nsPKCS11Slot.cpp index 1d3e7214d13..d0b19e4926a 100644 --- a/mozilla/security/manager/ssl/src/nsPKCS11Slot.cpp +++ b/mozilla/security/manager/ssl/src/nsPKCS11Slot.cpp @@ -94,7 +94,7 @@ NS_IMETHODIMP nsPKCS11Slot::GetName(PRUnichar **aName) { char *csn = PK11_GetSlotName(mSlot); - if (strlen(csn) > 0) { + if (*csn) { *aName = ToNewUnicode(NS_ConvertUTF8toUCS2(csn)); } else if (PK11_HasRootCerts(mSlot)) { // This is a workaround to an NSS bug - the root certs module has diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp index e6c0a81d10d..79542895a83 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp @@ -598,7 +598,7 @@ nsIMEStatus::repaint_filter(Display *aDisplay, Window aWindow, if (thiswindow && thiswindow->mAttachedWindow) { nsIMEGtkIC *xic = thiswindow->mAttachedWindow->IMEGetInputContext(PR_FALSE); if (xic && xic->mStatusText) { - if(nsCRT::strlen(xic->mStatusText) == 0) { + if(!*xic->mStatusText) { thiswindow->hide(); } else { thiswindow->setText(xic->mStatusText); diff --git a/mozilla/widget/src/gtk2/nsWindow.cpp b/mozilla/widget/src/gtk2/nsWindow.cpp index 5e228b235d1..c659471e169 100644 --- a/mozilla/widget/src/gtk2/nsWindow.cpp +++ b/mozilla/widget/src/gtk2/nsWindow.cpp @@ -3501,7 +3501,7 @@ IM_preedit_changed_cb(GtkIMContext *context, LOGIM(("preedit string is: %s length is: %d\n", preedit_string, strlen(preedit_string))); - if ((preedit_string == NULL) || (0 == strlen(preedit_string))) { + if (!preedit_string || !*preedit_string) { window->IMEComposeStart(); window->IMEComposeText(NULL, 0, NULL, NULL); return; diff --git a/mozilla/widget/src/windows/nsBidiKeyboard.cpp b/mozilla/widget/src/windows/nsBidiKeyboard.cpp index 7298f7d299e..0f6176cfae7 100644 --- a/mozilla/widget/src/windows/nsBidiKeyboard.cpp +++ b/mozilla/widget/src/windows/nsBidiKeyboard.cpp @@ -56,7 +56,7 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) strncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH); currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate - NS_ASSERTION((strlen(currentLocaleName) > 0), + NS_ASSERTION(*currentLocaleName, "currentLocaleName has string length == 0"); if (strcmp(mCurrentLocaleName, currentLocaleName)) { @@ -80,7 +80,7 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) if (!::GetKeyboardLayoutName(mCurrentLocaleName)) return NS_ERROR_FAILURE; - NS_ASSERTION((strlen(mCurrentLocaleName) > 0), + NS_ASSERTION(*mCurrentLocaleName, "GetKeyboardLayoutName return string length == 0"); NS_ASSERTION((strlen(mCurrentLocaleName) < KL_NAMELENGTH), "GetKeyboardLayoutName return string length >= KL_NAMELENGTH"); @@ -157,7 +157,7 @@ nsresult nsBidiKeyboard::EnumerateKeyboards() if (!::GetKeyboardLayoutName(localeName)) return NS_ERROR_FAILURE; - NS_ASSERTION((strlen(localeName) > 0), + NS_ASSERTION(*localeName, "GetKeyboardLayoutName return string length == 0"); NS_ASSERTION((strlen(localeName) < KL_NAMELENGTH), "GetKeyboardLayout return string length >= KL_NAMELENGTH"); @@ -179,9 +179,9 @@ nsresult nsBidiKeyboard::EnumerateKeyboards() } } - NS_ASSERTION((strlen(mRTLKeyboard) > 0), + NS_ASSERTION(*mRTLKeyboard, "mLTRKeyboard has string length == 0"); - NS_ASSERTION((strlen(mLTRKeyboard) > 0), + NS_ASSERTION(*mLTRKeyboard, "mLTRKeyboard has string length == 0"); return NS_OK; diff --git a/mozilla/xpcom/io/nsFileSpecOS2.cpp b/mozilla/xpcom/io/nsFileSpecOS2.cpp index 65175de2b5d..8591b0f056a 100644 --- a/mozilla/xpcom/io/nsFileSpecOS2.cpp +++ b/mozilla/xpcom/io/nsFileSpecOS2.cpp @@ -124,7 +124,7 @@ void nsFileSpecHelpers::UnixToNative(nsSimpleCharString& ioPath) // Strip initial slash for an absolute path char* src = (char*)ioPath; if (*src == '/') { - if (PL_strlen(src+1)==0) { + if (!src[1]) { // allocate new string by copying from ioPath[1] nsSimpleCharString temp = src + 1; ioPath = temp; diff --git a/mozilla/xpcom/io/nsFileSpecWin.cpp b/mozilla/xpcom/io/nsFileSpecWin.cpp index dd398bb8ce0..5b389243c26 100644 --- a/mozilla/xpcom/io/nsFileSpecWin.cpp +++ b/mozilla/xpcom/io/nsFileSpecWin.cpp @@ -112,7 +112,7 @@ void nsFileSpecHelpers::UnixToNative(nsSimpleCharString& ioPath) // Strip initial slash for an absolute path char* src = (char*)ioPath; if (*src == '/') { - if (PL_strlen(src+1)==0) { + if (!src[1]) { // allocate new string by copying from ioPath[1] nsSimpleCharString temp = src + 1; ioPath = temp; diff --git a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp index 11d395b9dec..a9bda07a1f4 100644 --- a/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp +++ b/mozilla/xpcom/io/nsSpecialSystemDirectory.cpp @@ -1053,7 +1053,7 @@ void nsSpecialSystemDirectory::operator = (SystemDirectories aSystemSystemDirect char *tPath = PR_GetEnv("MOZILLA_HOME"); /* If MOZILLA_HOME is not set, use GetCurrentProcessDirectory */ /* To ensure we get a long filename system */ - if (!tPath || PL_strlen(tPath) == 0) + if (!tPath || !*tPath) GetCurrentProcessDirectory(*this); else *this = tPath; diff --git a/mozilla/xpinstall/wizard/mac/src/InstAction.c b/mozilla/xpinstall/wizard/mac/src/InstAction.c index d198a7778bf..a12b3d7a506 100644 --- a/mozilla/xpinstall/wizard/mac/src/InstAction.c +++ b/mozilla/xpinstall/wizard/mac/src/InstAction.c @@ -630,7 +630,7 @@ DownloadFile(Handle destFolder, long destFolderLen, Handle archive, int resPos, else if (strncmp(URL, kFTP, strlen(kFTP)) == 0) { rv = ParseFTPURL(URL, &ftpHost, &ftpPath); - if ((0 == strlen(ftpHost)) || (0 == strlen(ftpPath))) + if (!*ftpHost || !*ftpPath) { rv = nsHTTPConn::E_MALFORMED_URL; } diff --git a/mozilla/xpinstall/wizard/mac/src/Parser.c b/mozilla/xpinstall/wizard/mac/src/Parser.c index 057815b188a..da25d9788ad 100644 --- a/mozilla/xpinstall/wizard/mac/src/Parser.c +++ b/mozilla/xpinstall/wizard/mac/src/Parser.c @@ -1184,7 +1184,7 @@ FindKeyValue(const char *cfg, const char *inSectionName, const char *inKey, char /* find next key [sectionPtr moved past next key per iteration] */ while(GetNextKeyVal(sectionPtr, key, outValue)) { - if (0cfg->checks[i].filename); - if (0 == strlen(*gControls->cfg->checks[i].filename)) + if (!**gControls->cfg->checks[i].filename) { HUnlock(gControls->cfg->checks[i].filename); continue;