Skip to content

Commit

Permalink
fix Darwin build
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-apple committed Aug 2, 2021
1 parent 7c2e3c3 commit 1db491e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/darwin/Framework/CHIP/CHIPDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ - (BOOL)openPairingWindow:(NSUInteger)duration error:(NSError * __autoreleasing

chip::SetupPayload setupPayload;

if (duration > UINT32_MAX) {
CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT32_MAX);
if (duration > UINT16_MAX) {
CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX);
if (error) {
*error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE];
}
Expand All @@ -67,7 +67,7 @@ - (BOOL)openPairingWindow:(NSUInteger)duration error:(NSError * __autoreleasing

[self.lock lock];
err = self.cppDevice->OpenPairingWindow(
(uint32_t) duration, chip::Controller::Device::PairingWindowOption::kOriginalSetupCode, setupPayload);
(uint16_t) duration, chip::Controller::Device::PairingWindowOption::kOriginalSetupCode, setupPayload);
[self.lock unlock];

if (err != CHIP_NO_ERROR) {
Expand All @@ -90,8 +90,8 @@ - (NSString *)openPairingWindowWithPIN:(NSUInteger)duration

chip::SetupPayload setupPayload;

if (duration > UINT32_MAX) {
CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT32_MAX);
if (duration > UINT16_MAX) {
CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX);
if (error) {
*error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE];
}
Expand All @@ -113,7 +113,7 @@ - (NSString *)openPairingWindowWithPIN:(NSUInteger)duration

[self.lock lock];
err = self.cppDevice->OpenPairingWindow(
(uint32_t) duration, chip::Controller::Device::PairingWindowOption::kTokenWithProvidedPIN, setupPayload);
(uint16_t) duration, chip::Controller::Device::PairingWindowOption::kTokenWithProvidedPIN, setupPayload);
[self.lock unlock];

if (err != CHIP_NO_ERROR) {
Expand Down

0 comments on commit 1db491e

Please sign in to comment.