mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 1766561 - Adjust UTF-16 string formatting. r=nika
With MOZ_FORMAT_PRINTF annotations, the compiler expects a wchar_t*, and it won't automatically consider char16ptr_t to be compatible with that. While handling strings, there's one case of formatting that doesn't need to use %S at all. Differential Revision: https://phabricator.services.mozilla.com/D144919
This commit is contained in:
parent
90c1d1fba0
commit
2d6c8fdbc6
@ -805,7 +805,7 @@ static nsresult CreateShortcutImpl(
|
||||
// TODO: Properly escape quotes in the string, see bug 1604287.
|
||||
nsString arguments;
|
||||
for (auto& arg : aArguments) {
|
||||
arguments.AppendPrintf("\"%S\" ", arg.get());
|
||||
arguments.AppendPrintf("\"%S\" ", static_cast<const wchar_t*>(arg.get()));
|
||||
}
|
||||
|
||||
link->SetArguments(arguments.get());
|
||||
|
@ -221,7 +221,7 @@ nsAuthSSPI::Init(const nsACString& aServiceName, uint32_t aServiceFlags,
|
||||
PSecPkgInfoW pinfo;
|
||||
rc = (sspi->QuerySecurityPackageInfoW)(package, &pinfo);
|
||||
if (rc != SEC_E_OK) {
|
||||
LOG(("%s package not found\n", package));
|
||||
LOG(("%S package not found\n", package));
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
mMaxTokenLen = pinfo->cbMaxToken;
|
||||
|
@ -469,7 +469,8 @@ static nsresult AccountHasFamilySafetyEnabled(bool& enabled) {
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("couldn't get sid"));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("our sid is '%S'", sid.get()));
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
|
||||
("our sid is '%S'", static_cast<const wchar_t*>(sid.get())));
|
||||
bool hasSid;
|
||||
rv = usersKey->HasChild(sid, &hasSid);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -406,7 +406,7 @@ static void AddCachedDirRule(sandbox::TargetPolicy* aPolicy,
|
||||
// This can only be an NS_WARNING, because it can null for xpcshell tests.
|
||||
NS_WARNING("Tried to add rule with null base dir.");
|
||||
LOG_E("Tried to add rule with null base dir. Relative path: %S, Access: %d",
|
||||
aRelativePath.get(), aAccess);
|
||||
static_cast<const wchar_t*>(aRelativePath.get()), aAccess);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ static void AddCachedDirRule(sandbox::TargetPolicy* aPolicy,
|
||||
if (sandbox::SBOX_ALL_OK != result) {
|
||||
NS_ERROR("Failed to add file policy rule.");
|
||||
LOG_E("Failed (ResultCode %d) to add %d access to: %S", result, aAccess,
|
||||
rulePath.get());
|
||||
static_cast<const wchar_t*>(rulePath.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ static void BuildClassName(const char* aProgram, const char* aProfile,
|
||||
# if defined XP_WIN
|
||||
nsString pfn = mozilla::widget::WinUtils::GetPackageFamilyName();
|
||||
if (!pfn.IsEmpty()) {
|
||||
aClassName.AppendPrintf("_%s", pfn.get());
|
||||
aClassName.AppendPrintf("_%S", static_cast<const wchar_t*>(pfn.get()));
|
||||
}
|
||||
# endif
|
||||
aClassName.AppendPrintf("_%s_RemoteWindow", aProfile);
|
||||
|
@ -444,8 +444,8 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
|
||||
bool haveMeaningfulMimeType =
|
||||
!aMIMEType.IsEmpty() &&
|
||||
!aMIMEType.LowerCaseEqualsLiteral(APPLICATION_OCTET_STREAM);
|
||||
LOG(("Extension lookup on '%s' with mimetype '%s'%s\n", fileExtension.get(),
|
||||
flatType.get(),
|
||||
LOG(("Extension lookup on '%S' with mimetype '%s'%s\n",
|
||||
static_cast<const wchar_t*>(fileExtension.get()), flatType.get(),
|
||||
haveMeaningfulMimeType ? " (treated as meaningful)" : ""));
|
||||
|
||||
RefPtr<nsMIMEInfoWin> mi;
|
||||
@ -477,14 +477,14 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
|
||||
!typeFromExtEquals(fileExtension.get(), flatType.get()))) {
|
||||
usedMimeTypeExtensionForLookup = true;
|
||||
fileExtension = extensionFromMimeType;
|
||||
LOG(("Now using '%s' mimetype's default file extension '%s' for lookup\n",
|
||||
flatType.get(), fileExtension.get()));
|
||||
LOG(("Now using '%s' mimetype's default file extension '%S' for lookup\n",
|
||||
flatType.get(), static_cast<const wchar_t*>(fileExtension.get())));
|
||||
}
|
||||
|
||||
// If we have an extension, use it for lookup:
|
||||
mi = GetByExtension(fileExtension, flatType.get());
|
||||
LOG(("Extension lookup on '%s' found: 0x%p\n", fileExtension.get(),
|
||||
mi.get()));
|
||||
LOG(("Extension lookup on '%S' found: 0x%p\n",
|
||||
static_cast<const wchar_t*>(fileExtension.get()), mi.get()));
|
||||
|
||||
if (mi) {
|
||||
bool hasDefault = false;
|
||||
@ -494,8 +494,9 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
|
||||
if (!hasDefault && !usedMimeTypeExtensionForLookup) {
|
||||
RefPtr<nsMIMEInfoWin> miFromMimeType =
|
||||
GetByExtension(extensionFromMimeType, flatType.get());
|
||||
LOG(("Mime-based ext. lookup for '%s' found 0x%p\n",
|
||||
extensionFromMimeType.get(), miFromMimeType.get()));
|
||||
LOG(("Mime-based ext. lookup for '%S' found 0x%p\n",
|
||||
static_cast<const wchar_t*>(extensionFromMimeType.get()),
|
||||
miFromMimeType.get()));
|
||||
if (miFromMimeType) {
|
||||
nsAutoString desc;
|
||||
miFromMimeType->GetDefaultDescription(desc);
|
||||
@ -510,8 +511,8 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
|
||||
// different:
|
||||
if (!extensionFromMimeType.IsEmpty() && !usedMimeTypeExtensionForLookup) {
|
||||
mi = GetByExtension(extensionFromMimeType, flatType.get());
|
||||
LOG(("Mime-based ext. lookup for '%s' found 0x%p\n",
|
||||
extensionFromMimeType.get(), mi.get()));
|
||||
LOG(("Mime-based ext. lookup for '%S' found 0x%p\n",
|
||||
static_cast<const wchar_t*>(extensionFromMimeType.get()), mi.get()));
|
||||
}
|
||||
if (mi) {
|
||||
mi.forget(aMIMEInfo);
|
||||
|
@ -124,7 +124,8 @@ GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
|
||||
ClearTypeParameterInfo& params = clearTypeParams[d];
|
||||
|
||||
if (displayNames) {
|
||||
outStr.AppendPrintf("%S [ ", params.displayName.get());
|
||||
outStr.AppendPrintf(
|
||||
"%S [ ", static_cast<const wchar_t*>(params.displayName.get()));
|
||||
}
|
||||
|
||||
if (params.gamma >= 0) {
|
||||
@ -137,8 +138,8 @@ GfxInfo::GetCleartypeParameters(nsAString& aCleartypeParams) {
|
||||
if (params.pixelStructure == PIXEL_STRUCT_RGB ||
|
||||
params.pixelStructure == PIXEL_STRUCT_BGR) {
|
||||
outStr.AppendPrintf(
|
||||
"Pixel Structure: %S ",
|
||||
(params.pixelStructure == PIXEL_STRUCT_RGB ? u"RGB" : u"BGR"));
|
||||
"Pixel Structure: %s ",
|
||||
(params.pixelStructure == PIXEL_STRUCT_RGB ? "RGB" : "BGR"));
|
||||
} else {
|
||||
outStr.AppendPrintf("Pixel Structure: %d ", params.pixelStructure);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user