Skip to content

Commit

Permalink
Change the names of cluster-objects function arguments. (#27945)
Browse files Browse the repository at this point in the history
Using "tag" as a function argument leads to compile failure when a struct with a
field named "Tag" (which becomes a member named "tag") is added to the spec.
Change to aTag (and aWriter) to avoid the name collision.

This does not change either API or ABI for consumers; just the naming of the
argument inside the function.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Dec 12, 2023
1 parent 875579b commit 1150544
Show file tree
Hide file tree
Showing 4 changed files with 2,256 additions and 2,253 deletions.
18 changes: 9 additions & 9 deletions src/app/zap-templates/templates/app/cluster-objects-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ namespace Structs {
namespace Commands {
{{#zcl_commands}}
namespace {{asUpperCamelCase name}} {
CHIP_ERROR Type::Encode(TLV::TLVWriter &writer, TLV::Tag tag) const{
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const{
TLV::TLVType outer;
ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer));
ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer));
{{#zcl_command_arguments}}
ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
{{/zcl_command_arguments}}
ReturnErrorOnFailure(writer.EndContainer(outer));
ReturnErrorOnFailure(aWriter.EndContainer(outer));
return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -94,17 +94,17 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader &reader, const Concret
namespace Events {
{{#zcl_events}}
namespace {{asUpperCamelCase name}} {
CHIP_ERROR Type::Encode(TLV::TLVWriter &writer, TLV::Tag tag) const{
CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const{
TLV::TLVType outer;
ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer));
ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer));
{{#zcl_event_fields}}
{{#if_is_fabric_scoped_struct type}}
ReturnErrorOnFailure(DataModel::EncodeForRead(writer, TLV::ContextTag(Fields::k{{asUpperCamelCase name}}), GetFabricIndex(), {{asLowerCamelCase name}}));
ReturnErrorOnFailure(DataModel::EncodeForRead(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase name}}), GetFabricIndex(), {{asLowerCamelCase name}}));
{{else}}
ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::k{{asUpperCamelCase name}}), {{asLowerCamelCase name}}));
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase name}}), {{asLowerCamelCase name}}));
{{/if_is_fabric_scoped_struct}}
{{/zcl_event_fields}}
ReturnErrorOnFailure(writer.EndContainer(outer));
ReturnErrorOnFailure(aWriter.EndContainer(outer));
return CHIP_NO_ERROR;
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/zap-templates/templates/app/cluster-objects.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public:
{{zapTypeToEncodableClusterObjectType type}} {{asLowerCamelCase label}}{{> cluster_objects_field_init}};
{{/zcl_command_arguments}}

CHIP_ERROR Encode(TLV::TLVWriter &writer, TLV::Tag tag) const;
CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;

using ResponseType =
{{~#if responseName}}
Expand Down Expand Up @@ -189,7 +189,7 @@ public:
}
{{/if}}

CHIP_ERROR Encode(TLV::TLVWriter &writer, TLV::Tag tag) const;
CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
};

struct DecodableType {
Expand Down
Loading

0 comments on commit 1150544

Please sign in to comment.