Skip to contentSkip to conversation

libcacard: Fix wrong assertion (reported by cppcheck)

PATCH In review Stefan Weil 2 participants 2 messages Oct 19, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcacard: Fix wrong assertion (reported by cppcheck)

assert("...") will never do anything. This assertion handles a case which should never occur, so it must be assert(!"...").

---
 libcacard/card_7816.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
libcacard/card_7816.c +1 -1
index 9fd59d4..6fe27d5 100644
@@ -754,7 +754,7 @@ vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response)
         return vcard7816_vm_process_apdu(card, apdu, response);
     case VCARD_DIRECT:
         /* if we are type direct, then the applet should handle everything */
-        assert("VCARD_DIRECT: applet failure");
+        assert(!"VCARD_DIRECT: applet failure");
         break;
     }
     *response =
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 3 lines · Stefan Weil

assert("...") will never do anything. This assertion handles a case which should never occur, so it must be assert(!"...").

Thanks, I'll pick it up for a pull request.

Quoted 22 lines
---
 libcacard/card_7816.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
libcacard/card_7816.c +1 -1
index 9fd59d4..6fe27d5 100644
@@ -754,7 +754,7 @@ vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response)
         return vcard7816_vm_process_apdu(card, apdu, response);
     case VCARD_DIRECT:
         /* if we are type direct, then the applet should handle everything */
-        assert("VCARD_DIRECT: applet failure");
+        assert(!"VCARD_DIRECT: applet failure");
         break;
     }
     *response =
Signature · 1 line
1.7.2.5