Backout 17deb5f61b4d (bug 150073) due to build bustage. a=shouldausedtryfirst
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 03 Apr 2012 20:22:42 -0400
changeset 94272 308440acc7b70223e7ab25aed3305da7e65a762a
parent 94271 c0712aa0f090848487b07ff19458c041ac58cc9b
child 94273 6c435c96f10af053ac2e3f2b15f2913dcd1d0808
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshouldausedtryfirst
bugs150073
milestone14.0a1
backs out17deb5f61b4dd0a8455e1931f394de1221564b3f
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 17deb5f61b4d (bug 150073) due to build bustage. a=shouldausedtryfirst
content/svg/content/src/SVGTransformListParser.cpp
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/about/nsIAboutModule.idl
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/nsHashtable.cpp
xpcom/ds/nsVariant.cpp
xpcom/io/nsBinaryStream.cpp
xpcom/io/nsEscape.cpp
xpcom/io/nsLinebreakConverter.cpp
--- a/content/svg/content/src/SVGTransformListParser.cpp
+++ b/content/svg/content/src/SVGTransformListParser.cpp
@@ -115,17 +115,17 @@ SVGTransformListParser::GetTransformToke
   const char* delimiters = "\x20\x9\xD\xA,(";
   char* delimiterStart = PL_strnpbrk(mTokenPos, delimiters, 11);
   if (delimiterStart != 0) {
     /* save this character and null it out */
     char holdingChar = *delimiterStart;
     *delimiterStart = '\0';
 
     PRUint32 len;
-    if ((len = strlen(mTokenPos)) > 0) {
+    if ((len = nsCRT::strlen(mTokenPos)) > 0) {
       *aKeyAtom = NS_NewAtom(Substring(mTokenPos, mTokenPos + len));
 
       if (aAdvancePos) {
          mInputPos = mTokenPos + len;
          mTokenPos = mInputPos;
       }
     } else {
       rv = NS_ERROR_FAILURE;
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -1457,28 +1457,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, strlen(aErrorText), false);
+  rv = HandleCharacterData(aErrorText, nsCRT::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, strlen(aSourceText), false);
+  rv = HandleCharacterData(aSourceText, nsCRT::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
@@ -759,27 +759,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, strlen(aErrorText));
+  rv = HandleCharacterData(aErrorText, nsCRT::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, strlen(aSourceText));
+  rv = HandleCharacterData(aSourceText, nsCRT::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
@@ -5022,17 +5022,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),
-                                    strlen(mData->mNameUTF16), &found)) {
+                                    nsCRT::strlen(mData->mNameUTF16), &found)) {
     return NS_ERROR_FAILURE;
   }
 
   nsScriptNameSpaceManager *nameSpaceManager =
     nsJSRuntime::GetNameSpaceManager();
   NS_ENSURE_TRUE(nameSpaceManager, NS_OK);
 
   bool unused;
@@ -5906,17 +5906,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),
-                            strlen(mClassName), thisAsVal, nsnull,
+                            nsCRT::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
@@ -495,17 +495,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 = strlen(aStr);
+  PRInt32 inLength = nsCRT::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))
@@ -552,17 +552,17 @@ NS_IMETHODIMP mozHunspell::Suggest(const
   *aSuggestionCount = mHunspell->suggest(&wlst, charsetWord);
 
   if (*aSuggestionCount) {
     *aSuggestions  = (PRUnichar **)nsMemory::Alloc(*aSuggestionCount * sizeof(PRUnichar *));
     if (*aSuggestions) {
       PRUint32 index = 0;
       for (index = 0; index < *aSuggestionCount && NS_SUCCEEDED(rv); ++index) {
         // Convert the suggestion to utf16
-        PRInt32 inLength = strlen(wlst[index]);
+        PRInt32 inLength = nsCRT::strlen(wlst[index]);
         PRInt32 outLength;
         rv = mDecoder->GetMaxLength(wlst[index], inLength, &outLength);
         if (NS_SUCCEEDED(rv))
         {
           (*aSuggestions)[index] = (PRUnichar *) nsMemory::Alloc(sizeof(PRUnichar) * (outLength+1));
           if ((*aSuggestions)[index])
           {
             rv = mDecoder->Convert(wlst[index], &inLength, (*aSuggestions)[index], &outLength);
--- a/extensions/spellcheck/src/mozEnglishWordUtils.cpp
+++ b/extensions/spellcheck/src/mozEnglishWordUtils.cpp
@@ -272,17 +272,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 = strlen(iwords[i]);
+    length = nsCRT::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
@@ -73,17 +73,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 = strlen(text);
+          PRInt32 ulen = nsCRT::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
@@ -226,17 +226,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 = strlen(inString);
+  PRUint32 len = nsCRT::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
@@ -200,23 +200,23 @@ nsSaveAsCharset::DoCharsetConversion(con
 {
   if(nsnull == outString )
     return NS_ERROR_NULL_POINTER;
   NS_ASSERTION(outString, "invalid input");
 
   *outString = NULL;
 
   nsresult rv;
-  PRInt32 inStringLength = strlen(inString);   // original input string length
-  PRInt32 bufferLength;                        // allocated buffer length
+  PRInt32 inStringLength = nsCRT::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
+  nsresult saveResult = NS_OK;                         // to remember NS_ERROR_UENC_NOMAPPING
 
   // estimate and allocate the target buffer (reserve extra memory for fallback)
   rv = mEncoder->GetMaxLength(inString, inStringLength, &dstLength);
   if (NS_FAILED(rv)) return rv;
 
   bufferLength = dstLength + 512; // reserve 512 byte for fallback.
   dstPtr = (char *) PR_Malloc(bufferLength);
   if (NULL == dstPtr) return NS_ERROR_OUT_OF_MEMORY;
--- a/layout/base/nsBidi.cpp
+++ b/layout/base/nsBidi.cpp
@@ -274,17 +274,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 = strlen(aText);
+    aLength=nsCRT::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
@@ -2407,19 +2407,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 && strlen(aStr) > aLen) {
+  if (aStr && nsCRT::strlen(aStr) > aLen) {
     if (aDoFront) {
-      PRUnichar * ptr = &aStr[strlen(aStr) - aLen + 3];
+      PRUnichar * ptr = &aStr[nsCRT::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/about/nsIAboutModule.idl
+++ b/netwerk/protocol/about/nsIAboutModule.idl
@@ -78,11 +78,11 @@ interface nsIAboutModule : nsISupports
      */
     unsigned long getURIFlags(in nsIURI aURI);
 };
 
 %{C++
 
 #define NS_ABOUT_MODULE_CONTRACTID        "@mozilla.org/network/protocol/about;1" 
 #define NS_ABOUT_MODULE_CONTRACTID_PREFIX NS_ABOUT_MODULE_CONTRACTID "?what=" 
-#define NS_ABOUT_MODULE_CONTRACTID_LENGTH 49      // strlen(NS_ABOUT_MODULE_CONTRACTID_PREFIX)
+#define NS_ABOUT_MODULE_CONTRACTID_LENGTH 49      // nsCRT::strlen(NS_ABOUT_MODULE_CONTRACTID_PREFIX)
 
 %}
--- a/netwerk/protocol/http/nsHttpAuthCache.cpp
+++ b/netwerk/protocol/http/nsHttpAuthCache.cpp
@@ -271,19 +271,19 @@ PLHashAllocOps nsHttpAuthCache::gHashAll
 
 nsresult
 nsHttpAuthIdentity::Set(const PRUnichar *domain,
                         const PRUnichar *user,
                         const PRUnichar *pass)
 {
     PRUnichar *newUser, *newPass, *newDomain;
 
-    int domainLen = domain ? strlen(domain) : 0;
-    int userLen   = user   ? strlen(user)   : 0;
-    int passLen   = pass   ? strlen(pass)   : 0; 
+    int domainLen = domain ? nsCRT::strlen(domain) : 0;
+    int userLen   = user   ? nsCRT::strlen(user)   : 0;
+    int passLen   = pass   ? nsCRT::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));
@@ -350,26 +350,26 @@ nsHttpAuthEntry::AddPath(const char *aPa
 {
     // null path matches empty path
     if (!aPath)
         aPath = "";
 
     nsHttpAuthPath *tempPtr = mRoot;
     while (tempPtr) {
         const char *curpath = tempPtr->mPath;
-        if (strncmp(aPath, curpath, strlen(curpath)) == 0)
+        if (strncmp(aPath, curpath, nsCRT::strlen(curpath)) == 0)
             return NS_OK; // subpath already exists in the list
 
         tempPtr = tempPtr->mNext;
 
     }
     
     //Append the aPath
     nsHttpAuthPath *newAuthPath;
-    int newpathLen = strlen(aPath);
+    int newpathLen = nsCRT::strlen(aPath);
     newAuthPath = (nsHttpAuthPath *) malloc(sizeof(nsHttpAuthPath) + newpathLen);
     if (!newAuthPath)
         return NS_ERROR_OUT_OF_MEMORY;
 
     memcpy(newAuthPath->mPath, aPath, newpathLen+1);
     newAuthPath->mNext = nsnull;
 
     if (!mRoot)
@@ -387,19 +387,19 @@ nsHttpAuthEntry::Set(const char *path,
                      const char *realm,
                      const char *creds,
                      const char *chall,
                      const nsHttpAuthIdentity *ident,
                      nsISupports *metadata)
 {
     char *newRealm, *newCreds, *newChall;
 
-    int realmLen = realm ? strlen(realm) : 0;
-    int credsLen = creds ? strlen(creds) : 0;
-    int challLen = chall ? strlen(chall) : 0;
+    int realmLen = realm ? nsCRT::strlen(realm) : 0;
+    int credsLen = creds ? nsCRT::strlen(creds) : 0;
+    int challLen = chall ? nsCRT::strlen(chall) : 0;
 
     int len = realmLen + 1 + credsLen + 1 + challLen + 1;
     newRealm = (char *) malloc(len);
     if (!newRealm)
         return NS_ERROR_OUT_OF_MEMORY;
 
     if (realm)
         memcpy(newRealm, realm, realmLen);
@@ -484,17 +484,17 @@ nsHttpAuthNode::LookupEntryByPath(const 
         while (authPath) {
             const char *entryPath = authPath->mPath;
             // proxy auth entries have no path, so require exact match on
             // empty path string.
             if (entryPath[0] == '\0') {
                 if (path[0] == '\0')
                     return entry;
             }
-            else if (strncmp(path, entryPath, strlen(entryPath)) == 0)
+            else if (strncmp(path, entryPath, nsCRT::strlen(entryPath)) == 0)
                 return entry;
 
             authPath = authPath->mNext;
         }
     }
     return nsnull;
 }
 
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -738,17 +738,17 @@ mozTXTToHTMLConv::StructPhraseHit(const 
 bool
 mozTXTToHTMLConv::SmilyHit(const PRUnichar * aInString, PRInt32 aLength, bool col0,
          const char* tagTXT, const char* imageName,
          nsString& outputHTML, PRInt32& glyphTextLen)
 {
   if ( !aInString || !tagTXT || !imageName )
       return false;
 
-  PRInt32  tagLen = strlen(tagTXT);
+  PRInt32  tagLen = nsCRT::strlen(tagTXT);
  
   PRUint32 delim = (col0 ? 0 : 1) + tagLen;
 
   if
     (
       (col0 || IsSpace(aInString[0]))
         &&
         (
@@ -1050,17 +1050,17 @@ NS_IMPL_ISUPPORTS4(mozTXTToHTMLConv,
                    nsIStreamListener,
                    nsIRequestObserver)
 
 PRInt32
 mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line,
 				    PRUint32& logLineStart)
 {
   PRInt32 result = 0;
-  PRInt32 lineLength = strlen(line);
+  PRInt32 lineLength = nsCRT::strlen(line);
 
   bool moreCites = true;
   while (moreCites)
   {
     /* E.g. the following lines count as quote:
 
        > text
        //#ifdef QUOTE_RECOGNITION_AGGRESSIVE
@@ -1089,17 +1089,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, strlen(indexString));
+      PRUint32 minlength = MinInt(6,nsCRT::strlen(indexString));
       if (Substring(indexString,
                     indexString+minlength).Equals(Substring(NS_LITERAL_STRING(">From "), 0, minlength),
                                                   nsCaseInsensitiveStringComparator()))
         //XXX RFC2646
         moreCites = false;
       else
       {
         result++;
@@ -1364,17 +1364,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 = strlen(text);
+  PRInt32 inLength = nsCRT::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
@@ -419,17 +419,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 = strlen(sTagUnicodeTable[i]);
+        PRUint32 len = nsCRT::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
@@ -197,17 +197,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,
-                                                              strlen(aPlatformAppPath));
+                                                              nsCRT::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
@@ -95,17 +95,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, strlen(aTitle));
+      CFStringRef cfString = ::CFStringCreateWithCharacters(NULL, aTitle, nsCRT::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
@@ -81,17 +81,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], strlen(docTitles[0]));
+    CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], nsCRT::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
@@ -460,17 +460,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 = strlen(reinterpret_cast<PRUnichar*>(*aData)) * 2;
+                  *aLen = nsCRT::strlen(reinterpret_cast<PRUnichar*>(*aData)) * 2;
                   result = NS_OK;
                 }
               } break;
 
             case CF_DIB :
               if (aMIMEImageFormat)
               {
                 PRUint32 allocLen = 0;
@@ -542,17 +542,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 = strlen(reinterpret_cast<PRUnichar*>(*aData)) * 
+                    *aLen = nsCRT::strlen(reinterpret_cast<PRUnichar*>(*aData)) * 
                             sizeof(PRUnichar);
                   }
                   result = NS_OK;
                 }
               }
             } break;
           } // switch
         } break;
@@ -816,30 +816,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 = strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+        *outDataLen = nsCRT::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 = strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+      *outDataLen = nsCRT::strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
       dataFound = true;
     } // else regular file
   }
 
   return dataFound;
 } // FindURLFromLocalFile
 
 //
@@ -859,17 +859,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 = strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+    *outDataLen = nsCRT::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.
@@ -881,17 +881,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 = strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
+      *outDataLen = nsCRT::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
@@ -823,18 +823,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 + strlen(current) + 1)) {
-    current = current + strlen(current) + 1;
+  while (current && *current && *(current + nsCRT::strlen(current) + 1)) {
+    current = current + nsCRT::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/nsHashtable.cpp
+++ b/xpcom/ds/nsHashtable.cpp
@@ -642,17 +642,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 = strlen(str);
+        mStrLen = nsCRT::strlen(str);
 #ifdef DEBUG
     mKeyType = StringKey;
 #endif
     MOZ_COUNT_CTOR(nsStringKey);
 }
 
 nsStringKey::~nsStringKey(void)
 {
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -438,17 +438,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,
-                        (strlen(str) + 1) * sizeof(PRUnichar))))
+                        (nsCRT::strlen(str)+1)*sizeof(PRUnichar))))
                         goto bad;
                 }
                 else
                     *(outp++) = nsnull;
                 allocatedValueCount++;
             }
             break;
         }
@@ -1511,17 +1511,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, strlen(aValue), aValue);
+    return SetFromWStringWithSize(data, nsCRT::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
@@ -198,17 +198,17 @@ nsBinaryOutputStream::WriteStringZ(const
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteWStringZ(const PRUnichar* aString)
 {
     PRUint32 length, byteCount;
     nsresult rv;
 
-    length = strlen(aString);
+    length = nsCRT::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
@@ -283,19 +283,19 @@ nsEscapeHTML(const char * string)
       }
 
     return(rv);
 }
 
 PRUnichar *
 nsEscapeHTML2(const PRUnichar *aSourceBuffer, PRInt32 aSourceBufferLen)
 {
-  // Calculate the length, if the caller didn't.
+  // if the caller didn't calculate the length
   if (aSourceBufferLen < 0) {
-    aSourceBufferLen = strlen(aSourceBuffer);
+    aSourceBufferLen = nsCRT::strlen(aSourceBuffer); // ...then I will
   }
 
   /* 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
@@ -396,17 +396,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) ? strlen(aSrc) + 1 : aSrcLen;
+  PRInt32 bufLen = (aSrcLen == kIgnoreLen) ? nsCRT::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)
@@ -422,17 +422,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) ? strlen(*ioBuffer) + 1 : aSrcLen;
+  PRInt32 sourceLen = (aSrcLen == kIgnoreLen) ? nsCRT::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) )