Skip to content

Commit 15ad510

Browse files
Use PRIu32 instead of %u to print unsigned integer (#35069)
1 parent 9c79da2 commit 15ad510

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

src/app/clusters/service-area-server/service-area-server.cpp

+35-32
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void Instance::HandleSkipAreaCmd(HandlerContext & ctx, const Commands::SkipArea:
373373
// If the Status field is set to InvalidAreaList, the StatusText field SHALL be an empty string.
374374
if (!IsSupportedArea(req.skippedArea))
375375
{
376-
ChipLogError(Zcl, "SkippedArea (%u) is not in the SupportedAreas attribute.", req.skippedArea);
376+
ChipLogError(Zcl, "SkippedArea (%" PRIu32 ") is not in the SupportedAreas attribute.", req.skippedArea);
377377
exitResponse(SkipAreaStatus::kInvalidAreaList, ""_span);
378378
return;
379379
}
@@ -453,7 +453,7 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea)
453453
// If the LandmarkInfo field is null, the LocationInfo field SHALL NOT be null.
454454
if (aArea.areaDesc.locationInfo.IsNull() && aArea.areaDesc.landmarkInfo.IsNull())
455455
{
456-
ChipLogDetail(Zcl, "IsValidAsSupportedArea %u - must have locationInfo and/or LandmarkInfo", aArea.areaID);
456+
ChipLogDetail(Zcl, "IsValidAsSupportedArea %" PRIu32 " - must have locationInfo and/or LandmarkInfo", aArea.areaID);
457457
return false;
458458
}
459459

@@ -464,8 +464,9 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea)
464464
if (aArea.areaDesc.locationInfo.Value().locationName.empty() && aArea.areaDesc.locationInfo.Value().floorNumber.IsNull() &&
465465
aArea.areaDesc.locationInfo.Value().areaType.IsNull() && aArea.areaDesc.landmarkInfo.IsNull())
466466
{
467-
ChipLogDetail(Zcl, "IsValidAsSupportedArea %u - AreaName is empty string, FloorNumber, AreaType, LandmarkInfo are null",
468-
aArea.areaID);
467+
ChipLogDetail(
468+
Zcl, "IsValidAsSupportedArea %" PRIu32 " - AreaName is empty string, FloorNumber, AreaType, LandmarkInfo are null",
469+
aArea.areaID);
469470
return false;
470471
}
471472
}
@@ -475,14 +476,15 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea)
475476
{
476477
if (aArea.mapID.IsNull())
477478
{
478-
ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id should not be null when there are supported maps", aArea.areaID);
479+
ChipLogDetail(Zcl, "IsValidSupportedArea %" PRIu32 " - map Id should not be null when there are supported maps",
480+
aArea.areaID);
479481
return false;
480482
}
481483

482484
// If the SupportedMaps attribute is not null, mapID SHALL be the ID of an entry from the SupportedMaps attribute.
483485
if (!IsSupportedMap(aArea.mapID.Value()))
484486
{
485-
ChipLogError(Zcl, "IsValidSupportedArea %u - map Id %u is not in supported map list", aArea.areaID,
487+
ChipLogError(Zcl, "IsValidSupportedArea %" PRIu32 " - map Id %" PRIu32 " is not in supported map list", aArea.areaID,
486488
aArea.mapID.Value());
487489
return false;
488490
}
@@ -491,8 +493,8 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea)
491493
{
492494
if (!aArea.mapID.IsNull())
493495
{
494-
ChipLogDetail(Zcl, "IsValidSupportedArea %u - map Id %u is not in empty supported map list", aArea.areaID,
495-
aArea.mapID.Value());
496+
ChipLogDetail(Zcl, "IsValidSupportedArea %" PRIu32 " - map Id %" PRIu32 " is not in empty supported map list",
497+
aArea.areaID, aArea.mapID.Value());
496498
return false;
497499
}
498500
}
@@ -578,14 +580,14 @@ bool Instance::AddSupportedArea(AreaStructureWrapper & aNewArea)
578580
// Check there is space for the entry.
579581
if (mDelegate->GetNumberOfSupportedAreas() >= kMaxNumSupportedAreas)
580582
{
581-
ChipLogError(Zcl, "AddSupportedArea %u - too many entries", aNewArea.areaID);
583+
ChipLogError(Zcl, "AddSupportedArea %" PRIu32 " - too many entries", aNewArea.areaID);
582584
return false;
583585
}
584586

585587
// Verify cluster requirements concerning valid fields and field relationships.
586588
if (!IsValidSupportedArea(aNewArea))
587589
{
588-
ChipLogError(Zcl, "AddSupportedArea %u - not a valid location object", aNewArea.areaID);
590+
ChipLogError(Zcl, "AddSupportedArea %" PRIu32 " - not a valid location object", aNewArea.areaID);
589591
return false;
590592
}
591593

@@ -595,7 +597,7 @@ bool Instance::AddSupportedArea(AreaStructureWrapper & aNewArea)
595597
// the AreaInfo field.
596598
if (!IsUniqueSupportedArea(aNewArea, false))
597599
{
598-
ChipLogError(Zcl, "AddSupportedArea %u - not a unique location object", aNewArea.areaID);
600+
ChipLogError(Zcl, "AddSupportedArea %" PRIu32 " - not a unique location object", aNewArea.areaID);
599601
return false;
600602
}
601603

@@ -619,7 +621,7 @@ bool Instance::ModifySupportedArea(AreaStructureWrapper & aNewArea)
619621
AreaStructureWrapper supportedArea;
620622
if (!mDelegate->GetSupportedAreaById(aNewArea.areaID, listIndex, supportedArea))
621623
{
622-
ChipLogError(Zcl, "ModifySupportedArea %u - not a supported areaID", aNewArea.areaID);
624+
ChipLogError(Zcl, "ModifySupportedArea %" PRIu32 " - not a supported areaID", aNewArea.areaID);
623625
return false;
624626
}
625627

@@ -639,15 +641,15 @@ bool Instance::ModifySupportedArea(AreaStructureWrapper & aNewArea)
639641
// verify cluster requirements concerning valid fields and field relationships
640642
if (!IsValidSupportedArea(aNewArea))
641643
{
642-
ChipLogError(Zcl, "ModifySupportedArea %u - not a valid location object", aNewArea.areaID);
644+
ChipLogError(Zcl, "ModifySupportedArea %" PRIu32 " - not a valid location object", aNewArea.areaID);
643645
return false;
644646
}
645647

646648
// Updated location description must not match another existing location description.
647649
// We ignore comparing the area ID as one of the locations will match this one.
648650
if (!IsUniqueSupportedArea(aNewArea, true))
649651
{
650-
ChipLogError(Zcl, "ModifySupportedArea %u - not a unique location object", aNewArea.areaID);
652+
ChipLogError(Zcl, "ModifySupportedArea %" PRIu32 " - not a unique location object", aNewArea.areaID);
651653
return false;
652654
}
653655

@@ -701,14 +703,14 @@ bool Instance::AddSupportedMap(uint32_t aMapId, const CharSpan & aMapName)
701703
// check max# of list entries
702704
if (mDelegate->GetNumberOfSupportedMaps() >= kMaxNumSupportedMaps)
703705
{
704-
ChipLogError(Zcl, "AddSupportedMap %u - maximum number of entries", aMapId);
706+
ChipLogError(Zcl, "AddSupportedMap %" PRIu32 " - maximum number of entries", aMapId);
705707
return false;
706708
}
707709

708710
// Map name SHALL include readable text that describes the map name (cannot be empty string).
709711
if (aMapName.empty())
710712
{
711-
ChipLogError(Zcl, "AddSupportedMap %u - Name must not be empty string", aMapId);
713+
ChipLogError(Zcl, "AddSupportedMap %" PRIu32 " - Name must not be empty string", aMapId);
712714
return false;
713715
}
714716

@@ -721,15 +723,15 @@ bool Instance::AddSupportedMap(uint32_t aMapId, const CharSpan & aMapName)
721723
// the name cannot be the same as an existing map
722724
if (entry.IsNameEqual(aMapName))
723725
{
724-
ChipLogError(Zcl, "AddSupportedMap %u - A map already exists with same name '%.*s'", aMapId,
726+
ChipLogError(Zcl, "AddSupportedMap %" PRIu32 " - A map already exists with same name '%.*s'", aMapId,
725727
static_cast<int>(entry.GetName().size()), entry.GetName().data());
726728
return false;
727729
}
728730

729731
// Each entry in this list SHALL have a unique value for the MapID field.
730732
if (aMapId == entry.mapID)
731733
{
732-
ChipLogError(Zcl, "AddSupportedMap - non-unique Id %u", aMapId);
734+
ChipLogError(Zcl, "AddSupportedMap - non-unique Id %" PRIu32 "", aMapId);
733735
return false;
734736
}
735737
}
@@ -757,14 +759,14 @@ bool Instance::RenameSupportedMap(uint32_t aMapId, const CharSpan & newMapName)
757759
// get existing entry
758760
if (!mDelegate->GetSupportedMapById(aMapId, modifiedIndex, modifiedMap))
759761
{
760-
ChipLogError(Zcl, "RenameSupportedMap Id %u - map does not exist", aMapId);
762+
ChipLogError(Zcl, "RenameSupportedMap Id %" PRIu32 " - map does not exist", aMapId);
761763
return false;
762764
}
763765

764766
// Map name SHALL include readable text that describes the map's name. It cannot be empty string.
765767
if (newMapName.empty())
766768
{
767-
ChipLogError(Zcl, "RenameSupportedMap %u - Name must not be empty string", aMapId);
769+
ChipLogError(Zcl, "RenameSupportedMap %" PRIu32 " - Name must not be empty string", aMapId);
768770
return false;
769771
}
770772

@@ -784,7 +786,7 @@ bool Instance::RenameSupportedMap(uint32_t aMapId, const CharSpan & newMapName)
784786

785787
if (entry.IsNameEqual(newMapName))
786788
{
787-
ChipLogError(Zcl, "RenameSupportedMap %u - map already exists with same name '%.*s'", aMapId,
789+
ChipLogError(Zcl, "RenameSupportedMap %" PRIu32 " - map already exists with same name '%.*s'", aMapId,
788790
static_cast<int>(entry.GetName().size()), entry.GetName().data());
789791
return false;
790792
}
@@ -828,21 +830,21 @@ bool Instance::AddSelectedArea(uint32_t & aSelectedArea)
828830
// check max# of list entries
829831
if (mDelegate->GetNumberOfSelectedAreas() >= kMaxNumSelectedAreas)
830832
{
831-
ChipLogError(Zcl, "AddSelectedArea %u - maximum number of entries", aSelectedArea);
833+
ChipLogError(Zcl, "AddSelectedArea %" PRIu32 " - maximum number of entries", aSelectedArea);
832834
return false;
833835
}
834836

835837
// each item in this list SHALL match the AreaID field of an entry on the SupportedAreas attribute's list
836838
if (!IsSupportedArea(aSelectedArea))
837839
{
838-
ChipLogError(Zcl, "AddSelectedArea %u - not a supported location", aSelectedArea);
840+
ChipLogError(Zcl, "AddSelectedArea %" PRIu32 " - not a supported location", aSelectedArea);
839841
return false;
840842
}
841843

842844
// each entry in this list SHALL have a unique value
843845
if (mDelegate->IsSelectedArea(aSelectedArea))
844846
{
845-
ChipLogError(Zcl, "AddSelectedArea %u - duplicated location", aSelectedArea);
847+
ChipLogError(Zcl, "AddSelectedArea %" PRIu32 " - duplicated location", aSelectedArea);
846848
return false;
847849
}
848850

@@ -852,7 +854,7 @@ bool Instance::AddSelectedArea(uint32_t & aSelectedArea)
852854

853855
if (!mDelegate->IsSetSelectedAreasAllowed(locationStatusText))
854856
{
855-
ChipLogError(Zcl, "AddSelectedArea %u - %.*s", aSelectedArea, static_cast<int>(locationStatusText.size()),
857+
ChipLogError(Zcl, "AddSelectedArea %" PRIu32 " - %.*s", aSelectedArea, static_cast<int>(locationStatusText.size()),
856858
locationStatusText.data());
857859
return false;
858860
}
@@ -886,7 +888,7 @@ bool Instance::SetCurrentArea(const DataModel::Nullable<uint32_t> & aCurrentArea
886888
// list.
887889
if ((!aCurrentArea.IsNull()) && (!IsSupportedArea(aCurrentArea.Value())))
888890
{
889-
ChipLogError(Zcl, "SetCurrentArea %u - location is not supported", aCurrentArea.Value());
891+
ChipLogError(Zcl, "SetCurrentArea %" PRIu32 " - location is not supported", aCurrentArea.Value());
890892
return false;
891893
}
892894

@@ -955,14 +957,14 @@ bool Instance::AddPendingProgressElement(uint32_t aAreaId)
955957
// For each entry in this list, the AreaID field SHALL match an entry on the SupportedAreas attribute's list.
956958
if (!IsSupportedArea(aAreaId))
957959
{
958-
ChipLogError(Zcl, "AddPendingProgressElement - not a supported location %u", aAreaId);
960+
ChipLogError(Zcl, "AddPendingProgressElement - not a supported location %" PRIu32 "", aAreaId);
959961
return false;
960962
}
961963

962964
// Each entry in this list SHALL have a unique value for the AreaID field.
963965
if (mDelegate->IsProgressElement(aAreaId))
964966
{
965-
ChipLogError(Zcl, "AddPendingProgressElement - progress element already exists for location %u", aAreaId);
967+
ChipLogError(Zcl, "AddPendingProgressElement - progress element already exists for location %" PRIu32 "", aAreaId);
966968
return false;
967969
}
968970

@@ -984,7 +986,7 @@ bool Instance::SetProgressStatus(uint32_t aAreaId, OperationalStatusEnum opStatu
984986

985987
if (!mDelegate->GetProgressElementById(aAreaId, listIndex, progressElement))
986988
{
987-
ChipLogError(Zcl, "SetProgressStatus - progress element does not exist for location %u", aAreaId);
989+
ChipLogError(Zcl, "SetProgressStatus - progress element does not exist for location %" PRIu32 "", aAreaId);
988990
return false;
989991
}
990992

@@ -1020,7 +1022,7 @@ bool Instance::SetProgressTotalOperationalTime(uint32_t aAreaId, const DataModel
10201022

10211023
if (!mDelegate->GetProgressElementById(aAreaId, listIndex, progressElement))
10221024
{
1023-
ChipLogError(Zcl, "SetProgressTotalOperationalTime - progress element does not exist for location %u", aAreaId);
1025+
ChipLogError(Zcl, "SetProgressTotalOperationalTime - progress element does not exist for location %" PRIu32 "", aAreaId);
10241026
return false;
10251027
}
10261028

@@ -1036,7 +1038,8 @@ bool Instance::SetProgressTotalOperationalTime(uint32_t aAreaId, const DataModel
10361038
!aTotalOperationalTime.IsNull())
10371039
{
10381040
ChipLogError(Zcl,
1039-
"SetProgressTotalOperationalTime - location %u opStatus value %u - can be non-null only if opStatus is "
1041+
"SetProgressTotalOperationalTime - location %" PRIu32
1042+
" opStatus value %u - can be non-null only if opStatus is "
10401043
"Completed or Skipped",
10411044
aAreaId, to_underlying(progressElement.status));
10421045
return false;
@@ -1062,7 +1065,7 @@ bool Instance::SetProgressEstimatedTime(uint32_t aAreaId, const DataModel::Nulla
10621065

10631066
if (!mDelegate->GetProgressElementById(aAreaId, listIndex, progressElement))
10641067
{
1065-
ChipLogError(Zcl, "SetProgressEstimatedTime - progress element does not exist for location %u", aAreaId);
1068+
ChipLogError(Zcl, "SetProgressEstimatedTime - progress element does not exist for location %" PRIu32 "", aAreaId);
10661069
return false;
10671070
}
10681071

0 commit comments

Comments
 (0)