diff --git a/src/lib/core/TLVUtilities.cpp b/src/lib/core/TLVUtilities.cpp index f0ecf46655202e..a0fcae8d78111b 100644 --- a/src/lib/core/TLVUtilities.cpp +++ b/src/lib/core/TLVUtilities.cpp @@ -110,35 +110,6 @@ static CHIP_ERROR Iterate(TLVReader & aReader, size_t aDepth, IterateHandler aHa return retval; } -/** - * (Mutably) Iterate through the TLV data referenced by @a aReader and invoke mutable @a aHandler - * for each visited TLV element in the context of @a aContext. - * The iteration is aborted if @a aHandler returns anything other than #CHIP_NO_ERROR - * - * @param[in] aReader A reference to the TLV reader containing the TLV - * data to iterate. - * @param[in] aHandler A mutable callback to invoke for the current TLV element - * being visited. - * @param[in,out] aContext An optional pointer to caller-provided context data. - * - * @retval #CHIP_END_OF_TLV On a successful iteration to the end of a TLV encoding, - * or to the end of a TLV container. - * - * @retval #CHIP_ERROR_INVALID_ARGUMENT If @a aHandler is NULL. - * - * @retval The last value returned by @a aHandler, if different than #CHIP_NO_ERROR - * - */ -CHIP_ERROR Iterate(TLVReader & aReader, IterateHandlerMutable aHandler, void * aContext) -{ - const bool recurse = true; - CHIP_ERROR retval; - - retval = Iterate(aReader, (IterateHandler) aHandler, aContext, recurse); - - return retval; -} - /** * Iterate through the TLV data referenced by @a aReader and invoke @a aHandler * for each visited TLV element in the context of @a aContext. diff --git a/src/lib/core/TLVUtilities.h b/src/lib/core/TLVUtilities.h index d0a82c96825a2b..9c4c406542d093 100644 --- a/src/lib/core/TLVUtilities.h +++ b/src/lib/core/TLVUtilities.h @@ -39,9 +39,6 @@ namespace TLV { namespace Utilities { typedef CHIP_ERROR (*IterateHandler)(const TLVReader & aReader, size_t aDepth, void * aContext); -typedef CHIP_ERROR (*IterateHandlerMutable)(TLVReader & aReader, size_t aDepth, void * aContext); - -extern CHIP_ERROR Iterate(TLVReader & aReader, IterateHandlerMutable aHandler, void * aContext); extern CHIP_ERROR Iterate(const TLVReader & aReader, IterateHandler aHandler, void * aContext); extern CHIP_ERROR Iterate(const TLVReader & aReader, IterateHandler aHandler, void * aContext, bool aRecurse); @@ -54,7 +51,6 @@ extern CHIP_ERROR Find(const TLVReader & aReader, const Tag & aTag, TLVReader & extern CHIP_ERROR Find(const TLVReader & aReader, IterateHandler aHandler, void * aContext, TLVReader & aResult); extern CHIP_ERROR Find(const TLVReader & aReader, IterateHandler aHandler, void * aContext, TLVReader & aResult, bool aRecurse); - } // namespace Utilities } // namespace TLV diff --git a/src/lib/core/tests/FuzzTlvReader.cpp b/src/lib/core/tests/FuzzTlvReader.cpp index 67a3e558f0734d..2e036d2485c742 100644 --- a/src/lib/core/tests/FuzzTlvReader.cpp +++ b/src/lib/core/tests/FuzzTlvReader.cpp @@ -9,81 +9,11 @@ using namespace chip::TLV; using chip::TLV::TLVReader; -static CHIP_ERROR FuzzIterator(TLVReader & aReader, size_t aDepth, void * aContext) +static CHIP_ERROR FuzzIterator(const TLVReader & aReader, size_t aDepth, void * aContext) { - { - aReader.GetLength(); - } - { - aReader.GetTag(); - } - { - aReader.GetType(); - } - { - size_t size; - aReader.CountRemainingInContainer(&size); - } - { - bool v; - aReader.Get(v); - } - { - int8_t v; - aReader.Get(v); - } - { - int16_t v; - aReader.Get(v); - } - { - int32_t v; - aReader.Get(v); - } - { - int64_t v; - aReader.Get(v); - } - { - uint8_t v; - aReader.Get(v); - } - { - uint16_t v; - aReader.Get(v); - } - { - uint32_t v; - aReader.Get(v); - } - { - uint64_t v; - aReader.Get(v); - } - { - double v; - aReader.Get(v); - } - { - float v; - aReader.Get(v); - } - { - chip::ByteSpan readerSpan; - aReader.Get(readerSpan); - } - { - chip::CharSpan readerSpan; - aReader.Get(readerSpan); - } - { - uint8_t bBuf[16]; - aReader.GetBytes(bBuf, sizeof(bBuf)); - } - { - char sBuf[16]; - aReader.GetString(sBuf, sizeof(sBuf)); - } + aReader.GetLength(); + aReader.GetTag(); + aReader.GetType(); return CHIP_NO_ERROR; }