src: Improving consistency and correcting code style
As of this commit, all data structures can be directly constructed from
wire format.
This commit excludes full correction of code style in security/ and
tools/ndnsec*, which will be part of a different commit.
Change-Id: I121ac1f81948bc7468990df52cdefeb2988d91a1
Refs: #1403
diff --git a/src/interest.hpp b/src/interest.hpp
index 2e2b8af..3cfacf1 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -104,6 +104,9 @@
{
}
+ /**
+ * @brief Create from wire encoding
+ */
explicit
Interest(const Block& wire)
{
@@ -462,7 +465,7 @@
inline size_t
Interest::wireEncode(EncodingImpl<T>& block) const
{
- size_t total_len = 0;
+ size_t totalLength = 0;
// Interest ::= INTEREST-TYPE TLV-LENGTH
// Name
@@ -474,33 +477,35 @@
// (reverse encoding)
// InterestLifetime
- if (getInterestLifetime() >= time::milliseconds::zero()
- && getInterestLifetime() != DEFAULT_INTEREST_LIFETIME)
+ if (getInterestLifetime() >= time::milliseconds::zero() &&
+ getInterestLifetime() != DEFAULT_INTEREST_LIFETIME)
{
- total_len += prependNonNegativeIntegerBlock(block, Tlv::InterestLifetime, getInterestLifetime().count());
+ totalLength += prependNonNegativeIntegerBlock(block,
+ Tlv::InterestLifetime,
+ getInterestLifetime().count());
}
// Scope
if (getScope() >= 0)
{
- total_len += prependNonNegativeIntegerBlock(block, Tlv::Scope, getScope());
+ totalLength += prependNonNegativeIntegerBlock(block, Tlv::Scope, getScope());
}
// Nonce
- total_len += prependNonNegativeIntegerBlock(block, Tlv::Nonce, getNonce());
+ totalLength += prependNonNegativeIntegerBlock(block, Tlv::Nonce, getNonce());
// Selectors
if (!getSelectors().empty())
{
- total_len += getSelectors().wireEncode(block);
+ totalLength += getSelectors().wireEncode(block);
}
// Name
- total_len += getName().wireEncode(block);
+ totalLength += getName().wireEncode(block);
- total_len += block.prependVarNumber (total_len);
- total_len += block.prependVarNumber (Tlv::Interest);
- return total_len;
+ totalLength += block.prependVarNumber (totalLength);
+ totalLength += block.prependVarNumber (Tlv::Interest);
+ return totalLength;
}
inline const Block&