зеркало из https://github.com/mozilla/gecko-dev.git
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. --HG-- extra : rebase_source : 50f78519084012ca669da0a211c489520c11d6b6
This commit is contained in:
Родитель
f648960668
Коммит
9398bd6f43
|
@ -687,7 +687,7 @@ nsDefaultURIFixup::FixupURIProtocol(const nsACString& aURIString,
|
|||
// no-scheme.com/query?foo=http://www.foo.com
|
||||
// user:pass@no-scheme.com
|
||||
//
|
||||
int32_t schemeDelim = uriString.Find("://", 0);
|
||||
int32_t schemeDelim = uriString.Find("://");
|
||||
int32_t firstDelim = uriString.FindCharInSet("/:");
|
||||
if (schemeDelim <= 0 ||
|
||||
(firstDelim != -1 && schemeDelim > firstDelim)) {
|
||||
|
|
|
@ -232,7 +232,7 @@ ChromiumCDMChild::OnResolveNewSessionPromiseInternal(uint32_t aPromiseId,
|
|||
// a session it calls OnResolveNewSessionPromise with nullptr as the sessionId.
|
||||
// We can safely assume this means that we have failed to load a session
|
||||
// as the other methods specify calling 'OnRejectPromise' when they fail.
|
||||
bool loadSuccessful = aSessionId != nullptr;
|
||||
bool loadSuccessful = !aSessionId.IsEmpty();
|
||||
GMP_LOG("ChromiumCDMChild::OnResolveNewSessionPromise(pid=%u, sid=%s) "
|
||||
"resolving %s load session ",
|
||||
aPromiseId,
|
||||
|
|
|
@ -1939,7 +1939,7 @@ PlacesSQLQueryBuilder::Where()
|
|||
|
||||
// If we used WHERE already, we inject the conditions
|
||||
// in place of {ADDITIONAL_CONDITIONS}
|
||||
if (mQueryString.Find("{ADDITIONAL_CONDITIONS}", 0) != kNotFound) {
|
||||
if (mQueryString.Find("{ADDITIONAL_CONDITIONS}") != kNotFound) {
|
||||
nsAutoCString innerCondition;
|
||||
// If we have condition AND it
|
||||
if (!mConditions.IsEmpty()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче