Skip to content

Commit 9e718b0

Browse files
Rename ArraySize() to MATTER_ARRAY_SIZE() (#37660)
* Rename ArraySize() to MATTER_ARRAY_SIZE * Updated usages of ArraySize() to MATTER_ARRAY_SIZE() * Restyled by clang-format * Guard with #ifndef * fix recently introduced usage in chime * fix typo --------- Co-authored-by: Restyled.io <[email protected]>
1 parent 5fd96ed commit 9e718b0

File tree

185 files changed

+607
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+607
-567
lines changed

examples/air-quality-sensor-app/silabs/src/SensorManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void SensorManager::SensorTimerEventHandler(void * arg)
159159
static uint8_t simulatedIndex = 0;
160160

161161
// Ensure the simulatedIndex wraps around the array size to avoid out-of-bounds access
162-
simulatedIndex = simulatedIndex % ArraySize(mSimulatedAirQuality);
162+
simulatedIndex = simulatedIndex % MATTER_ARRAY_SIZE(mSimulatedAirQuality);
163163
// Retrieve the current air quality value from the simulated data array using the simulatedIndex
164164
air_quality = mSimulatedAirQuality[simulatedIndex];
165165

examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void DishwasherModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Comma
4141

4242
CHIP_ERROR DishwasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4343
{
44-
if (modeIndex >= ArraySize(kModeOptions))
44+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4545
{
4646
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4747
}
@@ -50,7 +50,7 @@ CHIP_ERROR DishwasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::
5050

5151
CHIP_ERROR DishwasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5252
{
53-
if (modeIndex >= ArraySize(kModeOptions))
53+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5454
{
5555
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5656
}
@@ -60,7 +60,7 @@ CHIP_ERROR DishwasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_
6060

6161
CHIP_ERROR DishwasherModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6262
{
63-
if (modeIndex >= ArraySize(kModeOptions))
63+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6464
{
6565
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6666
}

examples/all-clusters-app/all-clusters-common/src/energy-preference-delegate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ EPrefDelegate::~EPrefDelegate()
7171

7272
size_t EPrefDelegate::GetNumEnergyBalances(chip::EndpointId aEndpoint)
7373
{
74-
return (ArraySize(gsEnergyBalances));
74+
return (MATTER_ARRAY_SIZE(gsEnergyBalances));
7575
}
7676

7777
size_t EPrefDelegate::GetNumLowPowerModeSensitivities(chip::EndpointId aEndpoint)
7878
{
79-
return (ArraySize(gsEnergyBalances));
79+
return (MATTER_ARRAY_SIZE(gsEnergyBalances));
8080
}
8181

8282
CHIP_ERROR
@@ -104,7 +104,7 @@ EPrefDelegate::GetEnergyPriorityAtIndex(chip::EndpointId aEndpoint, size_t aInde
104104
{
105105
static EnergyPriorityEnum priorities[] = { EnergyPriorityEnum::kEfficiency, EnergyPriorityEnum::kComfort };
106106

107-
if (aIndex < ArraySize(priorities))
107+
if (aIndex < MATTER_ARRAY_SIZE(priorities))
108108
{
109109
priority = priorities[aIndex];
110110
return CHIP_NO_ERROR;

examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LaundryDryerControlDelegate LaundryDryerControlDelegate::instance;
3131
// TODO: Add EndpointId to the API so that different values per endpoint may be possible in some implementations.
3232
CHIP_ERROR LaundryDryerControlDelegate::GetSupportedDrynessLevelAtIndex(size_t index, DrynessLevelEnum & supportedDrynessLevel)
3333
{
34-
if (index >= ArraySize(supportedDrynessLevelOptions))
34+
if (index >= MATTER_ARRAY_SIZE(supportedDrynessLevelOptions))
3535
{
3636
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
3737
}

examples/all-clusters-app/all-clusters-common/src/laundry-washer-controls-delegate-impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ LaundryWasherControlDelegate LaundryWasherControlDelegate::instance;
3838

3939
CHIP_ERROR LaundryWasherControlDelegate::GetSpinSpeedAtIndex(size_t index, MutableCharSpan & spinSpeed)
4040
{
41-
if (index >= ArraySize(spinSpeedsNameOptions))
41+
if (index >= MATTER_ARRAY_SIZE(spinSpeedsNameOptions))
4242
{
4343
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4444
}
@@ -47,7 +47,7 @@ CHIP_ERROR LaundryWasherControlDelegate::GetSpinSpeedAtIndex(size_t index, Mutab
4747

4848
CHIP_ERROR LaundryWasherControlDelegate::GetSupportedRinseAtIndex(size_t index, NumberOfRinsesEnum & supportedRinse)
4949
{
50-
if (index >= ArraySize(supportRinsesOptions))
50+
if (index >= MATTER_ARRAY_SIZE(supportRinsesOptions))
5151
{
5252
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5353
}

examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void LaundryWasherModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Co
4040

4141
CHIP_ERROR LaundryWasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4242
{
43-
if (modeIndex >= ArraySize(kModeOptions))
43+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4444
{
4545
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4646
}
@@ -49,7 +49,7 @@ CHIP_ERROR LaundryWasherModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chi
4949

5050
CHIP_ERROR LaundryWasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5151
{
52-
if (modeIndex >= ArraySize(kModeOptions))
52+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5353
{
5454
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5555
}
@@ -59,7 +59,7 @@ CHIP_ERROR LaundryWasherModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uin
5959

6060
CHIP_ERROR LaundryWasherModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6161
{
62-
if (modeIndex >= ArraySize(kModeOptions))
62+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6363
{
6464
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6565
}

examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void ExampleMicrowaveOvenModeDelegate::HandleChangeToMode(uint8_t NewMode,
4242

4343
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4444
{
45-
if (modeIndex >= ArraySize(kModeOptions))
45+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4646
{
4747
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4848
}
@@ -51,7 +51,7 @@ CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeLabelByIndex(uint8_t modeInd
5151

5252
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5353
{
54-
if (modeIndex >= ArraySize(kModeOptions))
54+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5555
{
5656
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5757
}
@@ -61,7 +61,7 @@ CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeValueByIndex(uint8_t modeInd
6161

6262
CHIP_ERROR ExampleMicrowaveOvenModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6363
{
64-
if (modeIndex >= ArraySize(kModeOptions))
64+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6565
{
6666
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6767
}

examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void OvenModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::C
4242

4343
CHIP_ERROR OvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4444
{
45-
if (modeIndex >= ArraySize(kModeOptions))
45+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4646
{
4747
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4848
}
@@ -51,7 +51,7 @@ CHIP_ERROR OvenModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Mutabl
5151

5252
CHIP_ERROR OvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5353
{
54-
if (modeIndex >= ArraySize(kModeOptions))
54+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5555
{
5656
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5757
}
@@ -61,7 +61,7 @@ CHIP_ERROR OvenModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & va
6161

6262
CHIP_ERROR OvenModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6363
{
64-
if (modeIndex >= ArraySize(kModeOptions))
64+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6565
{
6666
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6767
}

examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
6868

6969
CHIP_ERROR RvcRunModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
7070
{
71-
if (modeIndex >= ArraySize(kModeOptions))
71+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
7272
{
7373
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
7474
}
@@ -77,7 +77,7 @@ CHIP_ERROR RvcRunModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Muta
7777

7878
CHIP_ERROR RvcRunModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
7979
{
80-
if (modeIndex >= ArraySize(kModeOptions))
80+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
8181
{
8282
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
8383
}
@@ -87,7 +87,7 @@ CHIP_ERROR RvcRunModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t &
8787

8888
CHIP_ERROR RvcRunModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
8989
{
90-
if (modeIndex >= ArraySize(kModeOptions))
90+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
9191
{
9292
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
9393
}
@@ -161,7 +161,7 @@ void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Command
161161

162162
CHIP_ERROR RvcCleanModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
163163
{
164-
if (modeIndex >= ArraySize(kModeOptions))
164+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
165165
{
166166
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
167167
}
@@ -170,7 +170,7 @@ CHIP_ERROR RvcCleanModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Mu
170170

171171
CHIP_ERROR RvcCleanModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
172172
{
173-
if (modeIndex >= ArraySize(kModeOptions))
173+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
174174
{
175175
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
176176
}
@@ -180,7 +180,7 @@ CHIP_ERROR RvcCleanModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t
180180

181181
CHIP_ERROR RvcCleanModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
182182
{
183-
if (modeIndex >= ArraySize(kModeOptions))
183+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
184184
{
185185
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
186186
}

examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void TccModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands::Ch
4040

4141
CHIP_ERROR TccModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::MutableCharSpan & label)
4242
{
43-
if (modeIndex >= ArraySize(kModeOptions))
43+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
4444
{
4545
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4646
}
@@ -49,7 +49,7 @@ CHIP_ERROR TccModeDelegate::GetModeLabelByIndex(uint8_t modeIndex, chip::Mutable
4949

5050
CHIP_ERROR TccModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & value)
5151
{
52-
if (modeIndex >= ArraySize(kModeOptions))
52+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
5353
{
5454
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
5555
}
@@ -59,7 +59,7 @@ CHIP_ERROR TccModeDelegate::GetModeValueByIndex(uint8_t modeIndex, uint8_t & val
5959

6060
CHIP_ERROR TccModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, List<ModeTagStructType> & tags)
6161
{
62-
if (modeIndex >= ArraySize(kModeOptions))
62+
if (modeIndex >= MATTER_ARRAY_SIZE(kModeOptions))
6363
{
6464
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
6565
}

0 commit comments

Comments
 (0)