Bug 212272: Switch some Substring users over to String(Begins|Ends)With. r=dwitte, sr=bzbarsky
git-svn-id: svn://10.0.0.236/trunk@144817 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -78,7 +78,7 @@ static void PrintImageDecoders()
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(decoderContract, "@mozilla.org/image/decoder;2?type=");
|
||||
|
||||
if (Substring(xcs, 0, decoderContract.Length()).Equals(decoderContract)) {
|
||||
if (StringBeginsWith(xcs, decoderContract)) {
|
||||
printf("Have decoder for mime type: %s\n", xcs.get()+decoderContract.Length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ JSBool pref_InitInitialObjects()
|
||||
rv = aFile->GetNativeLeafName(leafName);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Skip non-js files
|
||||
if ((leafName.Length() < 3) || !Substring(leafName, leafName.Length() - 3, 3).Equals(NS_LITERAL_CSTRING(".js")))
|
||||
if (!StringEndsWith(leafName, NS_LITERAL_CSTRING(".js")))
|
||||
shouldParse = PR_FALSE;
|
||||
// Skip files in the special list.
|
||||
if (shouldParse) {
|
||||
|
||||
@@ -254,16 +254,15 @@ PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
|
||||
if (NS_FAILED(file->GetNativeLeafName(filename)))
|
||||
return PR_FALSE;
|
||||
|
||||
int len = filename.Length();
|
||||
nsCAutoString suffix (LOCAL_PLUGIN_DLL_SUFFIX);
|
||||
int slen = suffix.Length();
|
||||
if (len > slen && suffix.Equals(Substring(filename,len-slen,slen)))
|
||||
NS_NAMED_LITERAL_CSTRING(dllSuffix, LOCAL_PLUGIN_DLL_SUFFIX);
|
||||
if (filename.Length() > dllSuffix.Length() &&
|
||||
StringEndsWith(filename, dllSuffix))
|
||||
return PR_TRUE;
|
||||
|
||||
#ifdef LOCAL_PLUGIN_DLL_ALT_SUFFIX
|
||||
suffix.Assign(LOCAL_PLUGIN_DLL_ALT_SUFFIX);
|
||||
slen = suffix.Length();
|
||||
if (len > slen && suffix.Equals(Substring(filename,len-slen,slen)))
|
||||
NS_NAMED_LITERAL_CSTRING(dllAltSuffix, LOCAL_PLUGIN_DLL_ALT_SUFFIX);
|
||||
if (filename.Length() > dllAltSuffix.Length() &&
|
||||
StringEndsWith(filename, dllAltSuffix))
|
||||
return PR_TRUE;
|
||||
#endif
|
||||
return PR_FALSE;
|
||||
|
||||
Reference in New Issue
Block a user