Fix unused result warnings and add a new NFC_ESOFT error.

This commit is contained in:
Romuald Conty 2012-05-16 18:24:16 +00:00
parent bfcdb1bd4c
commit 45ef3b43c4
4 changed files with 25 additions and 5 deletions

7
NEWS
View file

@ -1,3 +1,10 @@
New in TBD:
API Changes:
* Types
- New NFC_ESOFT error to handle software errors (allocations, pie creation, etc.)
New in 1.6.0-rc1: New in 1.6.0-rc1:
API Changes: API Changes:

View file

@ -124,7 +124,7 @@ extern "C" {
#define NFC_SUCCESS 0 #define NFC_SUCCESS 0
/** @ingroup error /** @ingroup error
* @hideinitializer * @hideinitializer
* Input / output error, device will not be usable anymore * Input / output error, device may not be usable anymore without re-open it
*/ */
#define NFC_EIO -1 #define NFC_EIO -1
/** @ingroup error /** @ingroup error
@ -172,6 +172,11 @@ extern "C" {
* Error while RF transmission * Error while RF transmission
*/ */
#define NFC_ERFTRANS -20 #define NFC_ERFTRANS -20
/** @ingroup error
* @hideinitializer
* Software error (allocation, file/pipe creation, etc.)
*/
#define NFC_ESOFT -80
/** @ingroup error /** @ingroup error
* @hideinitializer * @hideinitializer
* Device's internal chip error * Device's internal chip error

View file

@ -586,7 +586,9 @@ acr122s_open(const nfc_connstring connstring)
DRIVER_DATA(pnd)->seq = 0; DRIVER_DATA(pnd)->seq = 0;
#ifndef WIN32 #ifndef WIN32
pipe(DRIVER_DATA(pnd)->abort_fds); if (pipe(DRIVER_DATA(pnd)->abort_fds) < 0) {
return NULL;
}
#else #else
DRIVER_DATA(pnd)->abort_flag = false; DRIVER_DATA(pnd)->abort_flag = false;
#endif #endif
@ -704,7 +706,9 @@ acr122s_abort_command(nfc_device *pnd)
#ifndef WIN32 #ifndef WIN32
close(DRIVER_DATA(pnd)->abort_fds[0]); close(DRIVER_DATA(pnd)->abort_fds[0]);
close(DRIVER_DATA(pnd)->abort_fds[1]); close(DRIVER_DATA(pnd)->abort_fds[1]);
pipe(DRIVER_DATA(pnd)->abort_fds); if (pipe(DRIVER_DATA(pnd)->abort_fds) < 0 ) {
return NFC_ESOFT;
}
#else #else
DRIVER_DATA(pnd)->abort_flag = true; DRIVER_DATA(pnd)->abort_flag = true;
#endif #endif

View file

@ -265,7 +265,9 @@ arygon_open (const nfc_connstring connstring)
#ifndef WIN32 #ifndef WIN32
// pipe-based abort mecanism // pipe-based abort mecanism
pipe (DRIVER_DATA (pnd)->iAbortFds); if (pipe (DRIVER_DATA (pnd)->iAbortFds) < 0) {
return NULL;
}
#else #else
DRIVER_DATA (pnd)->abort_flag = false; DRIVER_DATA (pnd)->abort_flag = false;
#endif #endif
@ -545,7 +547,9 @@ arygon_abort_command (nfc_device *pnd)
if (pnd) { if (pnd) {
#ifndef WIN32 #ifndef WIN32
close (DRIVER_DATA (pnd)->iAbortFds[0]); close (DRIVER_DATA (pnd)->iAbortFds[0]);
pipe (DRIVER_DATA (pnd)->iAbortFds); if (pipe (DRIVER_DATA (pnd)->iAbortFds) < 0) {
return NFC_ESOFT;
}
#else #else
DRIVER_DATA (pnd)->abort_flag = true; DRIVER_DATA (pnd)->abort_flag = true;
#endif #endif