To avoid warnings on some compilers added extra parens to if ((error = func()))
diff --git a/ndn-cpp/c/encoding/binary-xml-data.c b/ndn-cpp/c/encoding/binary-xml-data.c
index 776ca74..c02ca70 100644
--- a/ndn-cpp/c/encoding/binary-xml-data.c
+++ b/ndn-cpp/c/encoding/binary-xml-data.c
@@ -13,21 +13,21 @@
static ndn_Error encodeSignature(struct ndn_Signature *signature, struct ndn_BinaryXmlEncoder *encoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Signature))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Signature)))
return error;
// TODO: Check if digestAlgorithm is the same as the default, and skip it, otherwise encode it as UDATA.
- if (error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Witness, signature->witness, signature->witnessLength))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_Witness, signature->witness, signature->witnessLength)))
return error;
// Require a signature.
- if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_SignatureBits, signature->signature, signature->signatureLength))
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_SignatureBits, signature->signature, signature->signatureLength)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -36,21 +36,21 @@
static ndn_Error decodeSignature(struct ndn_Signature *signature, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Signature))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Signature)))
return error;
/* TODO: digestAlgorithm as UDATA */ signature->digestAlgorithm = 0; signature->digestAlgorithmLength = 0;
- if (error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_Witness, 0, &signature->witness, &signature->witnessLength))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_Witness, 0, &signature->witness, &signature->witnessLength)))
return error;
// Require a signature.
- if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_SignatureBits, 0, &signature->signature, &signature->signatureLength))
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_SignatureBits, 0, &signature->signature, &signature->signatureLength)))
return error;
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
return 0;
@@ -62,15 +62,15 @@
return 0;
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_SignedInfo))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_SignedInfo)))
return error;
// This will skip encoding if there is no publisherPublicKeyDigest.
- if (error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, encoder))
+ if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, encoder)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
- (encoder, ndn_BinaryXml_DTag_Timestamp, signedInfo->timestampMilliseconds))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
+ (encoder, ndn_BinaryXml_DTag_Timestamp, signedInfo->timestampMilliseconds)))
return error;
if (signedInfo->type != ndn_ContentType_DATA) {
@@ -78,19 +78,19 @@
// TODO: Implement converting the type from an int and encoding.
}
- if (error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, signedInfo->freshnessSeconds))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_FreshnessSeconds, signedInfo->freshnessSeconds)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_FinalBlockID, signedInfo->finalBlockID, signedInfo->finalBlockIDLength))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_FinalBlockID, signedInfo->finalBlockID, signedInfo->finalBlockIDLength)))
return error;
// This will skip encoding if there is no key locator.
- if (error = ndn_encodeBinaryXmlKeyLocator(&signedInfo->keyLocator, encoder))
+ if ((error = ndn_encodeBinaryXmlKeyLocator(&signedInfo->keyLocator, encoder)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -99,10 +99,10 @@
static ndn_Error decodeSignedInfo(struct ndn_SignedInfo *signedInfo, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_SignedInfo))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_SignedInfo)))
return error;
- if (error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, decoder))
+ if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&signedInfo->publisherPublicKeyDigest, decoder)))
return error;
if (error= ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
@@ -112,18 +112,18 @@
// TODO: Implement reading the type and converting to an int.
signedInfo->type = ndn_ContentType_DATA;
- if (error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &signedInfo->freshnessSeconds))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (decoder, ndn_BinaryXml_DTag_FreshnessSeconds, &signedInfo->freshnessSeconds)))
return error;
- if (error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_FinalBlockID, 0, &signedInfo->finalBlockID, &signedInfo->finalBlockIDLength))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_FinalBlockID, 0, &signedInfo->finalBlockID, &signedInfo->finalBlockIDLength)))
return error;
- if (error = ndn_decodeOptionalBinaryXmlKeyLocator(&signedInfo->keyLocator, decoder))
+ if ((error = ndn_decodeOptionalBinaryXmlKeyLocator(&signedInfo->keyLocator, decoder)))
return error;
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
return 0;
@@ -132,23 +132,23 @@
ndn_Error ndn_encodeBinaryXmlData(struct ndn_Data *data, struct ndn_BinaryXmlEncoder *encoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ContentObject))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_ContentObject)))
return error;
- if (error = encodeSignature(&data->signature, encoder))
+ if ((error = encodeSignature(&data->signature, encoder)))
return 0;
- if (error = ndn_encodeBinaryXmlName(&data->name, encoder))
+ if ((error = ndn_encodeBinaryXmlName(&data->name, encoder)))
return error;
- if (error = encodeSignedInfo(&data->signedInfo, encoder))
+ if ((error = encodeSignedInfo(&data->signedInfo, encoder)))
return 0;
- if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Content, data->content, data->contentLength))
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_Content, data->content, data->contentLength)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -157,37 +157,37 @@
ndn_Error ndn_decodeBinaryXmlData(struct ndn_Data *data, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ContentObject))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_ContentObject)))
return error;
int gotExpectedTag;
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Signature, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Signature, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
- if (error = decodeSignature(&data->signature, decoder))
+ if ((error = decodeSignature(&data->signature, decoder)))
return error;
}
else
ndn_Signature_init(&data->signature);
- if (error = ndn_decodeBinaryXmlName(&data->name, decoder))
+ if ((error = ndn_decodeBinaryXmlName(&data->name, decoder)))
return error;
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_SignedInfo, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_SignedInfo, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
- if (error = decodeSignedInfo(&data->signedInfo, decoder))
+ if ((error = decodeSignedInfo(&data->signedInfo, decoder)))
return error;
}
else
ndn_SignedInfo_init(&data->signedInfo);
// Require a Content element, but set allowNull to allow a missing BLOB.
- if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_Content, 1, &data->content, &data->contentLength))
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_Content, 1, &data->content, &data->contentLength)))
return error;
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
return 0;
diff --git a/ndn-cpp/c/encoding/binary-xml-decoder.c b/ndn-cpp/c/encoding/binary-xml-decoder.c
index a6d7bfa..1d50461 100644
--- a/ndn-cpp/c/encoding/binary-xml-decoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-decoder.c
@@ -88,7 +88,7 @@
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)
@@ -142,7 +142,7 @@
(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) {
@@ -159,13 +159,13 @@
}
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;
@@ -176,10 +176,10 @@
{
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 {
@@ -194,18 +194,18 @@
(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)
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;
@@ -217,10 +217,10 @@
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))
+ if ((error = parseUnsignedDecimalInt(udataValue, udataValueLength, value)))
return error;
return 0;
@@ -231,7 +231,7 @@
{
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,7 +240,7 @@
}
unsigned int unsignedValue;
- if (error = ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue))
+ if ((error = ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue)))
return error;
*value = (int)unsignedValue;
@@ -253,7 +253,7 @@
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;
@@ -265,7 +265,7 @@
{
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,7 +273,7 @@
return 0;
}
- if (error = ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds))
+ if ((error = ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds)))
return error;
return 0;
diff --git a/ndn-cpp/c/encoding/binary-xml-element-reader.c b/ndn-cpp/c/encoding/binary-xml-element-reader.c
index 4bbd081..110b496 100644
--- a/ndn-cpp/c/encoding/binary-xml-element-reader.c
+++ b/ndn-cpp/c/encoding/binary-xml-element-reader.c
@@ -14,7 +14,7 @@
ndn_BinaryXmlStructureDecoder_seek(&self->structureDecoder, 0);
ndn_Error error;
- if (error = ndn_BinaryXmlStructureDecoder_findElementEnd(&self->structureDecoder, data, dataLength))
+ if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(&self->structureDecoder, data, dataLength)))
return error;
if (self->structureDecoder.gotElementEnd) {
// Got the remainder of an element. Report to the caller.
@@ -24,7 +24,7 @@
#endif
if (self->usePartialData) {
// We have partial data from a previous call, so append this data and point to partialData.
- if (error = ndn_DynamicUCharArray_set(&self->partialData, data, self->structureDecoder.offset, self->partialDataLength))
+ if ((error = ndn_DynamicUCharArray_set(&self->partialData, data, self->structureDecoder.offset, self->partialDataLength)))
return error;
self->partialDataLength += dataLength;
@@ -53,7 +53,7 @@
self->partialDataLength = 0;
}
- if (error = ndn_DynamicUCharArray_set(&self->partialData, data, dataLength, self->partialDataLength))
+ if ((error = ndn_DynamicUCharArray_set(&self->partialData, data, dataLength, self->partialDataLength)))
return error;
self->partialDataLength += dataLength;
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.c b/ndn-cpp/c/encoding/binary-xml-encoder.c
index 33f1696..d245f19 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.c
@@ -26,7 +26,7 @@
static ndn_Error writeArray(struct ndn_BinaryXmlEncoder *self, unsigned char *array, unsigned int arrayLength)
{
ndn_Error error;
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + arrayLength))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + arrayLength)))
return error;
ndn_memcpy(self->output.array + self->offset, array, arrayLength);
@@ -96,7 +96,7 @@
{
while (1) {
ndn_Error error;
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1)))
return error;
self->output.array[self->offset++] = (unsigned char)(x % 10 + '0');
@@ -125,7 +125,7 @@
unsigned int nBufferBytes = self->offset - startOffset;
unsigned int nHeaderBytes = getNHeaderEncodingBytes(nBufferBytes);
ndn_Error error;
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + nHeaderBytes))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + nHeaderBytes)))
return error;
// To reverse and shift at the same time, we first shift nHeaderBytes to the destination while reversing,
@@ -141,7 +141,7 @@
// Override the offset to force encodeTypeAndValue to encode at startOffset, then fix the offset.
self->offset = startOffset;
- if (error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_UDATA, nBufferBytes))
+ if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_UDATA, nBufferBytes)))
// We don't really expect to get an error, since we have already ensured the length.
return error;
self->offset = startOffset + nHeaderBytes + nBufferBytes;
@@ -178,7 +178,7 @@
// Encode backwards. Calculate how many bytes we need.
unsigned int nEncodingBytes = getNHeaderEncodingBytes(value);
ndn_Error error;
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + nEncodingBytes))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + nEncodingBytes)))
return error;
// Bottom 4 bits of value go in last byte with tag.
@@ -207,7 +207,7 @@
ndn_Error ndn_BinaryXmlEncoder_writeElementClose(struct ndn_BinaryXmlEncoder *self)
{
ndn_Error error;
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1)))
return error;
self->output.array[self->offset] = ndn_BinaryXml_CLOSE;
@@ -219,10 +219,10 @@
ndn_Error ndn_BinaryXmlEncoder_writeBlob(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_BLOB, valueLength))
+ if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_BLOB, valueLength)))
return error;
- if (error = writeArray(self, value, valueLength))
+ if ((error = writeArray(self, value, valueLength)))
return error;
return 0;
@@ -231,13 +231,13 @@
ndn_Error ndn_BinaryXmlEncoder_writeBlobDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeBlob(self, value, valueLength))
+ if ((error = ndn_BinaryXmlEncoder_writeBlob(self, value, valueLength)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(self))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
return error;
return 0;
@@ -249,10 +249,10 @@
unsigned int startOffset = self->offset;
ndn_Error error;
- if (error = encodeReversedUnsignedDecimalInt(self, value))
+ if ((error = encodeReversedUnsignedDecimalInt(self, value)))
return error;
- if (error = reverseBufferAndInsertHeader(self, startOffset, ndn_BinaryXml_UDATA))
+ if ((error = reverseBufferAndInsertHeader(self, startOffset, ndn_BinaryXml_UDATA)))
return error;
return 0;
@@ -261,13 +261,13 @@
ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned int value)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(self, value))
+ if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(self, value)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(self))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
return error;
return 0;
@@ -283,7 +283,7 @@
ndn_Error error;
while (lo32 != 0) {
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1)))
return error;
self->output.array[self->offset++] = (unsigned char)(lo32 & 0xff);
@@ -293,7 +293,7 @@
if (hi32 != 0) {
// Pad the lo values out to 4 bytes.
while (self->offset - startOffset < 4) {
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1)))
return error;
self->output.array[self->offset++] = 0;
@@ -301,7 +301,7 @@
// Encode hi32
while (hi32 != 0) {
- if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1))
+ if ((error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1)))
return error;
self->output.array[self->offset++] = (unsigned char)(hi32 & 0xff);
@@ -309,7 +309,7 @@
}
}
- if (error = reverseBufferAndInsertHeader(self, startOffset, ndn_BinaryXml_BLOB))
+ if ((error = reverseBufferAndInsertHeader(self, startOffset, ndn_BinaryXml_BLOB)))
return error;
return 0;
@@ -318,13 +318,13 @@
ndn_Error ndn_BinaryXmlEncoder_writeTimeMillisecondsDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, double milliseconds)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeAbsDoubleBigEndianBlob(self, (milliseconds / 1000.0) * 4096.0))
+ if ((error = ndn_BinaryXmlEncoder_writeAbsDoubleBigEndianBlob(self, (milliseconds / 1000.0) * 4096.0)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(self))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
return error;
return 0;
diff --git a/ndn-cpp/c/encoding/binary-xml-interest.c b/ndn-cpp/c/encoding/binary-xml-interest.c
index 45e855b..7c90a1b 100644
--- a/ndn-cpp/c/encoding/binary-xml-interest.c
+++ b/ndn-cpp/c/encoding/binary-xml-interest.c
@@ -16,7 +16,7 @@
return 0;
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Exclude))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Exclude)))
return error;
// TODO: Do we want to order the components (except for ANY)?
@@ -25,21 +25,21 @@
struct ndn_ExcludeEntry *entry = &exclude->entries[i];
if (entry->type == ndn_Exclude_COMPONENT) {
- if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Component, entry->component, entry->componentLength))
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_Component, entry->component, entry->componentLength)))
return error;
}
else if (entry->type == ndn_Exclude_ANY) {
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Any))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Any)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
}
else
return NDN_ERROR_unrecognized_ndn_ExcludeType;
}
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -48,20 +48,20 @@
static ndn_Error decodeExclude(struct ndn_Exclude *exclude, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Exclude))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Exclude)))
return error;
exclude->nEntries = 0;
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) {
// Component
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 entry.
@@ -73,13 +73,13 @@
continue;
}
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Any, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Any, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
// Any
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Any))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Any)))
return error;
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
// Add the any entry.
@@ -91,13 +91,13 @@
continue;
}
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Bloom, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Bloom, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
// Skip the Bloom and treat it as Any.
unsigned char *value;
unsigned int valueLen;
- if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Bloom, 0, &value, &valueLen))
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement(decoder, ndn_BinaryXml_DTag_Bloom, 0, &value, &valueLen)))
return error;
// Add the any entry.
@@ -113,7 +113,7 @@
break;
}
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
return 0;
@@ -122,48 +122,48 @@
ndn_Error ndn_encodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlEncoder *encoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Interest))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Interest)))
return error;
- if (error = ndn_encodeBinaryXmlName(&interest->name, encoder))
+ if ((error = ndn_encodeBinaryXmlName(&interest->name, encoder)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_MinSuffixComponents, interest->minSuffixComponents))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_MinSuffixComponents, interest->minSuffixComponents)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_MaxSuffixComponents, interest->maxSuffixComponents))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_MaxSuffixComponents, interest->maxSuffixComponents)))
return error;
// This will skip encoding if there is no publisherPublicKeyDigest.
- if (error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, encoder))
+ if ((error = ndn_encodeBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, encoder)))
return error;
// This will skip encoding if there is no exclude.
- if (error = encodeExclude(&interest->exclude, encoder))
+ if ((error = encodeExclude(&interest->exclude, encoder)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_ChildSelector, interest->childSelector))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_ChildSelector, interest->childSelector)))
return error;
if (interest->answerOriginKind >= 0 && interest->answerOriginKind != ndn_Interest_DEFAULT_ANSWER_ORIGIN_KIND) {
- if (error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_AnswerOriginKind, (unsigned int)interest->answerOriginKind))
+ if ((error = ndn_BinaryXmlEncoder_writeUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_AnswerOriginKind, (unsigned int)interest->answerOriginKind)))
return error;
}
- if (error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
- (encoder, ndn_BinaryXml_DTag_Scope, interest->scope))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalUnsignedDecimalIntDTagElement
+ (encoder, ndn_BinaryXml_DTag_Scope, interest->scope)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
- (encoder, ndn_BinaryXml_DTag_InterestLifetime, interest->interestLifetimeMilliseconds))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalTimeMillisecondsDTagElement
+ (encoder, ndn_BinaryXml_DTag_InterestLifetime, interest->interestLifetimeMilliseconds)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Nonce, interest->nonce, interest->nonceLength))
+ if ((error = ndn_BinaryXmlEncoder_writeOptionalBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_Nonce, interest->nonce, interest->nonceLength)))
return error;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -172,51 +172,51 @@
ndn_Error ndn_decodeBinaryXmlInterest(struct ndn_Interest *interest, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Interest))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Interest)))
return error;
- if (error = ndn_decodeBinaryXmlName(&interest->name, decoder))
+ if ((error = ndn_decodeBinaryXmlName(&interest->name, decoder)))
return error;
- if (error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_MinSuffixComponents, &interest->minSuffixComponents))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (decoder, ndn_BinaryXml_DTag_MinSuffixComponents, &interest->minSuffixComponents)))
return error;
- if (error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_MaxSuffixComponents, &interest->maxSuffixComponents))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (decoder, ndn_BinaryXml_DTag_MaxSuffixComponents, &interest->maxSuffixComponents)))
return error;
- if (error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder))
+ if ((error = ndn_decodeOptionalBinaryXmlPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder)))
return error;
int gotExpectedTag;
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Exclude, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Exclude, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
- if (error = decodeExclude(&interest->exclude, decoder))
+ if ((error = decodeExclude(&interest->exclude, decoder)))
return error;
}
else
interest->exclude.nEntries = 0;
- if (error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_ChildSelector, &interest->childSelector))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (decoder, ndn_BinaryXml_DTag_ChildSelector, &interest->childSelector)))
return error;
- if (error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_AnswerOriginKind, &interest->answerOriginKind))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (decoder, ndn_BinaryXml_DTag_AnswerOriginKind, &interest->answerOriginKind)))
return error;
- if (error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
- (decoder, ndn_BinaryXml_DTag_Scope, &interest->scope))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+ (decoder, ndn_BinaryXml_DTag_Scope, &interest->scope)))
return error;
if (error= ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
(decoder, ndn_BinaryXml_DTag_InterestLifetime, &interest->interestLifetimeMilliseconds))
return error;
- if (error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_Nonce, 0, &interest->nonce, &interest->nonceLength))
+ if ((error = ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_Nonce, 0, &interest->nonce, &interest->nonceLength)))
return error;
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
return 0;
diff --git a/ndn-cpp/c/encoding/binary-xml-key.c b/ndn-cpp/c/encoding/binary-xml-key.c
index c26adba..554c88d 100644
--- a/ndn-cpp/c/encoding/binary-xml-key.c
+++ b/ndn-cpp/c/encoding/binary-xml-key.c
@@ -14,17 +14,17 @@
return 0;
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_KeyLocator))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_KeyLocator)))
return error;
if (keyLocator->type == ndn_KeyLocatorType_KEY) {
- if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Key, keyLocator->keyOrCertificate, keyLocator->keyOrCertificateLength))
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_Key, keyLocator->keyOrCertificate, keyLocator->keyOrCertificateLength)))
return error;
}
else if (keyLocator->type == ndn_KeyLocatorType_CERTIFICATE) {
- if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
- (encoder, ndn_BinaryXml_DTag_Certificate, keyLocator->keyOrCertificate, keyLocator->keyOrCertificateLength))
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+ (encoder, ndn_BinaryXml_DTag_Certificate, keyLocator->keyOrCertificate, keyLocator->keyOrCertificateLength)))
return error;
}
else if (keyLocator->type == ndn_KeyLocatorType_KEYNAME) {
@@ -33,7 +33,7 @@
else
return NDN_ERROR_unrecognized_ndn_KeyLocatorType;
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -42,31 +42,31 @@
ndn_Error ndn_decodeBinaryXmlKeyLocator(struct ndn_KeyLocator *keyLocator, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_KeyLocator))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_KeyLocator)))
return error;
int gotExpectedTag;
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Key, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Key, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
keyLocator->type = ndn_KeyLocatorType_KEY;
- if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_Key, 0, &keyLocator->keyOrCertificate, &keyLocator->keyOrCertificateLength))
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_Key, 0, &keyLocator->keyOrCertificate, &keyLocator->keyOrCertificateLength)))
return error;
}
else {
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Certificate, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_Certificate, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
keyLocator->type = ndn_KeyLocatorType_CERTIFICATE;
- if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXml_DTag_Certificate, 0, &keyLocator->keyOrCertificate, &keyLocator->keyOrCertificateLength))
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+ (decoder, ndn_BinaryXml_DTag_Certificate, 0, &keyLocator->keyOrCertificate, &keyLocator->keyOrCertificateLength)))
return error;
}
else {
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyName, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyName, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
// TODO: Implement keyName. For now, just use a structure decoder to skip it.
@@ -74,7 +74,7 @@
ndn_BinaryXmlStructureDecoder_init(&structureDecoder);
ndn_BinaryXmlStructureDecoder_seek(&structureDecoder, decoder->offset);
- if (error = ndn_BinaryXmlStructureDecoder_findElementEnd(&structureDecoder, decoder->input, decoder->inputLength))
+ if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(&structureDecoder, decoder->input, decoder->inputLength)))
return error;
if (!structureDecoder.gotElementEnd)
return NDN_ERROR_read_past_the_end_of_the_input;
@@ -85,7 +85,7 @@
}
}
- if (error = ndn_BinaryXmlDecoder_readElementClose(decoder))
+ if ((error = ndn_BinaryXmlDecoder_readElementClose(decoder)))
return error;
return 0;
@@ -95,10 +95,10 @@
{
int gotExpectedTag;
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyLocator, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_KeyLocator, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
- if (error = ndn_decodeBinaryXmlKeyLocator(keyLocator, decoder))
+ if ((error = ndn_decodeBinaryXmlKeyLocator(keyLocator, decoder)))
return error;
}
else
diff --git a/ndn-cpp/c/encoding/binary-xml-name.c b/ndn-cpp/c/encoding/binary-xml-name.c
index ffdea75..6437843 100644
--- a/ndn-cpp/c/encoding/binary-xml-name.c
+++ b/ndn-cpp/c/encoding/binary-xml-name.c
@@ -11,17 +11,17 @@
ndn_Error ndn_encodeBinaryXmlName(struct ndn_Name *name, struct ndn_BinaryXmlEncoder *encoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Name))
+ if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(encoder, ndn_BinaryXml_DTag_Name)))
return error;
unsigned int 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, name->components[i].valueLength)))
return error;
}
- if (error = ndn_BinaryXmlEncoder_writeElementClose(encoder))
+ if ((error = ndn_BinaryXmlEncoder_writeElementClose(encoder)))
return error;
return 0;
@@ -30,13 +30,13 @@
ndn_Error ndn_decodeBinaryXmlName(struct ndn_Name *name, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Name))
+ if ((error = ndn_BinaryXmlDecoder_readElementStartDTag(decoder, ndn_BinaryXml_DTag_Name)))
return error;
name->nComponents = 0;
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)
@@ -45,7 +45,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.
@@ -55,7 +55,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/binary-xml-publisher-public-key-digest.c b/ndn-cpp/c/encoding/binary-xml-publisher-public-key-digest.c
index dfc95d1..fe9530a 100644
--- a/ndn-cpp/c/encoding/binary-xml-publisher-public-key-digest.c
+++ b/ndn-cpp/c/encoding/binary-xml-publisher-public-key-digest.c
@@ -14,9 +14,9 @@
return 0;
ndn_Error error;
- if (error = ndn_BinaryXmlEncoder_writeBlobDTagElement
+ if ((error = ndn_BinaryXmlEncoder_writeBlobDTagElement
(encoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, publisherPublicKeyDigest->publisherPublicKeyDigest,
- publisherPublicKeyDigest->publisherPublicKeyDigestLength))
+ publisherPublicKeyDigest->publisherPublicKeyDigestLength)))
return error;
return 0;
@@ -26,9 +26,9 @@
(struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXmlDecoder *decoder)
{
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement
+ if ((error = ndn_BinaryXmlDecoder_readBinaryDTagElement
(decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, 0, &publisherPublicKeyDigest->publisherPublicKeyDigest,
- &publisherPublicKeyDigest->publisherPublicKeyDigestLength))
+ &publisherPublicKeyDigest->publisherPublicKeyDigestLength)))
return error;
return 0;
@@ -39,10 +39,10 @@
{
int gotExpectedTag;
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(decoder, ndn_BinaryXml_DTag_PublisherPublicKeyDigest, &gotExpectedTag)))
return error;
if (gotExpectedTag) {
- if (error = ndn_decodeBinaryXmlPublisherPublicKeyDigest(publisherPublicKeyDigest, decoder))
+ if ((error = ndn_decodeBinaryXmlPublisherPublicKeyDigest(publisherPublicKeyDigest, decoder)))
return error;
}
else {
diff --git a/ndn-cpp/c/util/dynamic-uchar-array.h b/ndn-cpp/c/util/dynamic-uchar-array.h
index 71b6a2e..ab5dca4 100644
--- a/ndn-cpp/c/util/dynamic-uchar-array.h
+++ b/ndn-cpp/c/util/dynamic-uchar-array.h
@@ -75,7 +75,7 @@
(struct ndn_DynamicUCharArray *self, unsigned char *value, unsigned int valueLength, unsigned int offset)
{
ndn_Error error;
- if (error = ndn_DynamicUCharArray_ensureLength(self, valueLength + offset))
+ if ((error = ndn_DynamicUCharArray_ensureLength(self, valueLength + offset)))
return error;
ndn_memcpy(self->array + offset, value, valueLength);
};
diff --git a/ndn-cpp/encoding/binary-xml-decoder.hpp b/ndn-cpp/encoding/binary-xml-decoder.hpp
index d4304b0..ae04831 100644
--- a/ndn-cpp/encoding/binary-xml-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-decoder.hpp
@@ -36,7 +36,7 @@
{
int gotExpectedTag;
ndn_Error error;
- if (error = ndn_BinaryXmlDecoder_peekDTag(this, expectedTag, &gotExpectedTag))
+ if ((error = ndn_BinaryXmlDecoder_peekDTag(this, expectedTag, &gotExpectedTag)))
throw std::runtime_error(ndn_getErrorString(error));
return gotExpectedTag;
diff --git a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
index 331f3d3..e83dd5b 100644
--- a/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-structure-decoder.hpp
@@ -32,7 +32,7 @@
bool findElementEnd(unsigned char *input, unsigned int inputLength)
{
ndn_Error error;
- if (error = ndn_BinaryXmlStructureDecoder_findElementEnd(this, input, inputLength))
+ if ((error = ndn_BinaryXmlStructureDecoder_findElementEnd(this, input, inputLength)))
throw std::runtime_error(ndn_getErrorString(error));
return gotElementEnd();
}
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index f4ddf78..7556777 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -49,7 +49,7 @@
BinaryXmlDecoder decoder(input, inputLength);
ndn_Error error;
- if (error = ndn_decodeBinaryXmlInterest(&interestStruct, &decoder))
+ if ((error = ndn_decodeBinaryXmlInterest(&interestStruct, &decoder)))
throw std::runtime_error(ndn_getErrorString(error));
interest.set(interestStruct);
@@ -78,7 +78,7 @@
BinaryXmlDecoder decoder(input, inputLength);
ndn_Error error;
- if (error = ndn_decodeBinaryXmlData(&dataStruct, &decoder))
+ if ((error = ndn_decodeBinaryXmlData(&dataStruct, &decoder)))
throw std::runtime_error(ndn_getErrorString(error));
data.set(dataStruct);
diff --git a/ndn-cpp/transport/tcp-transport.cpp b/ndn-cpp/transport/tcp-transport.cpp
index e8c60ed..3742c97 100644
--- a/ndn-cpp/transport/tcp-transport.cpp
+++ b/ndn-cpp/transport/tcp-transport.cpp
@@ -15,7 +15,7 @@
void TcpTransport::connect(Face &face)
{
ndn_Error error;
- if (error = ndn_TcpTransport_connect(&transport_, (char *)face.getHost(), face.getPort()))
+ if ((error = ndn_TcpTransport_connect(&transport_, (char *)face.getHost(), face.getPort())))
throw std::runtime_error(ndn_getErrorString(error));
// TODO: This belongs in the socket listener.
@@ -31,7 +31,7 @@
void TcpTransport::send(const unsigned char *data, unsigned int dataLength)
{
ndn_Error error;
- if (error = ndn_TcpTransport_send(&transport_, (unsigned char *)data, dataLength))
+ if ((error = ndn_TcpTransport_send(&transport_, (unsigned char *)data, dataLength)))
throw std::runtime_error(ndn_getErrorString(error));
}
@@ -41,7 +41,7 @@
ndn_Error error;
unsigned char buffer[8000];
unsigned int nBytes;
- if (error = ndn_TcpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes))
+ if ((error = ndn_TcpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes)))
throw std::runtime_error(ndn_getErrorString(error));
ndn_BinaryXmlElementReader_onReceivedData(&elementReader_, buffer, nBytes);
@@ -54,7 +54,7 @@
void TcpTransport::close()
{
ndn_Error error;
- if (error = ndn_TcpTransport_close(&transport_))
+ if ((error = ndn_TcpTransport_close(&transport_)))
throw std::runtime_error(ndn_getErrorString(error));
}
diff --git a/ndn-cpp/transport/udp-transport.cpp b/ndn-cpp/transport/udp-transport.cpp
index 1416e8e..fcef683 100644
--- a/ndn-cpp/transport/udp-transport.cpp
+++ b/ndn-cpp/transport/udp-transport.cpp
@@ -15,7 +15,7 @@
void UdpTransport::connect(Face &face)
{
ndn_Error error;
- if (error = ndn_UdpTransport_connect(&transport_, (char *)face.getHost(), face.getPort()))
+ if ((error = ndn_UdpTransport_connect(&transport_, (char *)face.getHost(), face.getPort())))
throw std::runtime_error(ndn_getErrorString(error));
// TODO: This belongs in the socket listener.
@@ -31,7 +31,7 @@
void UdpTransport::send(const unsigned char *data, unsigned int dataLength)
{
ndn_Error error;
- if (error = ndn_UdpTransport_send(&transport_, (unsigned char *)data, dataLength))
+ if ((error = ndn_UdpTransport_send(&transport_, (unsigned char *)data, dataLength)))
throw std::runtime_error(ndn_getErrorString(error));
}
@@ -41,7 +41,7 @@
ndn_Error error;
unsigned char buffer[8000];
unsigned int nBytes;
- if (error = ndn_UdpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes))
+ if ((error = ndn_UdpTransport_receive(&transport_, buffer, sizeof(buffer), &nBytes)))
throw std::runtime_error(ndn_getErrorString(error));
ndn_BinaryXmlElementReader_onReceivedData(&elementReader_, buffer, nBytes);
@@ -54,7 +54,7 @@
void UdpTransport::close()
{
ndn_Error error;
- if (error = ndn_UdpTransport_close(&transport_))
+ if ((error = ndn_UdpTransport_close(&transport_)))
throw std::runtime_error(ndn_getErrorString(error));
}