* master: (43 commits)
Windows: workaround as libusb is not automatically detected by CMake
Add usbbus to Makefile.am EXTRA_DIST
make style
Add log_posix to Makefile.am
Split logging internals so that platforms may choose additional or alternate spew mechanisms
More explicitely ignoring return value as suggested by Ludovic
Windows: Clean up all compiler warnings and link warnings
API change
make style
pn53x-sam: fix print_nfc_target
Convert by value passing of nfc_target to pointer for str_nfc_target and nfc_initiator_target_is_present
Windows: Fix bug when compiling without libusb: skip usbbus.c
Windows: Fix compilation due to new usbbus file
Fix bug when compiling without libusb: skip usbbus.c
Fix scan-build warning: cast increases required alignment from 1 to 4
Fix cppcheck warning "Obsolete function 'usleep' called"
Avoid warning about ignoring return value of 'read'
Fix cppcheck warning "Non reentrant function 'readdir' called"
conf.h: make it more standard
uart_posix.c: remove redundant include
...
In the case of windows, allow for the OutputDebugString call in addition to logging to stderr.
Useful for the dll scenario and debugging in Visual Studio.
- Fixed the suppression of the auto-fixup for linking against MS built libs
- Fixed all the formatting warnings by shifting to inttypes.h specifiers
- shifted to %lu for DWORD printf
This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.
Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
Fix following warnings:
[examples/pn53x-tamashell.c:162]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122_pcsc.c:261]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122s.c:441]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:210]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:522]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/pn532_uart.c:187]: (warning) scanf without field width limits can crash with huge input data
[utils/nfc-relay-picc.c:176]: (warning) scanf without field width limits can crash with huge input data
Fix the following cppcheck warnings:
[libnfc/drivers/pn532_uart.c:492]: (style) The scope of the variable 'res' can be reduced
[libnfc/chips/pn53x.c:320]: (style) The scope of the variable 'res' can be reduced
[libnfc/chips/pn53x.c:616]: (style) The scope of the variable 'res' can be reduced
[libnfc/nfc.c:356]: (style) The scope of the variable '_device_found' can be reduced
[utils/nfc-mfclassic.c:178]: (style) The scope of the variable 'key_index' can be reduced
Not a good idea to call exit() from a library...
Problem is now moved to
void nfc_init() calling exit()
This requires a change in API to return error rather than exiting...
Fixes:
pn53x.c:523:11: warning: Value stored to 'pbtRawData' is never read
pbtRawData += szRawData - 8;
^ ~~~~~~~~~~~~~
pn53x.c:544:7: warning: Value stored to 'pbtRawData' is never read
pbtRawData += 2;
^ ~
pn53x.c:532:7: warning: Value stored to 'pbtRawData' is never read
pbtRawData += 8;
^ ~
pn53x.c:3085:3: warning: Value stored to 'buflen' is never read
buflen -= res;
^ ~~~
pn53x.c:3080:3: warning: Value stored to 'buf' is never read
buf += res;
^ ~~~
target-subr.c:466:7: warning: Value stored to 'dst' is never read
dst += sprintf(dst, "* Unknown card, sorry\n");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target-subr.c:480:3: warning: Value stored to 'dst' is never read
dst += sprint_hex(dst, nfi.abtSysCode, 2);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target-subr.c:490:3: warning: Value stored to 'dst' is never read
dst += sprint_hex(dst, nji.btId, 4);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target-subr.c:546:7: warning: Value stored to 'dst' is never read
dst += sprintf(dst, "\n");
^ ~~~~~~~~~~~~~~~~~~
target-subr.c:571:5: warning: Value stored to 'dst' is never read
dst += sprint_hex(dst, nii.abtAtr, nii.szAtrLen);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target-subr.c:580:3: warning: Value stored to 'dst' is never read
dst += sprint_hex(dst, nsi.abtUID, 8);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target-subr.c:593:3: warning: Value stored to 'dst' is never read
dst += sprintf(dst, " Fab Code: %02X\n", nci.btFabCode);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target-subr.c:608:5: warning: Value stored to 'dst' is never read
dst += sprint_hex(dst, ndi.abtGB, ndi.szGB);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acr122_usb.c:570:3: warning: Null pointer passed as an argument to a 'nonnull' parameter
memcpy(DRIVER_DATA(pnd)->apdu_frame.apdu_payload, data, data_len);
^ ~~~~
acr122_usb.c:738:3: warning: Value stored to 'offset' is never read
offset += len;
^ ~~~
acr122_usb.c:753:3: warning: Value stored to 'res' is never read
res = acr122_usb_bulk_write(DRIVER_DATA(pnd), (unsigned char *) & (DRIVER_DATA(pnd)->tama_frame), res, 1000);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix compiler warnings and potential bug
pn53x.c:1526:19: warning: The right operand of '<' is a garbage value
for (i = 0; i < sz; i++) {
^ ~~
pn53x.c:1621:19: warning: The right operand of '<' is a garbage value
for (i = 0; i < sz; i++) {
^ ~~