Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and tennessee-google committed Dec 7, 2023
1 parent 6e5fb5e commit 45b52be
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/lib/core/TLVUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CHIP_ERROR TLVUpdater::Init(TLVReader & aReader, uint32_t freeLen)
mUpdaterWriter.SetContainerOpen(false);
mUpdaterWriter.SetCloseContainerReserved(false);

mUpdaterWriter.ImplicitProfileId = aReader.ImplicitProfileId;
mUpdaterWriter.ImplicitProfileId = aReader.ImplicitProfileId;
mUpdaterWriter.mInitializationCookie = TLVWriter::kExpectedInitializationCookie;

// Cache element start address for internal use
Expand Down
28 changes: 16 additions & 12 deletions src/lib/core/TLVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
#if 0
#define ABORT_ON_UNINITIALIZED_IF_ENABLED() VerifyOrDie(IsInitialized() == true)
#else
#define ABORT_ON_UNINITIALIZED_IF_ENABLED() do {} while (0)
#define ABORT_ON_UNINITIALIZED_IF_ENABLED() \
do \
{ \
} while (0)
#endif
namespace chip {
namespace TLV {
Expand All @@ -61,18 +64,18 @@ NO_INLINE void TLVWriter::Init(uint8_t * buf, size_t maxLen)

// TODO(#30825): Need to ensure a single init path for this complex data.
mInitializationCookie = 0;
mBackingStore = nullptr;
mBufStart = buf;
mWritePoint = buf;
mRemainingLen = actualMaxLen;
mLenWritten = 0;
mMaxLen = actualMaxLen;
mContainerType = kTLVType_NotSpecified;
mReservedSize = 0;
mBackingStore = nullptr;
mBufStart = buf;
mWritePoint = buf;
mRemainingLen = actualMaxLen;
mLenWritten = 0;
mMaxLen = actualMaxLen;
mContainerType = kTLVType_NotSpecified;
mReservedSize = 0;
SetContainerOpen(false);
SetCloseContainerReserved(true);

ImplicitProfileId = kProfileIdNotSpecified;
ImplicitProfileId = kProfileIdNotSpecified;
mInitializationCookie = kExpectedInitializationCookie;
}

Expand Down Expand Up @@ -106,7 +109,8 @@ CHIP_ERROR TLVWriter::Finalize()
if (mBackingStore != nullptr)
err = mBackingStore->FinalizeBuffer(*this, mBufStart, static_cast<uint32_t>(mWritePoint - mBufStart));

// TODO(#30825) The following should be safe, but in some cases (without mBackingStore), there are incremental writes that start failing.
// TODO(#30825) The following should be safe, but in some cases (without mBackingStore), there are incremental writes that
// start failing.
#if 0
if (err == CHIP_NO_ERROR)
mInitializationCookie = 0;
Expand Down Expand Up @@ -514,7 +518,7 @@ CHIP_ERROR TLVWriter::OpenContainer(Tag tag, TLVType containerType, TLVWriter &
containerWriter.mContainerType = containerType;
containerWriter.SetContainerOpen(false);
containerWriter.SetCloseContainerReserved(IsCloseContainerReserved());
containerWriter.ImplicitProfileId = ImplicitProfileId;
containerWriter.ImplicitProfileId = ImplicitProfileId;
containerWriter.mInitializationCookie = kExpectedInitializationCookie;

SetContainerOpen(true);
Expand Down
18 changes: 9 additions & 9 deletions src/lib/core/TLVWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -1210,17 +1210,17 @@ class DLL_EXPORT TLVWriter

protected:
TLVBackingStore * mBackingStore = nullptr;
uint8_t * mBufStart = nullptr;
uint8_t * mWritePoint = nullptr;
uint32_t mRemainingLen = 0;
uint32_t mLenWritten = 0;
uint32_t mMaxLen = 0;
uint32_t mReservedSize = 0;
TLVType mContainerType = kTLVType_NotSpecified;
uint16_t mInitializationCookie = 0;
uint8_t * mBufStart = nullptr;
uint8_t * mWritePoint = nullptr;
uint32_t mRemainingLen = 0;
uint32_t mLenWritten = 0;
uint32_t mMaxLen = 0;
uint32_t mReservedSize = 0;
TLVType mContainerType = kTLVType_NotSpecified;
uint16_t mInitializationCookie = 0;

private:
bool mContainerOpen = false;
bool mContainerOpen = false;
bool mCloseContainerReserved = true;

protected:
Expand Down

0 comments on commit 45b52be

Please sign in to comment.