Bug 1393230 - Part 2: Fix more improper string usages. r=njn

This fixes improper usages of Find where an offset was actually being use for
the boolean ignore case flag. It also fixes a few instances of passing in a
literal wchar_t to our functions where a NS_LITERAL_STRING or char16_t should
be used instead.
This commit is contained in:
Eric Rahm 2017-08-31 15:52:30 -07:00
Родитель 9cd333b2ef
Коммит 70ece631cb
6 изменённых файлов: 10 добавлений и 9 удалений

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

@ -93,7 +93,7 @@ CacheDirAndAutoClear(nsIProperties* aDirSvc, const char* aDirKey,
MOZ_ALWAYS_SUCCEEDS(dirToCache->GetPath(**cacheVar));
// Convert network share path to format for sandbox policy.
if (Substring(**cacheVar, 0, 2).Equals(L"\\\\")) {
if (Substring(**cacheVar, 0, 2).Equals(NS_LITERAL_STRING("\\\\"))) {
(*cacheVar)->InsertLiteral(u"??\\UNC", 1);
}
}

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

@ -158,7 +158,7 @@ IsMatchWildcard(const nsACString& aHost, const nsACString& aOverride)
tokenEnd = overrideLength; // no '*' char, match rest of string
}
nsAutoCString token(Substring(override, tokenStart, tokenEnd - tokenStart));
offset = host.Find(token, offset);
offset = host.Find(token, /* aIgnoreCase = */ false, offset);
if (offset == -1 || (!star && offset)) {
return false;
}

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

@ -158,7 +158,7 @@ IsMatchWildcard(const nsACString& aHost, const nsACString& aOverride)
tokenEnd = overrideLength; // no '*' char, match rest of string
}
nsAutoCString token(Substring(override, tokenStart, tokenEnd - tokenStart));
offset = host.Find(token, offset);
offset = host.Find(token, /* aIgnoreCase = */ false, offset);
if (offset == -1 || (!star && offset)) {
return false;
}

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

@ -67,7 +67,8 @@ GdkErrorHandler(const gchar *log_domain, GLogLevelFlags log_level,
NS_RUNTIMEABORT(message);
NS_NAMED_LITERAL_CSTRING(minorCodeString, " minor_code ");
start = buffer.Find(minorCodeString, endptr - buffer.BeginReading());
start = buffer.Find(minorCodeString, /* aIgnoreCase = */ false,
endptr - buffer.BeginReading());
if (!start)
NS_RUNTIMEABORT(message);

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

@ -302,8 +302,8 @@ IMMHandler::IsGoogleJapaneseInputActive()
{
// NOTE: Even on Windows for en-US, the name of Google Japanese Input is
// written in Japanese.
return sIMEName.Equals(L"Google \x65E5\x672C\x8A9E\x5165\x529B "
L"IMM32 \x30E2\x30B8\x30E5\x30FC\x30EB");
return sIMEName.Equals(u"Google \x65E5\x672C\x8A9E\x5165\x529B "
u"IMM32 \x30E2\x30B8\x30E5\x30FC\x30EB");
}
// static

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

@ -1024,9 +1024,9 @@ nsLocalFile::ResolveAndStat()
// this is usually correct
mResolvedPath.Assign(mWorkingPath);
// slutty hack designed to work around bug 134796 until it is fixed
nsAutoString nsprPath(mWorkingPath.get());
if (mWorkingPath.Length() == 2 && mWorkingPath.CharAt(1) == L':') {
// Make sure root paths have a trailing slash.
nsAutoString nsprPath(mWorkingPath);
if (mWorkingPath.Length() == 2 && mWorkingPath.CharAt(1) == u':') {
nsprPath.Append('\\');
}