Code style: Rename BinaryXML to BinaryXml
diff --git a/ndn-cpp/c/encoding/BinaryXMLDecoder.c b/ndn-cpp/c/encoding/BinaryXMLDecoder.c
index 23dd67d..a44af26 100644
--- a/ndn-cpp/c/encoding/BinaryXMLDecoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLDecoder.c
@@ -11,7 +11,7 @@
* Return the octet at self->offset, converting to unsigned int. Increment self->offset.
* This does not check for reading past the end of the input, so this is called "unsafe".
*/
-static inline unsigned int unsafeReadOctet(struct ndn_BinaryXMLDecoder *self)
+static inline unsigned int unsafeReadOctet(struct ndn_BinaryXmlDecoder *self)
{
return (unsigned int)(self->input[self->offset++] & 0xff);
}
@@ -20,7 +20,7 @@
* Return the octet at self->offset, converting to unsigned int. Do not increment self->offset.
* This does not check for reading past the end of the input, so this is called "unsafe".
*/
-static inline unsigned int unsafeGetOctet(struct ndn_BinaryXMLDecoder *self)
+static inline unsigned int unsafeGetOctet(struct ndn_BinaryXmlDecoder *self)
{
return (unsigned int)(self->input[self->offset] & 0xff);
}
@@ -51,7 +51,7 @@
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_decodeTypeAndValue(struct ndn_BinaryXMLDecoder *self, unsigned int *type, unsigned int *valueOut)
+ndn_Error ndn_BinaryXmlDecoder_decodeTypeAndValue(struct ndn_BinaryXmlDecoder *self, unsigned int *type, unsigned int *valueOut)
{
unsigned int value = 0;
int gotFirstOctet = 0;
@@ -69,29 +69,29 @@
gotFirstOctet = 1;
}
- if (octet & ndn_BinaryXML_TT_FINAL) {
+ if (octet & ndn_BinaryXml_TT_FINAL) {
// Finished.
- *type = octet & ndn_BinaryXML_TT_MASK;
- value = (value << ndn_BinaryXML_TT_VALUE_BITS) | ((octet >> ndn_BinaryXML_TT_BITS) & ndn_BinaryXML_TT_VALUE_MASK);
+ *type = octet & ndn_BinaryXml_TT_MASK;
+ value = (value << ndn_BinaryXml_TT_VALUE_BITS) | ((octet >> ndn_BinaryXml_TT_BITS) & ndn_BinaryXml_TT_VALUE_MASK);
break;
}
- value = (value << ndn_BinaryXML_REGULAR_VALUE_BITS) | (octet & ndn_BinaryXML_REGULAR_VALUE_MASK);
+ value = (value << ndn_BinaryXml_REGULAR_VALUE_BITS) | (octet & ndn_BinaryXml_REGULAR_VALUE_MASK);
}
*valueOut = value;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readElementStartDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag)
+ndn_Error ndn_BinaryXmlDecoder_readElementStartDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag)
{
ndn_Error error;
unsigned int type;
unsigned int value;
- if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value))
+ if (error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value))
return error;
- if (type != ndn_BinaryXML_DTAG)
+ if (type != ndn_BinaryXml_DTAG)
return NDN_ERROR_header_type_is_not_a_DTAG;
if (value != expectedTag)
@@ -100,18 +100,18 @@
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readElementClose(struct ndn_BinaryXMLDecoder *self)
+ndn_Error ndn_BinaryXmlDecoder_readElementClose(struct ndn_BinaryXmlDecoder *self)
{
if (self->offset >= self->inputLength)
return NDN_ERROR_read_past_the_end_of_the_input;
- if (unsafeReadOctet(self) != ndn_BinaryXML_CLOSE)
+ if (unsafeReadOctet(self) != ndn_BinaryXml_CLOSE)
return NDN_ERROR_did_not_get_the_expected_element_close;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_peekDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *gotExpectedTag)
+ndn_Error ndn_BinaryXmlDecoder_peekDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *gotExpectedTag)
{
// Default to 0.
*gotExpectedTag = 0;
@@ -125,31 +125,31 @@
unsigned int type;
unsigned int value;
unsigned int saveOffset = self->offset;
- ndn_Error error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value);
+ ndn_Error error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value);
// Restore offset.
self->offset = saveOffset;
if (error)
return error;
- if (type == ndn_BinaryXML_DTAG && value == expectedTag)
+ if (type == ndn_BinaryXml_DTAG && value == expectedTag)
*gotExpectedTag = 1;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readBinaryDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
+ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
{
ndn_Error error;
- if (error = ndn_BinaryXMLDecoder_readElementStartDTag(self, expectedTag))
+ if (error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag))
return error;
if (allowNull) {
if (self->offset >= self->inputLength)
return NDN_ERROR_read_past_the_end_of_the_input;
- if (unsafeGetOctet(self) == ndn_BinaryXML_CLOSE) {
+ if (unsafeGetOctet(self) == ndn_BinaryXml_CLOSE) {
// The binary item is missing, and this is allowed, so read the element close and return a null value.
++self->offset;
*value = 0;
@@ -159,27 +159,27 @@
}
unsigned int itemType;
- if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &itemType, valueLength))
+ if (error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, valueLength))
return error;
// Ignore itemType.
*value = self->input + self->offset;
self->offset += *valueLength;
- if (error = ndn_BinaryXMLDecoder_readElementClose(self))
+ if (error = ndn_BinaryXmlDecoder_readElementClose(self))
return error;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readOptionalBinaryDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
+ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
{
ndn_Error error;
int gotExpectedTag;
- if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
+ if (error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
return error;
if (gotExpectedTag) {
- if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement(self, expectedTag, allowNull, value, valueLength))
+ if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, allowNull, value, valueLength))
return error;
}
else {
@@ -190,34 +190,34 @@
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readUDataDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength)
+ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength)
{
ndn_Error error;
- if (error = ndn_BinaryXMLDecoder_readElementStartDTag(self, expectedTag))
+ if (error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag))
return error;
unsigned int itemType;
- if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &itemType, valueLength))
+ if (error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, valueLength))
return error;
- if (itemType != ndn_BinaryXML_UDATA)
+ if (itemType != ndn_BinaryXml_UDATA)
return NDN_ERROR_item_is_not_UDATA;
*value = self->input + self->offset;
self->offset += *valueLength;
- if (error = ndn_BinaryXMLDecoder_readElementClose(self))
+ if (error = ndn_BinaryXmlDecoder_readElementClose(self))
return error;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned int *value)
+ndn_Error ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned int *value)
{
unsigned char *udataValue;
unsigned int udataValueLength;
ndn_Error error;
- if (error = ndn_BinaryXMLDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength))
+ if (error = ndn_BinaryXmlDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength))
return error;
if (error = parseUnsignedDecimalInt(udataValue, udataValueLength, value))
@@ -226,12 +226,12 @@
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readOptionalUnsignedIntegerDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *value)
+ndn_Error ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *value)
{
int gotExpectedTag;
ndn_Error error;
- if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
+ if (error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
return error;
if (!gotExpectedTag) {
@@ -240,32 +240,32 @@
}
unsigned int unsignedValue;
- if (error = ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue))
+ if (error = ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue))
return error;
*value = (int)unsignedValue;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readTimeMillisecondsDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, double *milliseconds)
+ndn_Error ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, double *milliseconds)
{
ndn_Error error;
unsigned char *bytes;
unsigned int bytesLength;
- if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes, &bytesLength))
+ if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes, &bytesLength))
return error;
- *milliseconds = 1000.0 * ndn_BinaryXMLDecoder_unsignedBigEndianToDouble(bytes, bytesLength) / 4096.0;
+ *milliseconds = 1000.0 * ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(bytes, bytesLength) / 4096.0;
return 0;
}
-ndn_Error ndn_BinaryXMLDecoder_readOptionalTimeMillisecondsDTagElement
- (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, double *milliseconds)
+ndn_Error ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
+ (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, double *milliseconds)
{
int gotExpectedTag;
ndn_Error error;
- if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
+ if (error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
return error;
if (!gotExpectedTag) {
@@ -273,13 +273,13 @@
return 0;
}
- if (error = ndn_BinaryXMLDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds))
+ if (error = ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds))
return error;
return 0;
}
-double ndn_BinaryXMLDecoder_unsignedBigEndianToDouble(unsigned char *bytes, unsigned int bytesLength)
+double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(unsigned char *bytes, unsigned int bytesLength)
{
double result = 0.0;
unsigned int i;