marcus905 / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
0 stars 0 forks source link

nfc_initiator_transceive_bytes() should return a size_t instead of int #207

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
According to the documentation:
Returns received bytes count on success, otherwise returns libnfc's error code

The return value should be as large as the szRx parameter.

Same remark for nfc_initiator_transceive_bytes_timed(), 
nfc_initiator_transceive_bits() and nfc_initiator_transceive_bits_timed()

Original issue reported on code.google.com by ludovic....@gmail.com on 14 Sep 2012 at 7:58

GoogleCodeExporter commented 9 years ago
True for nfc_initiator_transceive_bytes(): szRx is a size_t and the returned 
type is int.
First, we know that received bytes will not be larger as size_t nor int (its 
not the same order of magnitude), but that could be a bad argument...
Next, which type to use in this context ? size_t could not be signed, ssize_t 
can't contains maximum size_t value neither.

For other functions, there is no szRx... but probably should have some :-)

Original comment by romu...@libnfc.org on 17 Sep 2012 at 3:04

GoogleCodeExporter commented 9 years ago
I agree using size_t is not a good idea since it is not signed and then cannot 
return an error code.

I have no better idea. Maybe you can close the bug.

Original comment by ludovic....@gmail.com on 18 Sep 2012 at 7:22

GoogleCodeExporter commented 9 years ago

Original comment by romu...@libnfc.org on 5 Dec 2012 at 3:43