From 1db491e6676a1956f53c46a2734b7247addbb693 Mon Sep 17 00:00:00 2001
From: Pankaj Garg <pgarg2@apple.com>
Date: Mon, 2 Aug 2021 08:12:33 -0700
Subject: [PATCH] fix Darwin build

---
 src/darwin/Framework/CHIP/CHIPDevice.mm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/darwin/Framework/CHIP/CHIPDevice.mm b/src/darwin/Framework/CHIP/CHIPDevice.mm
index d44a514da81415..0d1d36140e5d72 100644
--- a/src/darwin/Framework/CHIP/CHIPDevice.mm
+++ b/src/darwin/Framework/CHIP/CHIPDevice.mm
@@ -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];
         }
@@ -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) {
@@ -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];
         }
@@ -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) {