Make ndn_decodeBinaryXMLName take the ndn_BinaryXMLDecoder.
diff --git a/ndn-cpp/c/encoding/BinaryXMLName.c b/ndn-cpp/c/encoding/BinaryXMLName.c
index 4e3f4d7..799e93d 100644
--- a/ndn-cpp/c/encoding/BinaryXMLName.c
+++ b/ndn-cpp/c/encoding/BinaryXMLName.c
@@ -27,18 +27,15 @@
return 0;
}
-char *ndn_decodeBinaryXMLName(struct ndn_Name *name, unsigned char *input, unsigned int inputLength)
+char *ndn_decodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLDecoder *decoder)
{
- struct ndn_BinaryXMLDecoder decoder;
- ndn_BinaryXMLDecoder_init(&decoder, input, inputLength);
-
char *error;
- if (error = ndn_BinaryXMLDecoder_readElementStartDTag(&decoder, ndn_BinaryXML_DTag_Name))
+ if (error = ndn_BinaryXMLDecoder_readElementStartDTag(decoder, ndn_BinaryXML_DTag_Name))
return error;
while (1) {
int gotExpectedTag;
- if (error = ndn_BinaryXMLDecoder_peekDTag(&decoder, ndn_BinaryXML_DTag_Component, &gotExpectedTag))
+ if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_Component, &gotExpectedTag))
return error;
if (!gotExpectedTag)
@@ -47,7 +44,7 @@
unsigned char *component;
unsigned int componentLen;
- if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement(&decoder, ndn_BinaryXML_DTag_Component, 0, &component, &componentLen))
+ if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement(decoder, ndn_BinaryXML_DTag_Component, 0, &component, &componentLen))
return error;
// Add the component to the name.
@@ -57,7 +54,7 @@
++name->nComponents;
}
- if (error = ndn_BinaryXMLDecoder_readElementClose(&decoder))
+ if (error = ndn_BinaryXMLDecoder_readElementClose(decoder))
return error;
return 0;
diff --git a/ndn-cpp/c/encoding/BinaryXMLName.h b/ndn-cpp/c/encoding/BinaryXMLName.h
index 58552c5..c943f4b 100644
--- a/ndn-cpp/c/encoding/BinaryXMLName.h
+++ b/ndn-cpp/c/encoding/BinaryXMLName.h
@@ -16,7 +16,7 @@
char *ndn_encodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLEncoder *encoder);
-char *ndn_decodeBinaryXMLName(struct ndn_Name *name, unsigned char *input, unsigned int inputLength);
+char *ndn_decodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLDecoder *decoder);
#ifdef __cplusplus
}