Skip to content

Commit

Permalink
Use standard std::min std::max functions (#36065)
Browse files Browse the repository at this point in the history
* Use standard std::min std::max functions

* Restyled by clang-format

* Convert some more max calls

* More updates

* Another fix

* Add missing include

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
arkq and restyled-commits authored Oct 15, 2024
1 parent bbc0fb2 commit 8a08d57
Show file tree
Hide file tree
Showing 48 changed files with 91 additions and 118 deletions.
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class Commands
{
public:
using CommandsVector = ::std::vector<std::unique_ptr<Command>>;
using CommandsVector = std::vector<std::unique_ptr<Command>>;

void RegisterCluster(const char * clusterName, commands_list commandsList)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,10 +934,10 @@ Status EnergyEvseDelegate::ComputeMaxChargeCurrentLimit()

oldValue = mActualChargingCurrentLimit;
mActualChargingCurrentLimit = mMaxHardwareCurrentLimit;
mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCircuitCapacity);
mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mCableAssemblyCurrentLimit);
mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mMaximumChargingCurrentLimitFromCommand);
mActualChargingCurrentLimit = min(mActualChargingCurrentLimit, mUserMaximumChargeCurrent);
mActualChargingCurrentLimit = std::min(mActualChargingCurrentLimit, mCircuitCapacity);
mActualChargingCurrentLimit = std::min(mActualChargingCurrentLimit, mCableAssemblyCurrentLimit);
mActualChargingCurrentLimit = std::min(mActualChargingCurrentLimit, mMaximumChargingCurrentLimitFromCommand);
mActualChargingCurrentLimit = std::min(mActualChargingCurrentLimit, mUserMaximumChargeCurrent);

/* Set the actual max charging current attribute */
mMaximumChargeCurrent = mActualChargingCurrentLimit;
Expand Down
2 changes: 1 addition & 1 deletion examples/fabric-admin/commands/common/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class Commands
{
public:
using CommandsVector = ::std::vector<std::unique_ptr<Command>>;
using CommandsVector = std::vector<std::unique_ptr<Command>>;

void RegisterCluster(const char * clusterName, commands_list commandsList)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ constexpr uint32_t kBdxServerPollIntervalMillis = 50;
void GetUpdateTokenString(const chip::ByteSpan & token, char * buf, size_t bufSize)
{
const uint8_t * tokenData = static_cast<const uint8_t *>(token.data());
size_t minLength = chip::min(token.size(), bufSize);
size_t minLength = std::min(token.size(), bufSize);
for (size_t i = 0; i < (minLength / 2) - 1; ++i)
{
snprintf(&buf[i * 2], bufSize, "%02X", tokenData[i]);
Expand Down
4 changes: 3 additions & 1 deletion examples/platform/nrfconnect/util/PWMDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "PWMDevice.h"

#include <algorithm>

#include "AppConfig.h"

#include <lib/support/CodeUtils.h>
Expand Down Expand Up @@ -129,7 +131,7 @@ void PWMDevice::SuppressOutput()
void PWMDevice::ApplyLevel()
{
const uint8_t maxEffectiveLevel = mMaxLevel - mMinLevel;
const uint8_t effectiveLevel = mState == kState_On ? chip::min<uint8_t>(mLevel - mMinLevel, maxEffectiveLevel) : 0;
const uint8_t effectiveLevel = mState == kState_On ? std::min<uint8_t>(mLevel - mMinLevel, maxEffectiveLevel) : 0;

pwm_set_pulse_dt(mPwmDevice,
static_cast<uint32_t>(static_cast<const uint64_t>(mPwmDevice->period) * effectiveLevel / maxEffectiveLevel));
Expand Down
8 changes: 2 additions & 6 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ bool ps_requirement_added = false;
// TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else.
#define WIFI_SCAN_TIMEOUT_TICK 10000

#if !defined(MIN)
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif

WfxRsi_t wfx_rsi;

bool hasNotifiedIPV6 = false;
Expand Down Expand Up @@ -541,12 +537,12 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result)
memset(&cur_scan_result, 0, sizeof(cur_scan_result));

cur_scan_result.ssid_length = strnlen((char *) scan_result->scan_info[idx].ssid,
chip::min<size_t>(sizeof(scan_result->scan_info[idx].ssid), WFX_MAX_SSID_LENGTH));
std::min<size_t>(sizeof(scan_result->scan_info[idx].ssid), WFX_MAX_SSID_LENGTH));
chip::Platform::CopyString(cur_scan_result.ssid, cur_scan_result.ssid_length, (char *) scan_result->scan_info[idx].ssid);

// if user has provided ssid, then check if the current scan result ssid matches the user provided ssid
if (wfx_rsi.scan_ssid != NULL &&
(strncmp(wfx_rsi.scan_ssid, cur_scan_result.ssid, MIN(strlen(wfx_rsi.scan_ssid), strlen(cur_scan_result.ssid))) ==
(strncmp(wfx_rsi.scan_ssid, cur_scan_result.ssid, std::min(strlen(wfx_rsi.scan_ssid), strlen(cur_scan_result.ssid))) ==
CMP_SUCCESS))
{
continue;
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/rs911x/rsi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ void ProcessEvent(WfxEvent_t inEvent)
// clear structure and calculate size of SSID
memset(&ap, 0, sizeof(ap));
ap.ssid_length =
strnlen(reinterpret_cast<char *>(scan->ssid), chip::min<size_t>(sizeof(scan->ssid), WFX_MAX_SSID_LENGTH));
strnlen(reinterpret_cast<char *>(scan->ssid), std::min<size_t>(sizeof(scan->ssid), WFX_MAX_SSID_LENGTH));
chip::Platform::CopyString(ap.ssid, ap.ssid_length, reinterpret_cast<char *>(scan->ssid));

// check if the scanned ssid is the one we are looking for
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/wf200/host_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ int32_t wfx_get_ap_info(wfx_wifi_scan_result_t * ap)
{
int32_t signal_strength;

ap->ssid_length = strnlen(ap_info.ssid, chip::min<size_t>(sizeof(ap_info.ssid), WFX_MAX_SSID_LENGTH));
ap->ssid_length = strnlen(ap_info.ssid, std::min<size_t>(sizeof(ap_info.ssid), WFX_MAX_SSID_LENGTH));
chip::Platform::CopyString(ap->ssid, ap->ssid_length, ap_info.ssid);
memcpy(ap->bssid, ap_info.bssid, sizeof(ap_info.bssid));
ap->security = ap_info.security;
Expand Down
6 changes: 1 addition & 5 deletions examples/platform/silabs/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ extern "C" {
#include "sl_power_manager.h"
#endif

#if !defined(MIN)
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#endif

#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT
#define HELPER1(x) EUSART##x##_RX_IRQn
#else
Expand Down Expand Up @@ -278,7 +274,7 @@ static uint16_t RetrieveFromFifo(Fifo_t * fifo, uint8_t * pData, uint16_t SizeTo
VerifyOrDie(pData != nullptr);
VerifyOrDie(SizeToRead <= fifo->MaxSize);

uint16_t ReadSize = MIN(SizeToRead, AvailableDataCount(fifo));
uint16_t ReadSize = std::min(SizeToRead, AvailableDataCount(fifo));
uint16_t nBytesBeforWrap = (fifo->MaxSize - fifo->Head);

if (ReadSize > nBytesBeforWrap)
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/wifi/wfx_rsi_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *))
wfx_rsi.scan_cb = callback;

VerifyOrReturnError(ssid != nullptr, false);
wfx_rsi.scan_ssid_length = strnlen(ssid, chip::min<size_t>(sizeof(ssid), WFX_MAX_SSID_LENGTH));
wfx_rsi.scan_ssid_length = strnlen(ssid, std::min<size_t>(sizeof(ssid), WFX_MAX_SSID_LENGTH));
wfx_rsi.scan_ssid = reinterpret_cast<char *>(chip::Platform::MemoryAlloc(wfx_rsi.scan_ssid_length));
VerifyOrReturnError(wfx_rsi.scan_ssid != nullptr, false);
chip::Platform::CopyString(wfx_rsi.scan_ssid, wfx_rsi.scan_ssid_length, ssid);
Expand Down
2 changes: 1 addition & 1 deletion src/app/DefaultAttributePersistenceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CHIP_ERROR DefaultAttributePersistenceProvider::InternalReadValue(const StorageK
{
VerifyOrReturnError(mStorage != nullptr, CHIP_ERROR_INCORRECT_STATE);

uint16_t size = static_cast<uint16_t>(min(aValue.size(), static_cast<size_t>(UINT16_MAX)));
uint16_t size = static_cast<uint16_t>(std::min(aValue.size(), static_cast<size_t>(UINT16_MAX)));
ReturnErrorOnFailure(mStorage->SyncGetKeyValue(aKey.KeyName(), aValue.data(), size));
aValue.reduce_size(size);
return CHIP_NO_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion src/app/DeferredAttributePersistenceProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void DeferredAttributePersistenceProvider::FlushAndScheduleNext()
}
else
{
nextFlushTime = chip::min(nextFlushTime, da.GetFlushTime());
nextFlushTime = std::min(nextFlushTime, da.GetFlushTime());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/InteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ uint16_t InteractionModelEngine::GetMinGuaranteedSubscriptionsPerFabric() const
return UINT16_MAX;
#else
return static_cast<uint16_t>(
min(GetReadHandlerPoolCapacityForSubscriptions() / GetConfigMaxFabrics(), static_cast<size_t>(UINT16_MAX)));
std::min(GetReadHandlerPoolCapacityForSubscriptions() / GetConfigMaxFabrics(), static_cast<size_t>(UINT16_MAX)));
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/MessageDef/StatusIB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ bool FormatStatusIBError(char * buf, uint16_t bufSize, CHIP_ERROR err)
// formatted string, as long as we account for the possible string formats.
constexpr size_t statusNameMaxLength =
#define CHIP_IM_STATUS_CODE(name, spec_name, value) \
max(sizeof(#spec_name),
std::max(sizeof(#spec_name),
#include <protocols/interaction_model/StatusCodeList.h>
#undef CHIP_IM_STATUS_CODE
static_cast<size_t>(0)
Expand All @@ -177,7 +177,7 @@ bool FormatStatusIBError(char * buf, uint16_t bufSize, CHIP_ERROR err)
#include <protocols/interaction_model/StatusCodeList.h>
#undef CHIP_IM_STATUS_CODE
;
constexpr size_t formattedSize = max(sizeof(generalFormat) + statusNameMaxLength, sizeof(clusterFormat));
constexpr size_t formattedSize = std::max(sizeof(generalFormat) + statusNameMaxLength, sizeof(clusterFormat));
char formattedString[formattedSize];

StatusIB status(err);
Expand Down
2 changes: 1 addition & 1 deletion src/app/OperationalSessionSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ CHIP_ERROR OperationalSessionSetup::ScheduleSessionSetupReattempt(System::Clock:
"Our backoff calculation will overflow.");
System::Clock::Timeout actualTimerDelay = System::Clock::Seconds16(
static_cast<uint16_t>(CHIP_DEVICE_CONFIG_AUTOMATIC_CASE_RETRY_INITIAL_DELAY_SECONDS
<< min((mAttemptsDone - 1), CHIP_DEVICE_CONFIG_AUTOMATIC_CASE_RETRY_MAX_BACKOFF)));
<< std::min((mAttemptsDone - 1), CHIP_DEVICE_CONFIG_AUTOMATIC_CASE_RETRY_MAX_BACKOFF)));
const bool responseWasBusy = mRequestedBusyDelay != System::Clock::kZero;
if (responseWasBusy)
{
Expand Down
24 changes: 12 additions & 12 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ void ColorControlServer::SetHSVRemainingTime(chip::EndpointId endpoint)
{
bool hsvTransitionStart = (hueTransitionState->stepsRemaining == hueTransitionState->stepsTotal) ||
(saturationTransitionState->stepsRemaining == saturationTransitionState->stepsTotal);
SetQuietReportRemainingTime(endpoint, max(hueTransitionState->timeRemaining, saturationTransitionState->timeRemaining),
SetQuietReportRemainingTime(endpoint, std::max(hueTransitionState->timeRemaining, saturationTransitionState->timeRemaining),
hsvTransitionStart);
}
}
Expand Down Expand Up @@ -1283,7 +1283,7 @@ Status ColorControlServer::moveToSaturation(uint8_t saturation, uint16_t transit
// now, kick off the state machine.
initSaturationTransitionState(endpoint, colorSaturationTransitionState);
colorSaturationTransitionState->finalValue = saturation;
colorSaturationTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorSaturationTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorSaturationTransitionState->stepsTotal = colorSaturationTransitionState->stepsRemaining;
colorSaturationTransitionState->timeRemaining = transitionTime;
colorSaturationTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -1363,7 +1363,7 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati
}

colorHueTransitionState->up = moveUp;
colorHueTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorHueTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorHueTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining;
colorHueTransitionState->timeRemaining = transitionTime;
colorHueTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -1614,7 +1614,7 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons
colorHueTransitionState->finalHue = static_cast<uint8_t>(hue);
}

colorHueTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorHueTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorHueTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining;
colorHueTransitionState->timeRemaining = transitionTime;
colorHueTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -1758,7 +1758,7 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const
}
}

colorHueTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorHueTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorHueTransitionState->stepsTotal = colorHueTransitionState->stepsRemaining;
colorHueTransitionState->timeRemaining = transitionTime;
colorHueTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -1934,7 +1934,7 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj,
{
colorSaturationTransitionState->finalValue = subtractSaturation(currentSaturation, stepSize);
}
colorSaturationTransitionState->stepsRemaining = max<uint8_t>(transitionTime, 1);
colorSaturationTransitionState->stepsRemaining = std::max<uint8_t>(transitionTime, 1);
colorSaturationTransitionState->stepsTotal = colorSaturationTransitionState->stepsRemaining;
colorSaturationTransitionState->timeRemaining = transitionTime;
colorSaturationTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -2276,7 +2276,7 @@ Status ColorControlServer::moveToColor(uint16_t colorX, uint16_t colorY, uint16_
Attributes::CurrentX::Get(endpoint, &(colorXTransitionState->initialValue));
Attributes::CurrentX::Get(endpoint, &(colorXTransitionState->currentValue));
colorXTransitionState->finalValue = colorX;
colorXTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorXTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorXTransitionState->stepsTotal = colorXTransitionState->stepsRemaining;
colorXTransitionState->timeRemaining = transitionTime;
colorXTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -2402,7 +2402,7 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
colorYTransitionState->lowLimit = MIN_CIE_XY_VALUE;
colorYTransitionState->highLimit = MAX_CIE_XY_VALUE;

SetQuietReportRemainingTime(endpoint, max(transitionTimeX, transitionTimeY), true /* isNewTransition */);
SetQuietReportRemainingTime(endpoint, std::max(transitionTimeX, transitionTimeY), true /* isNewTransition */);

// kick off the state machine:
scheduleTimerCallbackMs(configureXYEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count());
Expand Down Expand Up @@ -2463,7 +2463,7 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons
colorXTransitionState->initialValue = currentColorX;
colorXTransitionState->currentValue = currentColorX;
colorXTransitionState->finalValue = colorX;
colorXTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorXTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorXTransitionState->stepsTotal = colorXTransitionState->stepsRemaining;
colorXTransitionState->timeRemaining = transitionTime;
colorXTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -2507,7 +2507,7 @@ void ColorControlServer::updateXYCommand(EndpointId endpoint)
bool isXTransitionDone = computeNewColor16uValue(colorXTransitionState);
bool isYTransitionDone = computeNewColor16uValue(colorYTransitionState);

SetQuietReportRemainingTime(endpoint, max(colorXTransitionState->timeRemaining, colorYTransitionState->timeRemaining));
SetQuietReportRemainingTime(endpoint, std::max(colorXTransitionState->timeRemaining, colorYTransitionState->timeRemaining));

if (isXTransitionDone && isYTransitionDone)
{
Expand Down Expand Up @@ -2607,7 +2607,7 @@ Status ColorControlServer::moveToColorTemp(EndpointId aEndpoint, uint16_t colorT
Attributes::ColorTemperatureMireds::Get(endpoint, &(colorTempTransitionState->currentValue));

colorTempTransitionState->finalValue = colorTemperature;
colorTempTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorTempTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorTempTransitionState->stepsTotal = colorTempTransitionState->stepsRemaining;
colorTempTransitionState->timeRemaining = transitionTime;
colorTempTransitionState->transitionTime = transitionTime;
Expand Down Expand Up @@ -2990,7 +2990,7 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj,
colorTempTransitionState->finalValue = static_cast<uint16_t>(finalValue32u);
}
}
colorTempTransitionState->stepsRemaining = max<uint16_t>(transitionTime, 1);
colorTempTransitionState->stepsRemaining = std::max<uint16_t>(transitionTime, 1);
colorTempTransitionState->stepsTotal = colorTempTransitionState->stepsRemaining;
colorTempTransitionState->timeRemaining = transitionTime;
colorTempTransitionState->transitionTime = transitionTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class ThreadScanResponseToTLV : public chip::app::DataModel::EncodableToTLV
CHIP_ERROR ThreadScanResponseToTLV::LoadResponses(Platform::ScopedMemoryBuffer<ThreadScanResponse> & scanResponseArray,
Span<ThreadScanResponse> & validResponses) const
{
VerifyOrReturnError(scanResponseArray.Alloc(chip::min(mNetworks->Count(), kMaxNetworksInScanResponse)), CHIP_ERROR_NO_MEMORY);
VerifyOrReturnError(scanResponseArray.Alloc(std::min(mNetworks->Count(), kMaxNetworksInScanResponse)), CHIP_ERROR_NO_MEMORY);

ThreadScanResponse scanResponse;
size_t scanResponseArrayLength = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,17 @@ CHIP_ERROR DefaultOTARequestorDriver::UpdateNotFound(UpdateNotFoundReason reason
case UpdateNotFoundReason::kUpToDate:
break;
case UpdateNotFoundReason::kBusy: {
status = ScheduleQueryRetry(true, chip::max(kDefaultDelayedActionTime, delay));
status = ScheduleQueryRetry(true, std::max(kDefaultDelayedActionTime, delay));
if (status == CHIP_ERROR_MAX_RETRY_EXCEEDED)
{
// If max retry exceeded with current provider, try a different provider
status = ScheduleQueryRetry(false, chip::max(kDefaultDelayedActionTime, delay));
status = ScheduleQueryRetry(false, std::max(kDefaultDelayedActionTime, delay));
}
break;
}
case UpdateNotFoundReason::kNotAvailable: {
// Schedule a query only if a different provider is available
status = ScheduleQueryRetry(false, chip::max(kDefaultDelayedActionTime, delay));
status = ScheduleQueryRetry(false, std::max(kDefaultDelayedActionTime, delay));
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/scenes-server/SceneTableImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ struct FabricSceneData : public PersistentData<kPersistentFabricBufferMax>
ReturnErrorOnFailure(reader.EnterContainer(fabricSceneContainer));
ReturnErrorOnFailure(reader.Next(TLV::ContextTag(TagScene::kSceneCount)));
ReturnErrorOnFailure(reader.Get(scene_count));
scene_count = min(scene_count, static_cast<uint8_t>(max_scenes_per_fabric));
scene_count = std::min(scene_count, static_cast<uint8_t>(max_scenes_per_fabric));
ReturnErrorOnFailure(reader.Next(TLV::kTLVType_Array, TLV::ContextTag(TagScene::kStorageIDArray)));
TLV::TLVType sceneMapContainer;
ReturnErrorOnFailure(reader.EnterContainer(sceneMapContainer));
Expand Down Expand Up @@ -577,7 +577,7 @@ CHIP_ERROR DefaultSceneTableImpl::GetRemainingCapacity(FabricIndex fabric_index,
remaining_capacity_fabric = static_cast<uint8_t>(mMaxScenesPerFabric - fabric.scene_count);
}

capacity = min(remaining_capacity_fabric, remaining_capacity_global);
capacity = std::min(remaining_capacity_fabric, remaining_capacity_global);

return CHIP_NO_ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ CHIP_ERROR WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, a
}
else
{
lastRssi.SetNonNull(min(static_cast<int8_t>(0), neighInfo.mLastRssi));
lastRssi.SetNonNull(std::min(static_cast<int8_t>(0), neighInfo.mLastRssi));
}

neighborTable.averageRssi = averageRssi;
Expand Down
Loading

0 comments on commit 8a08d57

Please sign in to comment.