Code style: Rename BinaryXML to BinaryXml
diff --git a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
index f9d7dda..dbd4ac5 100644
--- a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
@@ -8,12 +8,12 @@
#include "BinaryXMLDecoder.h"
#include "BinaryXMLStructureDecoder.h"
-void ndn_BinaryXMLStructureDecoder_init(struct ndn_BinaryXMLStructureDecoder *self)
+void ndn_BinaryXmlStructureDecoder_init(struct ndn_BinaryXmlStructureDecoder *self)
{
self->gotElementEnd = 0;
self->offset = 0;
self->level = 0;
- self->state = ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE;
+ self->state = ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE;
self->headerLength = 0;
self->useHeaderBuffer = 0;
self->nBytesToRead = 0;
@@ -22,31 +22,31 @@
/**
* Set the state to READ_HEADER_OR_CLOSE and set up to start reading the header.
*/
-static inline void startHeader(struct ndn_BinaryXMLStructureDecoder *self)
+static inline void startHeader(struct ndn_BinaryXmlStructureDecoder *self)
{
self->headerLength = 0;
self->useHeaderBuffer = 0;
- self->state = ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE;
+ self->state = ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE;
}
-ndn_Error ndn_BinaryXMLStructureDecoder_findElementEnd
- (struct ndn_BinaryXMLStructureDecoder *self, unsigned char *input, unsigned int inputLength)
+ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
+ (struct ndn_BinaryXmlStructureDecoder *self, unsigned char *input, unsigned int inputLength)
{
if (self->gotElementEnd)
// Someone is calling when we already got the end.
return 0;
- struct ndn_BinaryXMLDecoder decoder;
- ndn_BinaryXMLDecoder_init(&decoder, input, inputLength);
+ struct ndn_BinaryXmlDecoder decoder;
+ ndn_BinaryXmlDecoder_init(&decoder, input, inputLength);
while (1) {
if (self->offset >= inputLength)
// All the cases assume we have some input. Return and wait for more.
return 0;
- if (self->state == ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE) {
+ if (self->state == ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE) {
// First check for CLOSE.
- if (self->headerLength == 0 && input[self->offset] == ndn_BinaryXML_CLOSE) {
+ if (self->headerLength == 0 && input[self->offset] == ndn_BinaryXml_CLOSE) {
++self->offset;
// Close the level.
--self->level;
@@ -77,7 +77,7 @@
}
unsigned int headerByte = (unsigned int)input[self->offset++];
++self->headerLength;
- if (headerByte & ndn_BinaryXML_TT_FINAL)
+ if (headerByte & ndn_BinaryXml_TT_FINAL)
// Break and read the header.
break;
}
@@ -92,45 +92,45 @@
ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
// Use a local decoder just for the headerBuffer.
- struct ndn_BinaryXMLDecoder bufferDecoder;
- ndn_BinaryXMLDecoder_init(&bufferDecoder, self->headerBuffer, sizeof(self->headerBuffer));
- if (ndn_BinaryXMLDecoder_decodeTypeAndValue(&bufferDecoder, &type, &value))
+ struct ndn_BinaryXmlDecoder bufferDecoder;
+ ndn_BinaryXmlDecoder_init(&bufferDecoder, self->headerBuffer, sizeof(self->headerBuffer));
+ if (ndn_BinaryXmlDecoder_decodeTypeAndValue(&bufferDecoder, &type, &value))
return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
}
else {
// We didn't have to use the headerBuffer.
- ndn_BinaryXMLDecoder_seek(&decoder, self->offset - self->headerLength);
- if (ndn_BinaryXMLDecoder_decodeTypeAndValue(&decoder, &type, &value))
+ ndn_BinaryXmlDecoder_seek(&decoder, self->offset - self->headerLength);
+ if (ndn_BinaryXmlDecoder_decodeTypeAndValue(&decoder, &type, &value))
return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
}
// Set the next state based on the type.
- if (type == ndn_BinaryXML_DATTR)
+ if (type == ndn_BinaryXml_DATTR)
// We already consumed the item. READ_HEADER_OR_CLOSE again.
// Binary XML has rules about what must follow an attribute, but we are just scanning.
startHeader(self);
- else if (type == ndn_BinaryXML_DTAG || type == ndn_BinaryXML_EXT) {
+ else if (type == ndn_BinaryXml_DTAG || type == ndn_BinaryXml_EXT) {
// Start a new level and READ_HEADER_OR_CLOSE again.
++self->level;
startHeader(self);
}
- else if (type == ndn_BinaryXML_TAG || type == ndn_BinaryXML_ATTR) {
- if (type == ndn_BinaryXML_TAG)
+ else if (type == ndn_BinaryXml_TAG || type == ndn_BinaryXml_ATTR) {
+ if (type == ndn_BinaryXml_TAG)
// Start a new level and read the tag.
++self->level;
// Minimum tag or attribute length is 1.
self->nBytesToRead = value + 1;
- self->state = ndn_BinaryXMLStructureDecoder_READ_BYTES;
+ self->state = ndn_BinaryXmlStructureDecoder_READ_BYTES;
// Binary XML has rules about what must follow an attribute, but we are just scanning.
}
- else if (type == ndn_BinaryXML_BLOB || type == ndn_BinaryXML_UDATA) {
+ else if (type == ndn_BinaryXml_BLOB || type == ndn_BinaryXml_UDATA) {
self->nBytesToRead = value;
- self->state = ndn_BinaryXMLStructureDecoder_READ_BYTES;
+ self->state = ndn_BinaryXmlStructureDecoder_READ_BYTES;
}
else
return NDN_ERROR_findElementEnd_unrecognized_header_type;
}
- else if (self->state == ndn_BinaryXMLStructureDecoder_READ_BYTES) {
+ else if (self->state == ndn_BinaryXmlStructureDecoder_READ_BYTES) {
unsigned int nRemainingBytes = inputLength - self->offset;
if (nRemainingBytes < self->nBytesToRead) {
// Need more.