Skip to content

Commit 57471cb

Browse files
Stop using PRI*16 and %zu format specifiers (project-chip#17502)
* Stop using PRI*16 and %zu format specifiers Some libcs don't support them, use %u/%d/%x instead * Commit generated by running the following git-extras commands: git sed -f g '" PRIu16 "' 'u' git sed -f g '" PRIu16' 'u"' git sed -f g '" PRIx16 "' 'x' git sed -f g '" PRIx16' 'x"' git sed -f g '" PRIX16 "' 'X' git sed -f g '" PRIX16' 'X"' git sed -f g '" PRId16 "' 'd' git sed -f g '" PRId16' 'd"' git sed -f g '%zu' '%u' * Cast some %zu parameters due to warnings * Add lint rules * Run restyle Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Change c-style casts to c++-casts and restore variable type changes Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Add parentheses around static_cast arguments Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> * Run restyle locally Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com>
1 parent df02224 commit 57471cb

File tree

116 files changed

+2840
-2809
lines changed

Some content is hidden

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

116 files changed

+2840
-2809
lines changed

.github/workflows/lint.yml

+16
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ jobs:
5858
if: always()
5959
run: |
6060
git grep -n "PRI.8" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0
61+
62+
# git grep exits with 0 if it finds a match, but we want
63+
# to fail (exit nonzero) on match. And we wasnt to exclude this file,
64+
# to avoid our grep regexp matching itself.
65+
- name: Check for use of PRI*16, which are not supported on some libcs.
66+
if: always()
67+
run: |
68+
git grep -n "PRI.16" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)third_party/lwip/repo/lwip/src/include/lwip/arch.h' && exit 1 || exit 0
69+
70+
# git grep exits with 0 if it finds a match, but we want
71+
# to fail (exit nonzero) on match. And we wasnt to exclude this file,
72+
# to avoid our grep regexp matching itself.
73+
- name: Check for use of %zu, which are not supported on some libcs.
74+
if: always()
75+
run: |
76+
git grep -n "%zu" -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0
6177
6278
# Comments like '{{! ... }}' should be used in zap files
6379
- name: Do not allow TODO in generated files

examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
164164
break;
165165
}
166166

167-
ESP_LOGI(TAG, "Current free heap: %zu\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
167+
ESP_LOGI(TAG, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
168168
}
169169

170170
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
@@ -197,7 +197,7 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster
197197
break;
198198
}
199199

200-
ESP_LOGI(TAG, "Current free heap: %zu\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
200+
ESP_LOGI(TAG, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
201201
}
202202

203203
void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event)

examples/chef/esp32/main/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg)
129129
break;
130130
}
131131

132-
ChipLogProgress(Shell, "Current free heap: %zu\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
132+
ChipLogProgress(Shell, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
133133
}
134134

135135
const char * TAG = "chef-app";

examples/chip-tool-darwin/templates/commands.zapt

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public:
4141

4242
CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override
4343
{
44-
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %" PRIu16, endpointId);
44+
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %u", endpointId);
4545

4646
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
4747
CHIP{{asUpperCamelCase clusterName}} * cluster = [[CHIP{{asUpperCamelCase clusterName}} alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue];
@@ -113,7 +113,7 @@ public:
113113

114114
CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override
115115
{
116-
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReadAttribute ({{asHex code 8}}) on endpoint %" PRIu16, endpointId);
116+
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReadAttribute ({{asHex code 8}}) on endpoint %u", endpointId);
117117

118118
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
119119
CHIP{{asUpperCamelCase parent.name}} * cluster = [[CHIP{{asUpperCamelCase parent.name}} alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue];
@@ -164,7 +164,7 @@ public:
164164

165165
CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override
166166
{
167-
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) WriteAttribute ({{asHex code 8}}) on endpoint %" PRIu16, endpointId);
167+
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) WriteAttribute ({{asHex code 8}}) on endpoint %u", endpointId);
168168
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
169169
CHIP{{asUpperCamelCase parent.name}} * cluster = [[CHIP{{asUpperCamelCase parent.name}} alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue];
170170
CHIP_ERROR __block chipError = CHIP_NO_ERROR;
@@ -221,7 +221,7 @@ public:
221221

222222
CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override
223223
{
224-
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReportAttribute ({{asHex code 8}}) on endpoint %" PRIu16, endpointId);
224+
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReportAttribute ({{asHex code 8}}) on endpoint %u", endpointId);
225225
dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL);
226226
CHIP{{asUpperCamelCase parent.name}} * cluster = [[CHIP{{asUpperCamelCase parent.name}} alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue];
227227
CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init];

examples/chip-tool/commands/clusters/ModelCommand.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CHIP_ERROR ModelCommand::RunCommand()
3030
{
3131
FabricIndex fabricIndex;
3232
ReturnErrorOnFailure(CurrentCommissioner().GetFabricIndex(&fabricIndex));
33-
ChipLogProgress(chipTool, "Sending command to group 0x%" PRIx16, GroupIdFromNodeId(mNodeId));
33+
ChipLogProgress(chipTool, "Sending command to group 0x%x", GroupIdFromNodeId(mNodeId));
3434

3535
return SendGroupCommand(GroupIdFromNodeId(mNodeId), fabricIndex);
3636
}

examples/chip-tool/commands/clusters/ReportCommand.h

+15-14
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,11 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac
161161
chipTool,
162162
"\n%sAttribute commands targetting multiple paths needs to have: \n \t * One element with multiple ids (for "
163163
"example 1 cluster id, 1 attribute id, 2 endpoint ids)\n\t * Or the same "
164-
"number of ids (for examples 2 cluster ids, 2 attribute ids and 2 endpoint ids).\n The current command has %zu "
165-
"cluster ids, %zu attribute ids, %zu endpoint ids.",
166-
interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read", clusterCount,
167-
attributeCount, endpointCount);
164+
"number of ids (for examples 2 cluster ids, 2 attribute ids and 2 endpoint ids).\n The current command has %u "
165+
"cluster ids, %u attribute ids, %u endpoint ids.",
166+
interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read",
167+
static_cast<unsigned int>(clusterCount), static_cast<unsigned int>(attributeCount),
168+
static_cast<unsigned int>(endpointCount));
168169
return CHIP_ERROR_INVALID_ARGUMENT;
169170
}
170171

@@ -179,7 +180,7 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac
179180
chip::AttributeId attributeId = attributeIds.at((hasSameIdsCount || multipleAttributes) ? i : 0);
180181
chip::EndpointId endpointId = endpointIds.at((hasSameIdsCount || multipleEndpoints) ? i : 0);
181182

182-
ChipLogProgress(chipTool, "\tcluster " ChipLogFormatMEI ", attribute: " ChipLogFormatMEI ", endpoint %" PRIu16,
183+
ChipLogProgress(chipTool, "\tcluster " ChipLogFormatMEI ", attribute: " ChipLogFormatMEI ", endpoint %u",
183184
ChipLogValueMEI(clusterId), ChipLogValueMEI(attributeId), endpointId);
184185
attributePathParams[i].mClusterId = clusterId;
185186
attributePathParams[i].mAttributeId = attributeId;
@@ -262,14 +263,14 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac
262263
}
263264
else
264265
{
265-
ChipLogError(
266-
chipTool,
267-
"\n%sEvent command targetting multiple paths needs to have: \n \t * One element with multiple ids (for "
268-
"example 1 cluster id, 1 event id, 2 endpoint ids)\n\t * Or the same "
269-
"number of ids (for examples 2 cluster ids, 2 event ids and 2 endpoint ids).\n The current command has %zu "
270-
"cluster ids, %zu event ids, %zu endpoint ids.",
271-
interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read", clusterCount,
272-
eventCount, endpointCount);
266+
ChipLogError(chipTool,
267+
"\n%sEvent command targetting multiple paths needs to have: \n \t * One element with multiple ids (for "
268+
"example 1 cluster id, 1 event id, 2 endpoint ids)\n\t * Or the same "
269+
"number of ids (for examples 2 cluster ids, 2 event ids and 2 endpoint ids).\n The current command has %u "
270+
"cluster ids, %u event ids, %u endpoint ids.",
271+
interactionType == chip::app::ReadClient::InteractionType::Subscribe ? "Subscribe" : "Read",
272+
static_cast<unsigned int>(clusterCount), static_cast<unsigned int>(eventCount),
273+
static_cast<unsigned int>(endpointCount));
273274
return CHIP_ERROR_INVALID_ARGUMENT;
274275
}
275276

@@ -283,7 +284,7 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac
283284
chip::EventId eventId = eventIds.at((hasSameIdsCount || multipleEvents) ? i : 0);
284285
chip::EndpointId endpointId = endpointIds.at((hasSameIdsCount || multipleEndpoints) ? i : 0);
285286

286-
ChipLogProgress(chipTool, "\tcluster " ChipLogFormatMEI ", event: " ChipLogFormatMEI ", endpoint %" PRIu16,
287+
ChipLogProgress(chipTool, "\tcluster " ChipLogFormatMEI ", event: " ChipLogFormatMEI ", endpoint %u",
287288
ChipLogValueMEI(clusterId), ChipLogValueMEI(eventId), endpointId);
288289
eventPathParams[i].mClusterId = clusterId;
289290
eventPathParams[i].mEventId = eventId;

examples/chip-tool/commands/clusters/WriteAttributeCommand.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class WriteAttribute : public ModelCommand, public chip::app::WriteClient::Callb
9696
CHIP_ERROR SendCommand(ChipDevice * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
9797
chip::AttributeId attributeId, const T & value)
9898
{
99-
ChipLogProgress(chipTool, "Sending WriteAttribute to cluster " ChipLogFormatMEI " on endpoint %" PRIu16,
99+
ChipLogProgress(chipTool, "Sending WriteAttribute to cluster " ChipLogFormatMEI " on endpoint %u",
100100
ChipLogValueMEI(clusterId), endpointId);
101101
chip::app::AttributePathParams attributePathParams;
102102
if (!device->GetSecureSession().Value()->IsGroupSession())

examples/chip-tool/commands/common/Command.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ bool Command::InitArguments(int argc, char ** argv)
5656
}
5757

5858
VerifyOrExit((size_t)(argc) >= mandatoryArgsCount && (argvExtraArgsCount == 0 || (argvExtraArgsCount && optionalArgsCount)),
59-
ChipLogError(chipTool, "InitArgs: Wrong arguments number: %d instead of %zu", argc, mandatoryArgsCount));
59+
ChipLogError(chipTool, "InitArgs: Wrong arguments number: %d instead of %u", argc,
60+
static_cast<unsigned int>(mandatoryArgsCount)));
6061

6162
// Initialize mandatory arguments
6263
for (size_t i = 0; i < mandatoryArgsCount; i++)

examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ void DiscoverCommissionersCommand::Shutdown()
4040
}
4141
}
4242

43-
ChipLogProgress(chipTool, "Total of %d commissioner(s) discovered in %" PRIu16 " sec", commissionerCount,
43+
ChipLogProgress(chipTool, "Total of %d commissioner(s) discovered in %u sec", commissionerCount,
4444
std::chrono::duration_cast<System::Clock::Seconds16>(GetWaitDuration()).count());
4545
}

examples/chip-tool/templates/commands.zapt

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public:
4141

4242
CHIP_ERROR SendCommand(ChipDevice * device, std::vector<chip::EndpointId> endpointIds) override
4343
{
44-
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %" PRIu16, endpointIds.at(0));
44+
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %u", endpointIds.at(0));
4545

4646
return ClusterCommand::SendCommand(device, endpointIds.at(0), {{asHex parent.code 8}}, {{asHex code 8}}, mRequest);
4747
}
4848

4949
CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override
5050
{
51-
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on Group %" PRIu16, groupId);
51+
ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on Group %u", groupId);
5252

5353
return ClusterCommand::SendGroupCommand(groupId, fabricIndex, {{asHex parent.code 8}}, {{asHex code 8}}, mRequest);
5454
}

examples/chip-tool/templates/logging/DataModelLogger-src.zapt

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const {{
6262

6363
CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributePath & path, chip::TLV::TLVReader * data)
6464
{
65-
ChipLogProgress(chipTool, "Endpoint: %" PRIu16 " Cluster: " ChipLogFormatMEI " Attribute " ChipLogFormatMEI " DataVersion: %" PRIu32, path.mEndpointId,
65+
ChipLogProgress(chipTool, "Endpoint: %u Cluster: " ChipLogFormatMEI " Attribute " ChipLogFormatMEI " DataVersion: %" PRIu32, path.mEndpointId,
6666
ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mAttributeId), path.mDataVersion.ValueOr(0));
6767

6868
switch (path.mClusterId)
@@ -97,7 +97,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP
9797

9898
CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & path, chip::TLV::TLVReader * data)
9999
{
100-
ChipLogProgress(chipTool, "Endpoint: %" PRIu16 " Cluster: " ChipLogFormatMEI " Command " ChipLogFormatMEI, path.mEndpointId,
100+
ChipLogProgress(chipTool, "Endpoint: %u Cluster: " ChipLogFormatMEI " Command " ChipLogFormatMEI, path.mEndpointId,
101101
ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mCommandId));
102102

103103
switch (path.mClusterId)
@@ -132,7 +132,7 @@ CHIP_ERROR DataModelLogger::LogCommand(const chip::app::ConcreteCommandPath & pa
132132

133133
CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip::TLV::TLVReader * data)
134134
{
135-
ChipLogProgress(chipTool, "Endpoint: %" PRIu16 " Cluster: " ChipLogFormatMEI " Event " ChipLogFormatMEI, header.mPath.mEndpointId,
135+
ChipLogProgress(chipTool, "Endpoint: %u Cluster: " ChipLogFormatMEI " Event " ChipLogFormatMEI, header.mPath.mEndpointId,
136136
ChipLogValueMEI(header.mPath.mClusterId), ChipLogValueMEI(header.mPath.mEventId));
137137

138138
ChipLogProgress(chipTool, "\t Event number: %" PRIu64, header.mEventNumber);

examples/light-switch-app/efr32/src/ZclCallbacks.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
4040

4141
if (clusterId == OnOffSwitchConfiguration::Id)
4242
{
43-
ChipLogProgress(
44-
Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %" PRIu16 ", length %" PRIu16,
45-
ChipLogValueMEI(attributeId), type, *value, size);
43+
ChipLogProgress(Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
44+
ChipLogValueMEI(attributeId), type, *value, size);
4645

4746
// WIP Apply attribute change to Light
4847
}
4948
else if (clusterId == Identify::Id)
5049
{
51-
ChipLogProgress(Zcl, "Identify attribute ID: " ChipLogFormatMEI " Type: %u Value: %" PRIu16 ", length %" PRIu16,
50+
ChipLogProgress(Zcl, "Identify attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
5251
ChipLogValueMEI(attributeId), type, *value, size);
5352
}
5453
}

examples/lighting-app/bouffalolab/bl602/src/DeviceCallbacks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster
122122
}
123123

124124
// TODO
125-
// log_info("Current free heap: %zu\r\n\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
125+
// log_info("Current free heap: %u\r\n\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
126126
}
127127

128128
void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event)

examples/lighting-app/efr32/src/ZclCallbacks.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,28 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
4444
}
4545
else if (clusterId == LevelControl::Id)
4646
{
47-
ChipLogProgress(Zcl, "Level Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %" PRIu16 ", length %" PRIu16,
47+
ChipLogProgress(Zcl, "Level Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
4848
ChipLogValueMEI(attributeId), type, *value, size);
4949

5050
// WIP Apply attribute change to Light
5151
}
5252
else if (clusterId == ColorControl::Id)
5353
{
54-
ChipLogProgress(Zcl, "Color Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %" PRIu16 ", length %" PRIu16,
54+
ChipLogProgress(Zcl, "Color Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
5555
ChipLogValueMEI(attributeId), type, *value, size);
5656

5757
// WIP Apply attribute change to Light
5858
}
5959
else if (clusterId == OnOffSwitchConfiguration::Id)
6060
{
61-
ChipLogProgress(
62-
Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %" PRIu16 ", length %" PRIu16,
63-
ChipLogValueMEI(attributeId), type, *value, size);
61+
ChipLogProgress(Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
62+
ChipLogValueMEI(attributeId), type, *value, size);
6463

6564
// WIP Apply attribute change to Light
6665
}
6766
else if (clusterId == Identify::Id)
6867
{
69-
ChipLogProgress(Zcl, "Identify attribute ID: " ChipLogFormatMEI " Type: %u Value: %" PRIu16 ", length %" PRIu16,
68+
ChipLogProgress(Zcl, "Identify attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u",
7069
ChipLogValueMEI(attributeId), type, *value, size);
7170
}
7271
}

examples/lighting-app/esp32/main/DeviceCallbacks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_
116116
break;
117117
}
118118

119-
ESP_LOGI(TAG, "Current free heap: %zu\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
119+
ESP_LOGI(TAG, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
120120
}
121121

122122
void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
@@ -146,7 +146,7 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster
146146
break;
147147
}
148148

149-
ESP_LOGI(TAG, "Current free heap: %zu\n", heap_caps_get_free_size(MALLOC_CAP_8BIT));
149+
ESP_LOGI(TAG, "Current free heap: %u\n", static_cast<unsigned int>(heap_caps_get_free_size(MALLOC_CAP_8BIT)));
150150
}
151151

152152
void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event)

0 commit comments

Comments
 (0)