encoding: Improving structure and documentation of block helpers
This commit add several new helpers to simplify operations with
std::string:
- prependStringBlock
- makeStringBlock
- readString
The following functions are deprecated and their replacements:
- nonNegativeIntegerBlock (use makeNonNegativeIntegerBlock)
- prependBooleanBlock (use prependEmptyBlock)
- booleanBlock (use makeEmptyBlock)
- dataBlock (use makeBinaryBlock)
- nestedBlock (use makeNestedBlock)
Change-Id: Ic595ae64fc9c80c2c04e5fde1d8812e8b9debd60
Refs: #2951
diff --git a/tests/unit-tests/data.t.cpp b/tests/unit-tests/data.t.cpp
index 262f2ac..ab9cee6 100644
--- a/tests/unit-tests/data.t.cpp
+++ b/tests/unit-tests/data.t.cpp
@@ -194,7 +194,7 @@
b = SignatureSha256WithRsa();
static const uint8_t someData[256] = {};
- Block signatureValue = dataBlock(tlv::SignatureValue, someData, sizeof(someData));
+ Block signatureValue = makeBinaryBlock(tlv::SignatureValue, someData, sizeof(someData));
b.setValue(signatureValue);
BOOST_CHECK_EQUAL(a == b, false);
BOOST_CHECK_EQUAL(a != b, true);
@@ -382,8 +382,7 @@
Block signatureInfo(tlv::SignatureInfo);
// SignatureType
{
- signatureInfo.push_back
- (nonNegativeIntegerBlock(tlv::SignatureType, Signature::Sha256WithRsa));
+ signatureInfo.push_back(makeNonNegativeIntegerBlock(tlv::SignatureType, Signature::Sha256WithRsa));
}
// KeyLocator
{