To avoid warnings on some compilers added extra parens to if ((error = func()))
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;