jtag/aice: avoid abusing of int32_t type
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 18 Aug 2020 16:31:53 +0000 (18:31 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 5 Sep 2020 16:12:19 +0000 (17:12 +0100)
commitd493b53e8c43da0904c03617830b8efa2e136d3d
treee590dd7e741bce2a0df92ebe5ac6f84e74e97d38
parent4e98d44fd1dc67f763f06eeecc0453d65b1290dc
jtag/aice: avoid abusing of int32_t type

In several cases the 'int' status value returned by libusb and by
aice internal functions is taken in a variable of type 'int32_t',
requiring an implicit (but trivial) cast.
This makes compulsory using 'PRId32' in the format strings that
print such 'int32_t' result and requires an additional implicit
conversion to return the 'int32_t' as 'int'.

Replace to type 'int' all the occurrences of 'int32_t result' and
fix accordingly the format strings.

Plus, all the size of aice commands are stored as int32_t const
variables with uppercase name, violating the coding style, and are
then passed as 'int' parameter to the read/write functions.

Replace the variables with C macros carrying an 'int' value.

While there, replace also a 'uint32_t' loop index with 'unsigned'
and fix the format string in the loop.

Change-Id: Ic57d58770f1af95f003b5a02fbcb7c926ec06fd1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5814
Tested-by: jenkins
src/jtag/aice/aice_interface.c
src/jtag/aice/aice_usb.c