[Freeipa-devel] [PATCH 2/3] ASN1: Fix warning Wpointer-to-int-cast
Lukas Slebodnik
lslebodn at redhat.com
Fri Jan 29 11:15:41 UTC 2016
ehlo,
the first patch is very simple and it just suppress warning.
The second patch is either bug or dead code. I fixed it as a bug.
I'm not sure how to test 2nd patch.
LS
-------------- next part --------------
>From 49b9cd2f037f52d5095acc0d05ee1684ebb6a121 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 29 Jan 2016 11:52:08 +0100
Subject: [PATCH 2/3] ASN1: Fix warning Wpointer-to-int-cast
The cast operator "()" has higher priority then ternary
operator "?:" and therefore the first argument of ternary operator
(pointer) was cast to "int" and then interpreted as boolean value.
I think we wanted to cast value of ternary operator to type int.
However it's not necesary becuase both of branches has type int.
---
asn1/asn1c/constr_SET_OF.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/asn1/asn1c/constr_SET_OF.c b/asn1/asn1c/constr_SET_OF.c
index 09f27db53dada6869accd8dbb3aba0f56b49e00b..312cfc2e91d3cc710bc26a12322828c00e400b9b 100644
--- a/asn1/asn1c/constr_SET_OF.c
+++ b/asn1/asn1c/constr_SET_OF.c
@@ -904,7 +904,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
nelems = uper_get_length(pd,
ct ? ct->effective_bits : -1, &repeat);
ASN_DEBUG("Got to decode %d elements (eff %d)",
- (int)nelems, (int)ct ? ct->effective_bits : -1);
+ (int)nelems, ct ? ct->effective_bits : -1);
if(nelems < 0) _ASN_DECODE_STARVED;
}
--
2.5.0
-------------- next part --------------
>From fae6c79b65be4b21859f703dbcb7cfbb20286070 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 29 Jan 2016 11:56:23 +0100
Subject: [PATCH 3/3] ASN1: Fix warning Wunused-value
There was used operator "equal to" but there should be
an assignment.
---
asn1/asn1c/constr_SET_OF.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/asn1/asn1c/constr_SET_OF.c b/asn1/asn1c/constr_SET_OF.c
index 312cfc2e91d3cc710bc26a12322828c00e400b9b..0d5efa4f83c189887822f4012fd2a500faf04ae4 100644
--- a/asn1/asn1c/constr_SET_OF.c
+++ b/asn1/asn1c/constr_SET_OF.c
@@ -921,7 +921,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ASN_DEBUG("Failed to add element into %s",
td->name);
/* Fall through */
- rv.code == RC_FAIL;
+ rv.code = RC_FAIL;
} else {
ASN_DEBUG("Failed decoding %s of %s (SET OF)",
elm->type->name, td->name);
--
2.5.0
More information about the Freeipa-devel
mailing list