Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang

Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
This commit is contained in:
serge-sans-paille
2024-10-24 07:38:30 +00:00
parent 6b307b0556
commit 2c916d4973
370 changed files with 1113 additions and 1275 deletions

View File

@@ -1169,7 +1169,7 @@ static nsresult GetMatchingShortcut(int aCSIDL, const nsAString& aAUMID,
static_assert(MAXPATHLEN == MAX_PATH);
wchar_t storedExePath[MAX_PATH] = {};
// With no flags GetPath gets a long path
hr = link->GetPath(storedExePath, ArrayLength(storedExePath), nullptr, 0);
hr = link->GetPath(storedExePath, std::size(storedExePath), nullptr, 0);
if (FAILED(hr) || hr == S_FALSE) {
continue;
}
@@ -1394,7 +1394,7 @@ static bool IsCurrentAppPinnedToTaskbarSync(const nsAString& aumid) {
static_assert(MAXPATHLEN == MAX_PATH);
wchar_t storedExePath[MAX_PATH] = {};
// With no flags GetPath gets a long path
hr = link->GetPath(storedExePath, ArrayLength(storedExePath), nullptr, 0);
hr = link->GetPath(storedExePath, std::size(storedExePath), nullptr, 0);
if (FAILED(hr) || hr == S_FALSE) {
continue;
}
@@ -2579,7 +2579,7 @@ nsWindowsShellService::ClassifyShortcut(const nsAString& aPath,
{FOLDERID_UserPinned, u"\\TaskBar\\", u"Taskbar"},
{FOLDERID_UserPinned, u"\\StartMenu\\", u"StartMenu"}};
for (size_t i = 0; i < ArrayLength(folders); ++i) {
for (size_t i = 0; i < std::size(folders); ++i) {
nsAutoString knownPath;
// These flags are chosen to avoid I/O, see bug 1363398.