Internal: Use C struct ndn_Blob where possible. Make ndn::Blob work with ndn_Blob.
diff --git a/ndn-cpp/c/encoding/binary-xml-name.c b/ndn-cpp/c/encoding/binary-xml-name.c
index 00f5858..30cd60f 100644
--- a/ndn-cpp/c/encoding/binary-xml-name.c
+++ b/ndn-cpp/c/encoding/binary-xml-name.c
@@ -17,8 +17,7 @@
size_t i;
for (i = 0; i < name->nComponents; ++i) {
- if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Component, name->components[i].value, name->components[i].valueLength)))
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement(encoder, ndn_BinaryXml_DTag_Component, &name->components[i].value)))
return error;
}
@@ -44,15 +43,14 @@
// No more components.
break;
- uint8_t *component;
- size_t componentLen;
- if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component, &componentLen)))
+ struct ndn_Blob component;
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Component, 0, &component)))
return error;
// Add the component to the name.
if (name->nComponents >= name->maxComponents)
return NDN_ERROR_read_a_component_past_the_maximum_number_of_components_allowed_in_the_name;
- ndn_NameComponent_initialize(name->components + name->nComponents, component, componentLen);
+ ndn_NameComponent_initialize(name->components + name->nComponents, component.value, component.length);
++name->nComponents;
}