Bug 1393235 - Fix improper usages of string functions. r=njn
This fixes usages of `Find`, `RFind` and the equality operator that kind of
work right now but will break with the proper type checking of a templatized
version of the string classes.
For `Find` and `RFind` it appears that `nsCString::(R)Find("foo", 0)` calls
were being coerced to the `Find(char*, bool, int, int)` versions. The intent was
probably to just start searching from position zero.
For the equality operator, the type of nullptr is nullptr_t rather than
char(16_t)* so we'd need to add an operator overload that takes nullptr_t. In
this case just using `IsVoid` is probably more appropriate.
This commit is contained in:
@@ -992,7 +992,7 @@ Classifier::ScanStoreDir(nsIFile* aDirectory, nsTArray<nsCString>& aTables)
|
||||
// Both v2 and v4 contain .pset file
|
||||
nsCString suffix(NS_LITERAL_CSTRING(".pset"));
|
||||
|
||||
int32_t dot = leafName.RFind(suffix, 0);
|
||||
int32_t dot = leafName.RFind(suffix);
|
||||
if (dot != -1) {
|
||||
leafName.Cut(dot, suffix.Length());
|
||||
aTables.AppendElement(leafName);
|
||||
@@ -1582,7 +1582,7 @@ Classifier::LoadMetadata(nsIFile* aDirectory, nsACString& aResult)
|
||||
rv = file->GetNativeLeafName(tableName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
int32_t dot = tableName.RFind(METADATA_SUFFIX, 0);
|
||||
int32_t dot = tableName.RFind(METADATA_SUFFIX);
|
||||
if (dot == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user