mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 743581: Removes nsCRT::strlen(const PRUnichar*). f=sgautherie r=dougt
This commit is contained in:
parent
6cf4e96cb1
commit
5b9a95ea6a
@ -1428,7 +1428,7 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText,
|
||||
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);
|
||||
@ -1439,7 +1439,7 @@ nsXMLContentSink::ReportError(const PRUnichar* aErrorText,
|
||||
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);
|
||||
|
@ -695,7 +695,7 @@ XULContentSinkImpl::ReportError(const PRUnichar* aErrorText,
|
||||
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);
|
||||
@ -705,7 +705,7 @@ XULContentSinkImpl::ReportError(const PRUnichar* aErrorText,
|
||||
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());
|
||||
|
@ -5054,7 +5054,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -5930,7 +5930,7 @@ public:
|
||||
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;
|
||||
|
@ -498,7 +498,7 @@ nsresult mozHunspell::ConvertCharset(const PRUnichar* aStr, char ** 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);
|
||||
|
||||
|
@ -245,7 +245,7 @@ NS_IMETHODIMP mozEnglishWordUtils::FromRootForm(const PRUnichar *aWord, const PR
|
||||
|
||||
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);
|
||||
|
@ -45,7 +45,7 @@ NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape(
|
||||
{
|
||||
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)))
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ nsEntityConverter::ConvertToEntities(const PRUnichar *inString, PRUint32 entityV
|
||||
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]) &&
|
||||
|
@ -171,7 +171,7 @@ nsSaveAsCharset::DoCharsetConversion(const PRUnichar *inString, char **outString
|
||||
*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;
|
||||
|
@ -248,7 +248,7 @@ nsresult nsBidi::SetPara(const PRUnichar *aText, PRInt32 aLength,
|
||||
}
|
||||
|
||||
if(aLength==-1) {
|
||||
aLength=nsCRT::strlen(aText);
|
||||
aLength = NS_strlen(aText);
|
||||
}
|
||||
|
||||
/* initialize member data */
|
||||
|
@ -2379,9 +2379,9 @@ 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;
|
||||
|
@ -243,9 +243,9 @@ nsHttpAuthIdentity::Set(const PRUnichar *domain,
|
||||
{
|
||||
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));
|
||||
|
@ -1027,7 +1027,7 @@ 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)
|
||||
@ -1066,7 +1066,7 @@ mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line,
|
||||
// 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()))
|
||||
@ -1341,7 +1341,7 @@ mozTXTToHTMLConv::ScanTXT(const PRUnichar *text, PRUint32 whattodo,
|
||||
|
||||
// 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.
|
||||
|
@ -392,7 +392,7 @@ nsHTMLTags::AddRefTable(void)
|
||||
// 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,
|
||||
|
@ -167,7 +167,7 @@ nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * aPlatformAp
|
||||
CFURLRef pathAsCFURL;
|
||||
CFStringRef pathAsCFString = ::CFStringCreateWithCharacters(NULL,
|
||||
aPlatformAppPath,
|
||||
nsCRT::strlen(aPlatformAppPath));
|
||||
NS_strlen(aPlatformAppPath));
|
||||
if (!pathAsCFString)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -65,7 +65,7 @@ NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(PRUnichar* aTitle,
|
||||
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);
|
||||
|
@ -53,7 +53,7 @@ nsPrintDialogServiceX::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings,
|
||||
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);
|
||||
|
@ -428,7 +428,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT
|
||||
// (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;
|
||||
@ -510,7 +510,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT
|
||||
"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;
|
||||
@ -784,7 +784,7 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v
|
||||
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;
|
||||
}
|
||||
@ -797,7 +797,7 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v
|
||||
// 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
|
||||
}
|
||||
@ -827,7 +827,7 @@ nsClipboard :: FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, v
|
||||
// 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;
|
||||
}
|
||||
@ -849,7 +849,7 @@ nsClipboard :: FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, v
|
||||
// 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;
|
||||
}
|
||||
|
@ -802,8 +802,8 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
|
||||
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);
|
||||
|
@ -151,7 +151,7 @@ const char* nsCRT::memmem(const char* haystack, PRUint32 haystackLen,
|
||||
|
||||
PRUnichar* nsCRT::strdup(const PRUnichar* str)
|
||||
{
|
||||
PRUint32 len = nsCRT::strlen(str);
|
||||
PRUint32 len = NS_strlen(str);
|
||||
return strndup(str, len);
|
||||
}
|
||||
|
||||
|
@ -148,15 +148,6 @@ public:
|
||||
*/
|
||||
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
|
||||
|
@ -615,7 +615,7 @@ nsStringKey::nsStringKey(const PRUnichar* str, PRInt32 strLen, Ownership own)
|
||||
{
|
||||
NS_ASSERTION(mStr, "null string key");
|
||||
if (mStrLen == PRUint32(-1))
|
||||
mStrLen = nsCRT::strlen(str);
|
||||
mStrLen = NS_strlen(str);
|
||||
#ifdef DEBUG
|
||||
mKeyType = StringKey;
|
||||
#endif
|
||||
|
@ -410,7 +410,7 @@ static nsresult CloneArray(PRUint16 inType, const nsIID* inIID,
|
||||
{
|
||||
if(nsnull == (*(outp++) = (PRUnichar*)
|
||||
nsMemory::Clone(str,
|
||||
(nsCRT::strlen(str)+1)*sizeof(PRUnichar))))
|
||||
(NS_strlen(str) + 1) * sizeof(PRUnichar))))
|
||||
goto bad;
|
||||
}
|
||||
else
|
||||
@ -1483,7 +1483,7 @@ 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)
|
||||
|
@ -170,7 +170,7 @@ 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;
|
||||
|
||||
|
@ -258,7 +258,7 @@ 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. */
|
||||
|
@ -369,7 +369,7 @@ PRUnichar* nsLinebreakConverter::ConvertUnicharLineBreaks(const PRUnichar* aSrc,
|
||||
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)
|
||||
@ -395,7 +395,7 @@ nsresult nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(PRUnichar **ioBuff
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user