Internal: Use C struct ndn_Blob where possible. Make ndn::Blob work with ndn_Blob.
diff --git a/ndn-cpp/c/key.h b/ndn-cpp/c/key.h
index 814c200..a933489 100644
--- a/ndn-cpp/c/key.h
+++ b/ndn-cpp/c/key.h
@@ -31,7 +31,7 @@
*/
struct ndn_KeyLocator {
ndn_KeyLocatorType type; /**< -1 for none */
- uint8_t *keyData; /**< A pointer to a pre-allocated buffer for the key data as follows:
+ struct ndn_Blob keyData; /**< A Blob whose value is a pointer to a pre-allocated buffer for the key data as follows:
* If type is ndn_KeyLocatorType_KEY, the key data.
* If type is ndn_KeyLocatorType_CERTIFICATE, the certificate data.
* If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_PUBLIC_KEY_DIGEST, the publisher public key digest.
@@ -39,7 +39,6 @@
* If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_KEY_DIGEST, the publisher issuer key digest.
* If type is ndn_KeyLocatorType_KEYNAME and keyNameType is ndn_KeyNameType_PUBLISHER_ISSUER_CERTIFICATE_DIGEST, the publisher issuer certificate digest.
*/
- size_t keyDataLength; /**< The length of keyData. */
struct ndn_Name keyName; /**< The key name (only used if type is ndn_KeyLocatorType_KEYNAME.) */
ndn_KeyNameType keyNameType; /**< The type of data for keyName, -1 for none. (only used if type is ndn_KeyLocatorType_KEYNAME.) */
};
@@ -53,8 +52,7 @@
static inline void ndn_KeyLocator_initialize
(struct ndn_KeyLocator *self, struct ndn_NameComponent *keyNameComponents, size_t maxKeyNameComponents) {
self->type = (ndn_KeyLocatorType)-1;
- self->keyData = 0;
- self->keyDataLength = 0;
+ ndn_Blob_initialize(&self->keyData, 0, 0);
ndn_Name_initialize(&self->keyName, keyNameComponents, maxKeyNameComponents);
self->keyNameType = (ndn_KeyNameType)-1;
}