From 8f645fbe62a4bf0152b14fccb37767d19f9fecba Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Tue, 31 Aug 2010 14:48:47 +0000 Subject: [PATCH] Attempt to fix Mifare Classic support after r543. --- libfreefare/mifare_classic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libfreefare/mifare_classic.c b/libfreefare/mifare_classic.c index 336a262..3bf1a9c 100644 --- a/libfreefare/mifare_classic.c +++ b/libfreefare/mifare_classic.c @@ -285,7 +285,7 @@ mifare_classic_authenticate (MifareTag tag, const MifareClassicBlockNumber block MIFARE_CLASSIC(tag)->cached_access_bits.sector_access_bits = 0x00; MIFARE_CLASSIC(tag)->last_authentication_key_type = key_type; - return (res[0] == 0) ? 0 : -1; + return (BUFFER_SIZE (res) == 0) ? 0 : res[0]; } /* @@ -377,7 +377,7 @@ mifare_classic_write (MifareTag tag, const MifareClassicBlockNumber block, const CLASSIC_TRANSCEIVE (tag, cmd, res); - return (res[0] == 0) ? 0 : -1; + return (BUFFER_SIZE (res) == 0) ? 0 : res[0]; } /* @@ -399,7 +399,7 @@ mifare_classic_increment (MifareTag tag, const MifareClassicBlockNumber block, c CLASSIC_TRANSCEIVE (tag, cmd, res); - return (res[0] == 0) ? 0 : -1; + return (BUFFER_SIZE (res) == 0) ? 0 : res[0]; } /* @@ -421,7 +421,7 @@ mifare_classic_decrement (MifareTag tag, const MifareClassicBlockNumber block, c CLASSIC_TRANSCEIVE (tag, cmd, res); - return (res[0] == 0) ? 0 : -1; + return (BUFFER_SIZE (res) == 0) ? 0 : res[0]; } /* @@ -450,7 +450,7 @@ mifare_classic_restore (MifareTag tag, const MifareClassicBlockNumber block) CLASSIC_TRANSCEIVE (tag, cmd, res); - return (res[0] == 0) ? 0 : -1; + return (BUFFER_SIZE (res) == 0) ? 0 : res[0]; } /* @@ -470,7 +470,7 @@ mifare_classic_transfer (MifareTag tag, const MifareClassicBlockNumber block) CLASSIC_TRANSCEIVE (tag, cmd, res); - return (res[0] == 0) ? 0 : -1; + return (BUFFER_SIZE (res) == 0) ? 0 : res[0]; }