Bug 743581: Removes nsCRT::strlen(const PRUnichar*). f=sgautherie r=dougt
authorShriram Kunchanapalli <kshriram18@gmail.com>
Wed, 30 May 2012 18:43:39 +0100
changeset 95302 f2796ce2a1750576c37a9f18c723c61ac2aa9d27
parent 95301 abd1cd57e194ed2ffde698a4e4f9cb99c3f9451a
child 95303 fb238b1ab6dcda528e4217edea614362936e1939
push idunknown
push userunknown
push dateunknown
reviewersdougt
bugs743581
milestone15.0a1
Bug 743581: Removes nsCRT::strlen(const PRUnichar*). f=sgautherie r=dougt
content/xml/document/src/nsXMLContentSink.cpp
content/xul/document/src/nsXULContentSink.cpp
dom/base/nsDOMClassInfo.cpp
extensions/spellcheck/hunspell/src/mozHunspell.cpp
extensions/spellcheck/src/mozEnglishWordUtils.cpp
intl/uconv/src/nsTextToSubURI.cpp
intl/unicharutil/src/nsEntityConverter.cpp
intl/unicharutil/src/nsSaveAsCharset.cpp
layout/base/nsBidi.cpp
layout/printing/nsPrintEngine.cpp
netwerk/protocol/http/nsHttpAuthCache.cpp
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
parser/htmlparser/src/nsHTMLTags.cpp
uriloader/exthandler/mac/nsOSHelperAppService.mm
widget/cocoa/nsDeviceContextSpecX.mm
widget/cocoa/nsPrintDialogX.mm
widget/windows/nsClipboard.cpp
widget/windows/nsFilePicker.cpp
xpcom/ds/nsCRT.cpp
xpcom/ds/nsCRT.h
xpcom/ds/nsHashtable.cpp
xpcom/ds/nsVariant.cpp
xpcom/io/nsBinaryStream.cpp
xpcom/io/nsEscape.cpp
xpcom/io/nsLinebreakConverter.cpp
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -1423,28 +1423,28 @@ nsXMLContentSink::ReportError(const PRUn
   nsAutoString parsererror(errorNs);
   parsererror.Append((PRUnichar)0xFFFF);
   parsererror.AppendLiteral("parsererror");
   
   rv = HandleStartElement(parsererror.get(), noAtts, 0, -1, (PRUint32)-1,
                           false);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = HandleCharacterData(aErrorText, nsCRT::strlen(aErrorText), false);
+  rv = HandleCharacterData(aErrorText, NS_strlen(aErrorText), false);
   NS_ENSURE_SUCCESS(rv, rv);  
   
   nsAutoString sourcetext(errorNs);
   sourcetext.Append((PRUnichar)0xFFFF);
   sourcetext.AppendLiteral("sourcetext");
 
   rv = HandleStartElement(sourcetext.get(), noAtts, 0, -1, (PRUint32)-1,
                           false);
   NS_ENSURE_SUCCESS(rv, rv);
   
-  rv = HandleCharacterData(aSourceText, nsCRT::strlen(aSourceText), false);
+  rv = HandleCharacterData(aSourceText, NS_strlen(aSourceText), false);
   NS_ENSURE_SUCCESS(rv, rv);
   
   rv = HandleEndElement(sourcetext.get(), false);
   NS_ENSURE_SUCCESS(rv, rv); 
   
   rv = HandleEndElement(parsererror.get(), false);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/content/xul/document/src/nsXULContentSink.cpp
+++ b/content/xul/document/src/nsXULContentSink.cpp
@@ -690,27 +690,27 @@ XULContentSinkImpl::ReportError(const PR
 
   nsAutoString parsererror(errorNs);
   parsererror.Append((PRUnichar)0xFFFF);
   parsererror.AppendLiteral("parsererror");
   
   rv = HandleStartElement(parsererror.get(), noAtts, 0, -1, 0);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  rv = HandleCharacterData(aErrorText, nsCRT::strlen(aErrorText));
+  rv = HandleCharacterData(aErrorText, NS_strlen(aErrorText));
   NS_ENSURE_SUCCESS(rv,rv);  
   
   nsAutoString sourcetext(errorNs);
   sourcetext.Append((PRUnichar)0xFFFF);
   sourcetext.AppendLiteral("sourcetext");
 
   rv = HandleStartElement(sourcetext.get(), noAtts, 0, -1, 0);
   NS_ENSURE_SUCCESS(rv,rv);
   
-  rv = HandleCharacterData(aSourceText, nsCRT::strlen(aSourceText));
+  rv = HandleCharacterData(aSourceText, NS_strlen(aSourceText));
   NS_ENSURE_SUCCESS(rv,rv);
   
   rv = HandleEndElement(sourcetext.get());
   NS_ENSURE_SUCCESS(rv,rv); 
   
   rv = HandleEndElement(parsererror.get());
   NS_ENSURE_SUCCESS(rv,rv);
 
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -5049,17 +5049,17 @@ nsDOMClassInfo::PostCreatePrototype(JSCo
         win->IsClosedOrClosing()) {
       return NS_OK;
     }
   }
 
   // Don't overwrite a property set by content.
   JSBool found;
   if (!::JS_AlreadyHasOwnUCProperty(cx, global, reinterpret_cast<const jschar*>(mData->mNameUTF16),
-                                    nsCRT::strlen(mData->mNameUTF16), &found)) {
+                                    NS_strlen(mData->mNameUTF16), &found)) {
     return NS_ERROR_FAILURE;
   }
 
   nsScriptNameSpaceManager *nameSpaceManager =
     nsJSRuntime::GetNameSpaceManager();
   NS_ENSURE_TRUE(nameSpaceManager, NS_OK);
 
   bool unused;
@@ -5925,17 +5925,17 @@ public:
                        bool *_retval);
 
   nsresult Install(JSContext *cx, JSObject *target, jsval thisAsVal)
   {
     // The 'attrs' argument used to be JSPROP_PERMANENT. See bug 628612.
     JSBool ok = JS_WrapValue(cx, &thisAsVal) &&
       ::JS_DefineUCProperty(cx, target,
                             reinterpret_cast<const jschar *>(mClassName),
-                            nsCRT::strlen(mClassName), thisAsVal, nsnull,
+                            NS_strlen(mClassName), thisAsVal, nsnull,
                             nsnull, 0);
 
     return ok ? NS_OK : NS_ERROR_UNEXPECTED;
   }
 
   nsresult ResolveInterfaceConstants(JSContext *cx, JSObject *obj);
 
 private:
--- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp
@@ -493,17 +493,17 @@ mozHunspell::LoadDictionariesFromDir(nsI
 }
 
 nsresult mozHunspell::ConvertCharset(const PRUnichar* aStr, char ** aDst)
 {
   NS_ENSURE_ARG_POINTER(aDst);
   NS_ENSURE_TRUE(mEncoder, NS_ERROR_NULL_POINTER);
 
   PRInt32 outLength;
-  PRInt32 inLength = nsCRT::strlen(aStr);
+  PRInt32 inLength = NS_strlen(aStr);
   nsresult rv = mEncoder->GetMaxLength(aStr, inLength, &outLength);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aDst = (char *) nsMemory::Alloc(sizeof(char) * (outLength+1));
   NS_ENSURE_TRUE(*aDst, NS_ERROR_OUT_OF_MEMORY);
 
   rv = mEncoder->Convert(aStr, &inLength, *aDst, &outLength);
   if (NS_SUCCEEDED(rv))
--- a/extensions/spellcheck/src/mozEnglishWordUtils.cpp
+++ b/extensions/spellcheck/src/mozEnglishWordUtils.cpp
@@ -240,17 +240,17 @@ NS_IMETHODIMP mozEnglishWordUtils::FromR
 
   PRInt32 length;
   PRUnichar **tmpPtr  = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *)*icount);
   if (!tmpPtr)
     return NS_ERROR_OUT_OF_MEMORY;
 
   mozEnglishWordUtils::myspCapitalization ct = captype(word);
   for(PRUint32 i = 0; i < icount; ++i) {
-    length = nsCRT::strlen(iwords[i]);
+    length = NS_strlen(iwords[i]);
     tmpPtr[i] = (PRUnichar *) nsMemory::Alloc(sizeof(PRUnichar) * (length + 1));
     if (NS_UNLIKELY(!tmpPtr[i])) {
       NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, tmpPtr);
       return NS_ERROR_OUT_OF_MEMORY;
     }
     memcpy(tmpPtr[i], iwords[i], (length + 1) * sizeof(PRUnichar));
 
     nsAutoString capTest(tmpPtr[i]);
--- a/intl/uconv/src/nsTextToSubURI.cpp
+++ b/intl/uconv/src/nsTextToSubURI.cpp
@@ -40,17 +40,17 @@ NS_IMETHODIMP  nsTextToSubURI::ConvertAn
      rv = ccm->GetUnicodeEncoder(charset, &encoder);
      NS_RELEASE(ccm);
      if (NS_SUCCEEDED(rv)) {
        rv = encoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nsnull, (PRUnichar)'?');
        if(NS_SUCCEEDED(rv))
        {
           char buf[256];
           char *pBuf = buf;
-          PRInt32 ulen = nsCRT::strlen(text);
+          PRInt32 ulen = NS_strlen(text);
           PRInt32 outlen = 0;
           if(NS_SUCCEEDED(rv = encoder->GetMaxLength(text, ulen, &outlen))) 
           {
              if(outlen >= 256) {
                 pBuf = (char*)NS_Alloc(outlen+1);
              }
              if(nsnull == pBuf) {
                 outlen = 255;
--- a/intl/unicharutil/src/nsEntityConverter.cpp
+++ b/intl/unicharutil/src/nsEntityConverter.cpp
@@ -194,17 +194,17 @@ nsEntityConverter::ConvertToEntities(con
   if((nsnull == inString) || (nsnull == _retval))
     return NS_ERROR_NULL_POINTER;
   *_retval = NULL;
 
   const PRUnichar *entity = NULL;
   nsString outString;
 
   // per character look for the entity
-  PRUint32 len = nsCRT::strlen(inString);
+  PRUint32 len = NS_strlen(inString);
   for (PRUint32 i = 0; i < len; i++) {
     nsAutoString key(NS_LITERAL_STRING("entity."));
     if (NS_IS_HIGH_SURROGATE(inString[i]) &&
         i + 2 < len &&
         NS_IS_LOW_SURROGATE(inString[i + 1])) {
       key.AppendInt(SURROGATE_TO_UCS4(inString[i], inString[i+1]), 10);
       ++i;
     }
--- a/intl/unicharutil/src/nsSaveAsCharset.cpp
+++ b/intl/unicharutil/src/nsSaveAsCharset.cpp
@@ -166,17 +166,17 @@ nsSaveAsCharset::DoCharsetConversion(con
 {
   if(nsnull == outString )
     return NS_ERROR_NULL_POINTER;
   NS_ASSERTION(outString, "invalid input");
 
   *outString = NULL;
 
   nsresult rv;
-  PRInt32 inStringLength = nsCRT::strlen(inString);   // original input string length
+  PRInt32 inStringLength = NS_strlen(inString);       // original input string length
   PRInt32 bufferLength;                               // allocated buffer length
   PRInt32 srcLength = inStringLength;
   PRInt32 dstLength;
   char *dstPtr = NULL;
   PRInt32 pos1, pos2;
   nsresult saveResult = NS_OK;                         // to remember NS_ERROR_UENC_NOMAPPING
 
   // estimate and allocate the target buffer (reserve extra memory for fallback)
--- a/layout/base/nsBidi.cpp
+++ b/layout/base/nsBidi.cpp
@@ -243,17 +243,17 @@ nsresult nsBidi::SetPara(const PRUnichar
   if(aText==NULL ||
      ((NSBIDI_MAX_EXPLICIT_LEVEL<aParaLevel) && !IS_DEFAULT_LEVEL(aParaLevel)) ||
      aLength<-1
     ) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if(aLength==-1) {
-    aLength=nsCRT::strlen(aText);
+    aLength = NS_strlen(aText);
   }
 
   /* initialize member data */
   mLength=aLength;
   mParaLevel=aParaLevel;
   mDirection=NSBIDI_LTR;
   mTrailingWSStart=aLength;  /* the levels[] will reflect the WS run */
 
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -2374,19 +2374,19 @@ nsPrintEngine::SetDocAndURLIntoProgress(
   if (docURLStr != nsnull) nsMemory::Free(docURLStr);
 }
 
 //---------------------------------------------------------------------
 void
 nsPrintEngine::ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, bool aDoFront)
 {
   // Make sure the URLS don't get too long for the progress dialog
-  if (aStr && nsCRT::strlen(aStr) > aLen) {
+  if (aStr && NS_strlen(aStr) > aLen) {
     if (aDoFront) {
-      PRUnichar * ptr = &aStr[nsCRT::strlen(aStr)-aLen+3];
+      PRUnichar * ptr = &aStr[NS_strlen(aStr) - aLen + 3];
       nsAutoString newStr;
       newStr.AppendLiteral("...");
       newStr += ptr;
       nsMemory::Free(aStr);
       aStr = ToNewUnicode(newStr);
     } else {
       nsAutoString newStr(aStr);
       newStr.SetLength(aLen-3);
--- a/netwerk/protocol/http/nsHttpAuthCache.cpp
+++ b/netwerk/protocol/http/nsHttpAuthCache.cpp
@@ -238,19 +238,19 @@ PLHashAllocOps nsHttpAuthCache::gHashAll
 
 nsresult
 nsHttpAuthIdentity::Set(const PRUnichar *domain,
                         const PRUnichar *user,
                         const PRUnichar *pass)
 {
     PRUnichar *newUser, *newPass, *newDomain;
 
-    int domainLen = domain ? nsCRT::strlen(domain) : 0;
-    int userLen   = user   ? nsCRT::strlen(user)   : 0;
-    int passLen   = pass   ? nsCRT::strlen(pass)   : 0; 
+    int domainLen = domain ? NS_strlen(domain) : 0;
+    int userLen   = user   ? NS_strlen(user)   : 0;
+    int passLen   = pass   ? NS_strlen(pass)   : 0; 
 
     int len = userLen + 1 + passLen + 1 + domainLen + 1;
     newUser = (PRUnichar *) malloc(len * sizeof(PRUnichar));
     if (!newUser)
         return NS_ERROR_OUT_OF_MEMORY;
 
     if (user)
         memcpy(newUser, user, userLen * sizeof(PRUnichar));
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -1022,17 +1022,17 @@ NS_IMPL_ISUPPORTS4(mozTXTToHTMLConv,
                    nsIStreamListener,
                    nsIRequestObserver)
 
 PRInt32
 mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line,
 				    PRUint32& logLineStart)
 {
   PRInt32 result = 0;
-  PRInt32 lineLength = nsCRT::strlen(line);
+  PRInt32 lineLength = NS_strlen(line);
 
   bool moreCites = true;
   while (moreCites)
   {
     /* E.g. the following lines count as quote:
 
        > text
        //#ifdef QUOTE_RECOGNITION_AGGRESSIVE
@@ -1061,17 +1061,17 @@ mozTXTToHTMLConv::CiteLevelTXT(const PRU
     {
       i++;
       if (PRInt32(i) < lineLength && line[i] == ' ')
         i++;
       // sendmail/mbox
       // Placed here for performance increase
       const PRUnichar * indexString = &line[logLineStart];
            // here, |logLineStart < lineLength| is always true
-      PRUint32 minlength = MinInt(6,nsCRT::strlen(indexString));
+      PRUint32 minlength = MinInt(6, NS_strlen(indexString));
       if (Substring(indexString,
                     indexString+minlength).Equals(Substring(NS_LITERAL_STRING(">From "), 0, minlength),
                                                   nsCaseInsensitiveStringComparator()))
         //XXX RFC2646
         moreCites = false;
       else
       {
         result++;
@@ -1336,17 +1336,17 @@ mozTXTToHTMLConv::CiteLevelTXT(const PRU
 NS_IMETHODIMP
 mozTXTToHTMLConv::ScanTXT(const PRUnichar *text, PRUint32 whattodo,
 			   PRUnichar **_retval)
 {
   NS_ENSURE_ARG(text);
 
   // FIX ME!!!
   nsString outString;
-  PRInt32 inLength = nsCRT::strlen(text);
+  PRInt32 inLength = NS_strlen(text);
   // by setting a large capacity up front, we save time
   // when appending characters to the output string because we don't
   // need to reallocate and re-copy the characters already in the out String.
   NS_ASSERTION(inLength, "ScanTXT passed 0 length string");
   if (inLength == 0) {
     *_retval = nsCRT::strdup(text);
     return NS_OK;
   }
--- a/parser/htmlparser/src/nsHTMLTags.cpp
+++ b/parser/htmlparser/src/nsHTMLTags.cpp
@@ -387,17 +387,17 @@ nsHTMLTags::AddRefTable(void)
         nsAutoString temp1(sTagUnicodeTable[i]);
         nsAutoString temp2((PRUnichar*)sTagAtoms_info[i].mStringBuffer->Data());
         NS_ASSERTION(temp1.Equals(temp2), "Bad unicode tag name!");
       }
 
       // let's verify that NS_HTMLTAG_NAME_MAX_LENGTH is correct
       PRUint32 maxTagNameLength = 0;
       for (i = 0; i < NS_HTML_TAG_MAX; ++i) {
-        PRUint32 len = nsCRT::strlen(sTagUnicodeTable[i]);
+        PRUint32 len = NS_strlen(sTagUnicodeTable[i]);
         maxTagNameLength = NS_MAX(len, maxTagNameLength);        
       }
       NS_ASSERTION(maxTagNameLength == NS_HTMLTAG_NAME_MAX_LENGTH,
                    "NS_HTMLTAG_NAME_MAX_LENGTH not set correctly!");
     }
 #endif
   }
 
--- a/uriloader/exthandler/mac/nsOSHelperAppService.mm
+++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm
@@ -162,17 +162,17 @@ nsresult nsOSHelperAppService::GetFileTo
 
   nsresult rv;
   nsCOMPtr<nsILocalFileMac> localFile (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv,rv);
 
   CFURLRef pathAsCFURL;
   CFStringRef pathAsCFString = ::CFStringCreateWithCharacters(NULL,
                                                               aPlatformAppPath,
-                                                              nsCRT::strlen(aPlatformAppPath));
+                                                              NS_strlen(aPlatformAppPath));
   if (!pathAsCFString)
     return NS_ERROR_OUT_OF_MEMORY;
 
   if (::CFStringGetCharacterAtIndex(pathAsCFString, 0) == '/') {
     // we have a Posix path
     pathAsCFURL = ::CFURLCreateWithFileSystemPath(nsnull, pathAsCFString,
                                                   kCFURLPOSIXPathStyle, false);
     if (!pathAsCFURL) {
--- a/widget/cocoa/nsDeviceContextSpecX.mm
+++ b/widget/cocoa/nsDeviceContextSpecX.mm
@@ -60,17 +60,17 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init
 NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(PRUnichar*  aTitle, 
                                                   PRUnichar*  aPrintToFileName,
                                                   PRInt32     aStartPage, 
                                                   PRInt32     aEndPage)
 {
     NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
     if (aTitle) {
-      CFStringRef cfString = ::CFStringCreateWithCharacters(NULL, aTitle, nsCRT::strlen(aTitle));
+      CFStringRef cfString = ::CFStringCreateWithCharacters(NULL, aTitle, NS_strlen(aTitle));
       if (cfString) {
         ::PMPrintSettingsSetJobName(mPrintSettings, cfString);
         ::CFRelease(cfString);
       }
     }
 
     OSStatus status;
     status = ::PMSetFirstPage(mPrintSettings, aStartPage, false);
--- a/widget/cocoa/nsPrintDialogX.mm
+++ b/widget/cocoa/nsPrintDialogX.mm
@@ -48,17 +48,17 @@ nsPrintDialogServiceX::Show(nsIDOMWindow
   if (!settingsX)
     return NS_ERROR_FAILURE;
 
   // Set the print job title
   PRUnichar** docTitles;
   PRUint32 titleCount;
   nsresult rv = aWebBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles);
   if (NS_SUCCEEDED(rv) && titleCount > 0) {
-    CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], nsCRT::strlen(docTitles[0]));
+    CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], NS_strlen(docTitles[0]));
     if (cfTitleString) {
       ::PMPrintSettingsSetJobName(settingsX->GetPMPrintSettings(), cfTitleString);
       CFRelease(cfTitleString);
     }
     for (PRInt32 i = titleCount - 1; i >= 0; i--) {
       NS_Free(docTitles[i]);
     }
     NS_Free(docTitles);
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -423,17 +423,17 @@ nsresult nsClipboard::GetNativeDataOffCl
                 // Get the data out of the global data handle. The size we return
                 // should not include the null because the other platforms don't
                 // use nulls, so just return the length we get back from strlen(),
                 // since we know CF_UNICODETEXT is null terminated. Recall that GetGlobalData() 
                 // returns the size of the allocated buffer, not the size of the data 
                 // (on 98, these are not the same) so we can't use that.
                 PRUint32 allocLen = 0;
                 if ( NS_SUCCEEDED(GetGlobalData(stm.hGlobal, aData, &allocLen)) ) {
-                  *aLen = nsCRT::strlen(reinterpret_cast<PRUnichar*>(*aData)) * 2;
+                  *aLen = NS_strlen(reinterpret_cast<PRUnichar*>(*aData)) * 2;
                   result = NS_OK;
                 }
               } break;
 
             case CF_DIB :
               if (aMIMEImageFormat)
               {
                 PRUint32 allocLen = 0;
@@ -505,17 +505,17 @@ nsresult nsClipboard::GetNativeDataOffCl
                   } else if (fe.cfFormat == preferredDropEffect) {
                     // As per the MSDN doc entitled: "Shell Clipboard Formats"
                     // CFSTR_PREFERREDDROPEFFECT should return a DWORD
                     // Reference: http://msdn.microsoft.com/en-us/library/bb776902(v=vs.85).aspx
                     NS_ASSERTION(allocLen == sizeof(DWORD),
                       "CFSTR_PREFERREDDROPEFFECT should return a DWORD");
                     *aLen = allocLen;
                   } else {
-                    *aLen = nsCRT::strlen(reinterpret_cast<PRUnichar*>(*aData)) * 
+                    *aLen = NS_strlen(reinterpret_cast<PRUnichar*>(*aData)) * 
                             sizeof(PRUnichar);
                   }
                   result = NS_OK;
                 }
               }
             } break;
           } // switch
         } break;
@@ -779,30 +779,30 @@ nsClipboard :: FindURLFromLocalFile ( ID
         // URL\ntitle.  We can guess the title from the file's name.
         nsAutoString title;
         file->GetLeafName(title);
         // We rely on IsInternetShortcut check that file has a .url extension.
         title.SetLength(title.Length() - 4);
         if (title.IsEmpty())
           title = urlString;
         *outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + title);
-        *outDataLen = nsCRT::strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+        *outDataLen = NS_strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
 
         dataFound = true;
       }
     }
     else {
       // we have a normal file, use some Necko objects to get our file path
       nsCAutoString urlSpec;
       NS_GetURLSpecFromFile(file, urlSpec);
 
       // convert it to unicode and pass it out
       nsMemory::Free(*outData);
       *outData = UTF8ToNewUnicode(urlSpec);
-      *outDataLen = nsCRT::strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+      *outDataLen = NS_strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
       dataFound = true;
     } // else regular file
   }
 
   return dataFound;
 } // FindURLFromLocalFile
 
 //
@@ -822,17 +822,17 @@ nsClipboard :: FindURLFromNativeURL ( ID
 
   nsresult loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, ::RegisterClipboardFormat(CFSTR_INETURLW), nsnull, &tempOutData, &tempDataLen);
   if ( NS_SUCCEEDED(loadResult) && tempOutData ) {
     nsDependentString urlString(static_cast<PRUnichar*>(tempOutData));
     // the internal mozilla URL format, text/x-moz-url, contains
     // URL\ntitle.  Since we don't actually have a title here,
     // just repeat the URL to fake it.
     *outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + urlString);
-    *outDataLen = nsCRT::strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+    *outDataLen = NS_strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
     nsMemory::Free(tempOutData);
     dataFound = true;
   }
   else {
     loadResult = GetNativeDataOffClipboard(inDataObject, inIndex, ::RegisterClipboardFormat(CFSTR_INETURLA), nsnull, &tempOutData, &tempDataLen);
     if ( NS_SUCCEEDED(loadResult) && tempOutData ) {
       // CFSTR_INETURLA is (currently) equal to CFSTR_SHELLURL which is equal to CF_TEXT
       // which is by definition ANSI encoded.
@@ -844,17 +844,17 @@ nsClipboard :: FindURLFromNativeURL ( ID
         NS_CopyNativeToUnicode(urlUnescapedA, urlString);
       else
         NS_CopyNativeToUnicode(nsDependentCString(static_cast<char*>(tempOutData), tempDataLen), urlString);
 
       // the internal mozilla URL format, text/x-moz-url, contains
       // URL\ntitle.  Since we don't actually have a title here,
       // just repeat the URL to fake it.
       *outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + urlString);
-      *outDataLen = nsCRT::strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+      *outDataLen = NS_strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
       nsMemory::Free(tempOutData);
       dataFound = true;
     }
   }
 
   return dataFound;
 } // FindURLFromNativeURL
 
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -797,18 +797,18 @@ nsFilePicker::ShowXPFilePicker(const nsS
   // that include spaces. 
   PRUnichar *current = fileBuffer;
   
   nsAutoString dirName(current);
   // Sometimes dirName contains a trailing slash and sometimes it doesn't:
   if (current[dirName.Length() - 1] != '\\')
     dirName.Append((PRUnichar)'\\');
   
-  while (current && *current && *(current + nsCRT::strlen(current) + 1)) {
-    current = current + nsCRT::strlen(current) + 1;
+  while (current && *current && *(current + NS_strlen(current) + 1)) {
+    current = current + NS_strlen(current) + 1;
     
     nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
     NS_ENSURE_TRUE(file, false);
 
     // Only prepend the directory if the path specified is a relative path
     nsAutoString path;
     if (PathIsRelativeW(current)) {
       path = dirName + nsDependentString(current);
--- a/xpcom/ds/nsCRT.cpp
+++ b/xpcom/ds/nsCRT.cpp
@@ -146,17 +146,17 @@ const char* nsCRT::memmem(const char* ha
       return haystack + i;
   }
 #endif
   return NULL;
 }
 
 PRUnichar* nsCRT::strdup(const PRUnichar* str)
 {
-  PRUint32 len = nsCRT::strlen(str);
+  PRUint32 len = NS_strlen(str);
   return strndup(str, len);
 }
 
 PRUnichar* nsCRT::strndup(const PRUnichar* str, PRUint32 len)
 {
 	nsCppSharedAllocator<PRUnichar> shared_allocator;
 	PRUnichar* rslt = shared_allocator.allocate(len + 1); // add one for the null
   // PRUnichar* rslt = new PRUnichar[len + 1];
--- a/xpcom/ds/nsCRT.h
+++ b/xpcom/ds/nsCRT.h
@@ -143,25 +143,16 @@ public:
         token = nsCRT::strtok(newStr, seps, &newStr);
       }
     }
     * WARNING - STRTOK WHACKS str THE FIRST TIME IT IS CALLED *
     * MAKE A COPY OF str IF YOU NEED TO USE IT AFTER strtok() *
   */
   static char* strtok(char* str, const char* delims, char* *newStr); 
 
-  static PRUint32 strlen(const PRUnichar* s) {
-    // XXXbsmedberg: remove this null-check at some point
-    if (!s) {
-      NS_ERROR("Passing null to nsCRT::strlen");
-      return 0;
-    }
-    return NS_strlen(s);
-  }
-
   /// Like strcmp except for ucs2 strings
   static PRInt32 strcmp(const PRUnichar* s1, const PRUnichar* s2);
   /// Like strcmp except for ucs2 strings
   static PRInt32 strncmp(const PRUnichar* s1, const PRUnichar* s2,
                          PRUint32 aMaxLen);
 
   // The GNU libc has memmem, which is strstr except for binary data
   // This is our own implementation that uses memmem on platforms
--- a/xpcom/ds/nsHashtable.cpp
+++ b/xpcom/ds/nsHashtable.cpp
@@ -610,17 +610,17 @@ nsStringKey::nsStringKey(const nsAString
     MOZ_COUNT_CTOR(nsStringKey);
 }
 
 nsStringKey::nsStringKey(const PRUnichar* str, PRInt32 strLen, Ownership own)
     : mStr((PRUnichar*)str), mStrLen(strLen), mOwnership(own)
 {
     NS_ASSERTION(mStr, "null string key");
     if (mStrLen == PRUint32(-1))
-        mStrLen = nsCRT::strlen(str);
+        mStrLen = NS_strlen(str);
 #ifdef DEBUG
     mKeyType = StringKey;
 #endif
     MOZ_COUNT_CTOR(nsStringKey);
 }
 
 nsStringKey::~nsStringKey(void)
 {
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -405,17 +405,17 @@ static nsresult CloneArray(PRUint16 inTy
             PRUnichar** outp = (PRUnichar**) *outValue;
             for(i = inCount; i > 0; i--)
             {
                 PRUnichar* str = *(inp++);
                 if(str)
                 {
                     if(nsnull == (*(outp++) = (PRUnichar*)
                        nsMemory::Clone(str,
-                        (nsCRT::strlen(str)+1)*sizeof(PRUnichar))))
+                        (NS_strlen(str) + 1) * sizeof(PRUnichar))))
                         goto bad;
                 }
                 else
                     *(outp++) = nsnull;
                 allocatedValueCount++;
             }
             break;
         }
@@ -1478,17 +1478,17 @@ nsVariant::SetFromString(nsDiscriminated
     return SetFromStringWithSize(data, strlen(aValue), aValue);
 }
 /* static */ nsresult
 nsVariant::SetFromWString(nsDiscriminatedUnion* data, const PRUnichar *aValue)
 {
     DATA_SETTER_PROLOGUE(data);
     if(!aValue)
         return NS_ERROR_NULL_POINTER;
-    return SetFromWStringWithSize(data, nsCRT::strlen(aValue), aValue);
+    return SetFromWStringWithSize(data, NS_strlen(aValue), aValue);
 }
 /* static */ nsresult
 nsVariant::SetFromISupports(nsDiscriminatedUnion* data, nsISupports *aValue)
 {
     return SetFromInterface(data, NS_GET_IID(nsISupports), aValue);
 }
 /* static */ nsresult
 nsVariant::SetFromInterface(nsDiscriminatedUnion* data, const nsIID& iid,
--- a/xpcom/io/nsBinaryStream.cpp
+++ b/xpcom/io/nsBinaryStream.cpp
@@ -165,17 +165,17 @@ nsBinaryOutputStream::WriteStringZ(const
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteWStringZ(const PRUnichar* aString)
 {
     PRUint32 length, byteCount;
     nsresult rv;
 
-    length = nsCRT::strlen(aString);
+    length = NS_strlen(aString);
     rv = Write32(length);
     if (NS_FAILED(rv)) return rv;
 
     if (length == 0)
         return NS_OK;
     byteCount = length * sizeof(PRUnichar);
 
 #ifdef IS_BIG_ENDIAN
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -253,17 +253,17 @@ nsEscapeHTML(const char * string)
     return(rv);
 }
 
 PRUnichar *
 nsEscapeHTML2(const PRUnichar *aSourceBuffer, PRInt32 aSourceBufferLen)
 {
   // Calculate the length, if the caller didn't.
   if (aSourceBufferLen < 0) {
-    aSourceBufferLen = nsCRT::strlen(aSourceBuffer);
+    aSourceBufferLen = NS_strlen(aSourceBuffer);
   }
 
   /* XXX Hardcoded max entity len. */
   if (PRUint32(aSourceBufferLen) >=
       ((PR_UINT32_MAX - sizeof(PRUnichar)) / (6 * sizeof(PRUnichar))) )
     return nsnull;
 
   PRUnichar *resultBuffer = (PRUnichar *)nsMemory::Alloc(aSourceBufferLen *
--- a/xpcom/io/nsLinebreakConverter.cpp
+++ b/xpcom/io/nsLinebreakConverter.cpp
@@ -364,17 +364,17 @@ nsresult nsLinebreakConverter::ConvertLi
 ----------------------------------------------------------------------------*/
 PRUnichar* nsLinebreakConverter::ConvertUnicharLineBreaks(const PRUnichar* aSrc,
             ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, PRInt32 aSrcLen, PRInt32* outLen)
 {
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
   if (!aSrc) return nsnull;
   
-  PRInt32 bufLen = (aSrcLen == kIgnoreLen) ? nsCRT::strlen(aSrc) + 1 : aSrcLen;
+  PRInt32 bufLen = (aSrcLen == kIgnoreLen) ? NS_strlen(aSrc) + 1 : aSrcLen;
 
   PRUnichar* resultString;
   if (aSrcBreaks == eLinebreakAny)
     resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks));
   else
     resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
   
   if (outLen)
@@ -390,17 +390,17 @@ PRUnichar* nsLinebreakConverter::Convert
 nsresult nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(PRUnichar **ioBuffer,
             ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, PRInt32 aSrcLen, PRInt32* outLen)
 {
   NS_ASSERTION(ioBuffer && *ioBuffer, "Null pointer passed");
   if (!ioBuffer || !*ioBuffer) return NS_ERROR_NULL_POINTER;
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
 
-  PRInt32 sourceLen = (aSrcLen == kIgnoreLen) ? nsCRT::strlen(*ioBuffer) + 1 : aSrcLen;
+  PRInt32 sourceLen = (aSrcLen == kIgnoreLen) ? NS_strlen(*ioBuffer) + 1 : aSrcLen;
 
   // can we convert in-place?
   const char* srcBreaks = GetLinebreakString(aSrcBreaks);
   const char* dstBreaks = GetLinebreakString(aDestBreaks);
   
   if ( (aSrcBreaks != eLinebreakAny) &&
        (strlen(srcBreaks) == 1) &&
        (strlen(dstBreaks) == 1) )