Commit 2d6c8fdb authored by Mike Hommey's avatar Mike Hommey
Browse files

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
parent 90c1d1fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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());
+1 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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)) {
+2 −2
Original line number Diff line number Diff line
@@ -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()));
  }
}

+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading