Skip to content

Commit

Permalink
Change the names of more cluster-objects function arguments. (#28130)
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 Feb 21, 2024
1 parent 3bc4477 commit 7538899
Show file tree
Hide file tree
Showing 3 changed files with 630 additions and 630 deletions.
40 changes: 20 additions & 20 deletions src/app/zap-templates/partials/cluster-objects-struct.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ namespace {{asUpperCamelCase name}} {
fabricIndex = fabricIndex_;
}

CHIP_ERROR EncodeForWrite(TLV::TLVWriter &writer, TLV::Tag tag) const;
CHIP_ERROR EncodeForRead(TLV::TLVWriter &writer, TLV::Tag tag, FabricIndex accessingFabricIndex) const;
CHIP_ERROR EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
CHIP_ERROR EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const;

private:
CHIP_ERROR DoEncode(TLV::TLVWriter &writer, TLV::Tag tag, const Optional<FabricIndex> &accessingFabricIndex) const;
CHIP_ERROR DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const;
{{else}}
CHIP_ERROR Encode(TLV::TLVWriter &writer, TLV::Tag tag) const;
CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const;
{{/if}}
};

Expand Down Expand Up @@ -66,48 +66,48 @@ namespace {{asUpperCamelCase name}} {
{{else}}
namespace {{asUpperCamelCase name}} {
{{#if isFabricScoped}}
CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter &writer, TLV::Tag tag) const
CHIP_ERROR Type::EncodeForWrite(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
return DoEncode(writer, tag, NullOptional);
return DoEncode(aWriter, aTag, NullOptional);
}

CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter &writer, TLV::Tag tag, FabricIndex accessingFabricIndex) const
CHIP_ERROR Type::EncodeForRead(TLV::TLVWriter & aWriter, TLV::Tag aTag, FabricIndex aAccessingFabricIndex) const
{
return DoEncode(writer, tag, MakeOptional(accessingFabricIndex));
return DoEncode(aWriter, aTag, MakeOptional(aAccessingFabricIndex));
}

CHIP_ERROR Type::DoEncode(TLV::TLVWriter &writer, TLV::Tag tag, const Optional<FabricIndex> & accessingFabricIndex) const
CHIP_ERROR Type::DoEncode(TLV::TLVWriter & aWriter, TLV::Tag aTag, const Optional<FabricIndex> & aAccessingFabricIndex) const
{
{{#if struct_has_fabric_sensitive_fields}}
bool includeSensitive = !accessingFabricIndex.HasValue() || (accessingFabricIndex.Value() == fabricIndex);
bool includeSensitive = !aAccessingFabricIndex.HasValue() || (aAccessingFabricIndex.Value() == fabricIndex);
{{/if}}
TLV::TLVType outer;
ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer));
ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer));
{{#zcl_struct_items}}
{{#if (is_num_equal fieldIdentifier 254)}}
if (accessingFabricIndex.HasValue()) {
ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
if (aAccessingFabricIndex.HasValue()) {
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
}
{{else if isFabricSensitive}}
if (includeSensitive) {
ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
}
{{else}}
ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::k{{asUpperCamelCase label}}), {{asLowerCamelCase label}}));
{{/if}}
{{/zcl_struct_items}}
ReturnErrorOnFailure(writer.EndContainer(outer));
ReturnErrorOnFailure(aWriter.EndContainer(outer));
return CHIP_NO_ERROR;
}
{{else}}
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_struct_items}}
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_struct_items}}
ReturnErrorOnFailure(writer.EndContainer(outer));
ReturnErrorOnFailure(aWriter.EndContainer(outer));
return CHIP_NO_ERROR;
}
{{/if}}
Expand Down
Loading

0 comments on commit 7538899

Please sign in to comment.