eliminate nsCRT::strlen for char* strings (part 1), bug 124536 r=dp sr=brendan

This commit is contained in:
cathleen%netscape.com 2002-02-19 07:36:56 +00:00
Родитель 60016580a6
Коммит 124339899e
18 изменённых файлов: 34 добавлений и 34 удалений

Просмотреть файл

@ -87,7 +87,7 @@ nsBasePrincipal::CanEnableCapability(const char *capability, PRInt16 *result)
*result = nsIPrincipal::ENABLE_GRANTED;
for(;;) {
const char *space = PL_strchr(start, ' ');
int len = space ? space - start : nsCRT::strlen(start);
int len = space ? space - start : strlen(start);
nsCAutoString capString(start, len);
nsCStringKey key(capString);
PRInt16 value = (PRInt16)NS_PTR_TO_INT32(mCapabilities->Get(&key));
@ -125,7 +125,7 @@ nsBasePrincipal::SetCanEnableCapability(const char *capability,
const char *start = capability;
for(;;) {
const char *space = PL_strchr(start, ' ');
int len = space ? space - start : nsCRT::strlen(start);
int len = space ? space - start : strlen(start);
nsCAutoString capString(start, len);
nsCStringKey key(capString);
mCapabilities->Put(&key, (void *) canEnable);
@ -149,7 +149,7 @@ nsBasePrincipal::IsCapabilityEnabled(const char *capability, void *annotation,
const char *start = capability;
for(;;) {
const char *space = PL_strchr(start, ' ');
int len = space ? space - start : nsCRT::strlen(start);
int len = space ? space - start : strlen(start);
nsCAutoString capString(start, len);
nsCStringKey key(capString);
*result = (ht->Get(&key) == (void *) AnnotationEnabled);
@ -184,7 +184,7 @@ nsBasePrincipal::RevertCapability(const char *capability, void **annotation)
const char *start = capability;
for(;;) {
const char *space = PL_strchr(start, ' ');
int len = space ? space - start : nsCRT::strlen(start);
int len = space ? space - start : strlen(start);
nsCAutoString capString(start, len);
nsCStringKey key(capString);
ht->Remove(&key);
@ -212,7 +212,7 @@ nsBasePrincipal::SetCapability(const char *capability, void **annotation,
const char *start = capability;
for(;;) {
const char *space = PL_strchr(start, ' ');
int len = space ? space - start : nsCRT::strlen(start);
int len = space ? space - start : strlen(start);
nsCAutoString capString(start, len);
nsCStringKey key(capString);
nsHashtable *ht = (nsHashtable *) *annotation;

Просмотреть файл

@ -200,7 +200,7 @@ struct DomainEntry
PRBool Matches(const char *anOrigin)
{
int len = nsCRT::strlen(anOrigin);
int len = strlen(anOrigin);
int thisLen = mOrigin.Length();
if (len < thisLen)
return PR_FALSE;

Просмотреть файл

@ -349,7 +349,7 @@ nsWyciwygChannel::WriteToCache(const char * aScript)
{
if (!mCacheEntry)
return NS_ERROR_FAILURE;
PRUint32 len = nsCRT::strlen(aScript);
PRUint32 len = strlen(aScript);
nsresult rv = NS_ERROR_FAILURE;
PRUint32 out;

Просмотреть файл

@ -116,7 +116,7 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
nsTextFragment&
nsTextFragment::operator=(const char *aString)
{
SetTo(aString, nsCRT::strlen(aString));
SetTo(aString, strlen(aString));
return *this;
}

Просмотреть файл

@ -894,7 +894,7 @@ nsLDAPConnection::OnFound(nsISupports *aContext,
// list of IPs.
//
PR_NetAddrToString(&netAddress, addrbuf, sizeof(addrbuf));
if ((addrbuf[0] == ':') && (nsCRT::strlen(addrbuf) > 7))
if ((addrbuf[0] == ':') && (strlen(addrbuf) > 7))
mResolvedIP.Append(addrbuf+7);
else
mResolvedIP.Append(addrbuf);

Просмотреть файл

@ -220,7 +220,7 @@ PRBool nsDefaultURIFixup::MakeAlternateURI(nsIURI *aURI)
}
else if (numDots == 1)
{
if (oldHost.EqualsIgnoreCase(prefix, nsCRT::strlen(prefix))) {
if (oldHost.EqualsIgnoreCase(prefix, strlen(prefix))) {
newHost.Assign(oldHost);
newHost.Append(suffix);
}

Просмотреть файл

@ -4655,7 +4655,7 @@ AHTC_WriteFunc(nsIInputStream * in,
PRUint32 toOffset, PRUint32 count, PRUint32 * writeCount)
{
if (nsnull == writeCount || nsnull == closure ||
nsnull == fromRawSegment || nsCRT::strlen(fromRawSegment) < 1) {
nsnull == fromRawSegment || strlen(fromRawSegment) < 1) {
return NS_BASE_STREAM_CLOSED;
}
@ -4664,7 +4664,7 @@ AHTC_WriteFunc(nsIInputStream * in,
// pointer to where we should start copying bytes from rawSegment
char *pHeadersBuf = nsnull;
PRUint32 headersBufLen;
PRUint32 rawSegmentLen = nsCRT::strlen(fromRawSegment);
PRUint32 rawSegmentLen = strlen(fromRawSegment);
// if the buffer has no data yet
if (!headersBuf) {
@ -4681,7 +4681,7 @@ AHTC_WriteFunc(nsIInputStream * in,
pHeadersBuf = headersBuf;
// create a new buffer
headersBufLen = nsCRT::strlen(headersBuf);
headersBufLen = strlen(headersBuf);
headersBuf =
(char *) nsMemory::Alloc(rawSegmentLen + headersBufLen + 1);
if (!headersBuf) {

Просмотреть файл

@ -2637,7 +2637,7 @@ GlobalWindowImpl::Unescape(const nsAReadableString& aStr,
char *src = nsUnescape(inBuf);
PRInt32 maxLength, srcLen;
srcLen = nsCRT::strlen(src);
srcLen = strlen(src);
// Get the expected length of the result string
result = decoder->GetMaxLength(src, srcLen, &maxLength);

Просмотреть файл

@ -96,7 +96,7 @@ NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *a
nsCOMPtr<nsIObserver> startupObserver;
if (serviceIdx == 0)
startupObserver = do_GetService(cid.get() + nsCRT::strlen(pServicePrefix), &rv);
startupObserver = do_GetService(cid.get() + strlen(pServicePrefix), &rv);
else
startupObserver = do_CreateInstance(contractId, &rv);

Просмотреть файл

@ -1698,7 +1698,7 @@ nsWindowWatcher::AddSupportsTojsvals(nsISupports *aArg,
p->GetData(&data);
JSString *str = ::JS_NewString(cx, data, nsCRT::strlen(data));
JSString *str = ::JS_NewString(cx, data, strlen(data));
NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
*aArgv = STRING_TO_JSVAL(str);

Просмотреть файл

@ -79,7 +79,7 @@ nsCookie::~nsCookie(void) {
NS_IMETHODIMP nsCookie::GetName(char * *aName) {
if (cookieName) {
*aName = (char *) nsMemory::Clone(cookieName, nsCRT::strlen(cookieName) + 1);
*aName = (char *) nsMemory::Clone(cookieName, strlen(cookieName) + 1);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
@ -87,7 +87,7 @@ NS_IMETHODIMP nsCookie::GetName(char * *aName) {
NS_IMETHODIMP nsCookie::GetValue(char * *aValue) {
if (cookieValue) {
*aValue = (char *) nsMemory::Clone(cookieValue, nsCRT::strlen(cookieValue) + 1);
*aValue = (char *) nsMemory::Clone(cookieValue, strlen(cookieValue) + 1);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
@ -100,7 +100,7 @@ NS_IMETHODIMP nsCookie::GetIsDomain(PRBool *aIsDomain) {
NS_IMETHODIMP nsCookie::GetHost(char * *aHost) {
if (cookieHost) {
*aHost = (char *) nsMemory::Clone(cookieHost, nsCRT::strlen(cookieHost) + 1);
*aHost = (char *) nsMemory::Clone(cookieHost, strlen(cookieHost) + 1);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;
@ -108,7 +108,7 @@ NS_IMETHODIMP nsCookie::GetHost(char * *aHost) {
NS_IMETHODIMP nsCookie::GetPath(char * *aPath) {
if (cookiePath) {
*aPath = (char *) nsMemory::Clone(cookiePath, nsCRT::strlen(cookiePath) + 1);
*aPath = (char *) nsMemory::Clone(cookiePath, strlen(cookiePath) + 1);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;

Просмотреть файл

@ -1517,7 +1517,7 @@ COOKIE_Write() {
continue;
}
strm.write(cookie_s->host, nsCRT::strlen(cookie_s->host));
strm.write(cookie_s->host, strlen(cookie_s->host));
if (cookie_s->isDomain) {
strm.write("\tTRUE\t", 6);
@ -1525,7 +1525,7 @@ COOKIE_Write() {
strm.write("\tFALSE\t", 7);
}
strm.write(cookie_s->path, nsCRT::strlen(cookie_s->path));
strm.write(cookie_s->path, strlen(cookie_s->path));
if (cookie_s->isSecure) {
strm.write("\tTRUE\t", 6);
@ -1535,11 +1535,11 @@ COOKIE_Write() {
PR_snprintf(date_string, sizeof(date_string), "%lu", NS_STATIC_CAST(unsigned long, cookie_s->expires));
strm.write(date_string, nsCRT::strlen(date_string));
strm.write(date_string, strlen(date_string));
strm.write("\t", 1);
strm.write(cookie_s->name, nsCRT::strlen(cookie_s->name));
strm.write(cookie_s->name, strlen(cookie_s->name));
strm.write("\t", 1);
strm.write(cookie_s->cookie, nsCRT::strlen(cookie_s->cookie));
strm.write(cookie_s->cookie, strlen(cookie_s->cookie));
strm.write("\n", 1);
}

Просмотреть файл

@ -64,7 +64,7 @@ nsPermission::~nsPermission(void) {
NS_IMETHODIMP nsPermission::GetHost(char * *aHost) {
if (permissionHost) {
*aHost = (char *) nsMemory::Clone(permissionHost, nsCRT::strlen(permissionHost) + 1);
*aHost = (char *) nsMemory::Clone(permissionHost, strlen(permissionHost) + 1);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;

Просмотреть файл

@ -397,7 +397,7 @@ Permission_Save() {
for (PRInt32 i = 0; i < hostCount; ++i) {
hostStruct = NS_STATIC_CAST(permission_HostStruct*, permission_list->ElementAt(i));
if (hostStruct) {
strm.write(hostStruct->host, nsCRT::strlen(hostStruct->host));
strm.write(hostStruct->host, strlen(hostStruct->host));
PRInt32 typeCount = hostStruct->permissionList->Count();
for (PRInt32 typeIndex=0; typeIndex<typeCount; typeIndex++) {

Просмотреть файл

@ -519,18 +519,18 @@ nsresult nsAutoConfig::getEmailAddr(nsAWritableCString & emailAddr)
// Checking prefValue and its length. Since by default the preference
// is set to nothing
PRUint32 len;
if (NS_SUCCEEDED(rv) && (len = nsCRT::strlen(prefValue)) > 0) {
if (NS_SUCCEEDED(rv) && (len = strlen(prefValue)) > 0) {
emailAddr = NS_LITERAL_CSTRING("mail.account.") +
nsDependentCString(prefValue, len) + NS_LITERAL_CSTRING(".identities");
rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(),
getter_Copies(prefValue));
if (NS_FAILED(rv) || (len = nsCRT::strlen(prefValue)) == 0)
if (NS_FAILED(rv) || (len = strlen(prefValue)) == 0)
return rv;
emailAddr = NS_LITERAL_CSTRING("mail.identity.") +
nsDependentCString(prefValue, len) + NS_LITERAL_CSTRING(".useremail");
rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(),
getter_Copies(prefValue));
if (NS_FAILED(rv) || (len = nsCRT::strlen(prefValue)) == 0)
if (NS_FAILED(rv) || (len = strlen(prefValue)) == 0)
return rv;
emailAddr = nsDependentCString(prefValue, len);
}

Просмотреть файл

@ -677,7 +677,7 @@ char* String::toCharArray() const
**/
char* String::toCharArray(char* dest) const
{
ptrNSString->ToCString(dest, nsCRT::strlen(dest)+1);
ptrNSString->ToCString(dest, strlen(dest)+1);
return dest;
}

Просмотреть файл

@ -63,7 +63,7 @@ nsPassword::~nsPassword(void) {
NS_IMETHODIMP nsPassword::GetHost(char * *aHost) {
if (passwordHost) {
*aHost = (char *) nsMemory::Clone(passwordHost, nsCRT::strlen(passwordHost) + 1);
*aHost = (char *) nsMemory::Clone(passwordHost, strlen(passwordHost) + 1);
return NS_OK;
}
return NS_ERROR_NULL_POINTER;

Просмотреть файл

@ -2651,7 +2651,7 @@ SINGSIGN_Enumerate
hostStruct = NS_STATIC_CAST(si_SignonURLStruct*, si_signon_list->ElementAt(hostNumber));
NS_ASSERTION(hostStruct, "corrupt singlesignon list");
*host = (char *) nsMemory::Clone
(hostStruct->passwordRealm, nsCRT::strlen(hostStruct->passwordRealm) + 1);
(hostStruct->passwordRealm, strlen(hostStruct->passwordRealm) + 1);
NS_ENSURE_ARG_POINTER(host);
userStruct = NS_STATIC_CAST
(si_SignonUserStruct*, hostStruct->signonUser_list.ElementAt(userNumber));
@ -2713,7 +2713,7 @@ SINGSIGN_RejectEnumerate
NS_ASSERTION(reject, "corrupt reject list");
*host = (char *) nsMemory::Clone
(reject->passwordRealm, nsCRT::strlen(reject->passwordRealm) + 1);
(reject->passwordRealm, strlen(reject->passwordRealm) + 1);
NS_ENSURE_ARG_POINTER(host);
return NS_OK;
}