Fix cppcheck warning: The scope of the variable X can be reduced.
This commit is contained in:
parent
fc144fe389
commit
9cb9e0e6da
5 changed files with 5 additions and 7 deletions
|
@ -60,7 +60,6 @@ main(int argc, const char *argv[])
|
||||||
nfc_device *pnd = NULL;
|
nfc_device *pnd = NULL;
|
||||||
const char *acLibnfcVersion;
|
const char *acLibnfcVersion;
|
||||||
bool result;
|
bool result;
|
||||||
int res = 0;
|
|
||||||
|
|
||||||
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||||
size_t szRx = sizeof(abtRx);
|
size_t szRx = sizeof(abtRx);
|
||||||
|
@ -92,6 +91,7 @@ main(int argc, const char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < szFound; i++) {
|
for (i = 0; i < szFound; i++) {
|
||||||
|
int res = 0;
|
||||||
pnd = nfc_open(context, connstrings[i]);
|
pnd = nfc_open(context, connstrings[i]);
|
||||||
|
|
||||||
if (pnd == NULL) {
|
if (pnd == NULL) {
|
||||||
|
|
|
@ -120,10 +120,10 @@ int main(int argc, const char *argv[])
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cmd;
|
|
||||||
const char *prompt = "> ";
|
const char *prompt = "> ";
|
||||||
while (1) {
|
while (1) {
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
char *cmd;
|
||||||
#if defined(HAVE_READLINE)
|
#if defined(HAVE_READLINE)
|
||||||
if (input == NULL) { // means we use stdin
|
if (input == NULL) { // means we use stdin
|
||||||
cmd = readline(prompt);
|
cmd = readline(prompt);
|
||||||
|
|
|
@ -154,7 +154,6 @@ acr122_pcsc_scan(const nfc_context *context, nfc_connstring connstrings[], const
|
||||||
char acDeviceNames[256 + 64 * PCSC_MAX_DEVICES];
|
char acDeviceNames[256 + 64 * PCSC_MAX_DEVICES];
|
||||||
size_t szDeviceNamesLen = sizeof(acDeviceNames);
|
size_t szDeviceNamesLen = sizeof(acDeviceNames);
|
||||||
SCARDCONTEXT *pscc;
|
SCARDCONTEXT *pscc;
|
||||||
bool bSupported;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Clear the reader list
|
// Clear the reader list
|
||||||
|
@ -172,7 +171,7 @@ acr122_pcsc_scan(const nfc_context *context, nfc_connstring connstrings[], const
|
||||||
|
|
||||||
size_t device_found = 0;
|
size_t device_found = 0;
|
||||||
while ((acDeviceNames[szPos] != '\0') && (device_found < connstrings_len)) {
|
while ((acDeviceNames[szPos] != '\0') && (device_found < connstrings_len)) {
|
||||||
bSupported = false;
|
bool bSupported = false;
|
||||||
for (i = 0; supported_devices[i] && !bSupported; i++) {
|
for (i = 0; supported_devices[i] && !bSupported; i++) {
|
||||||
int l = strlen(supported_devices[i]);
|
int l = strlen(supported_devices[i]);
|
||||||
bSupported = 0 == strncmp(supported_devices[i], acDeviceNames + szPos, l);
|
bSupported = 0 == strncmp(supported_devices[i], acDeviceNames + szPos, l);
|
||||||
|
|
|
@ -151,7 +151,6 @@ initiator_thread(void *arg)
|
||||||
void
|
void
|
||||||
test_dep_active(void)
|
test_dep_active(void)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
nfc_baud_rate nbrs[3] = { NBR_106, NBR_212, NBR_424};
|
nfc_baud_rate nbrs[3] = { NBR_106, NBR_212, NBR_424};
|
||||||
|
|
||||||
CutTestContext *test_context = cut_get_current_test_context();
|
CutTestContext *test_context = cut_get_current_test_context();
|
||||||
|
@ -167,6 +166,7 @@ test_dep_active(void)
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
initiator_data.nbr = nbrs[i];
|
initiator_data.nbr = nbrs[i];
|
||||||
|
int res;
|
||||||
|
|
||||||
if ((res = pthread_create(&(threads[TARGET]), NULL, target_thread, &target_data)))
|
if ((res = pthread_create(&(threads[TARGET]), NULL, target_thread, &target_data)))
|
||||||
cut_fail("pthread_create() returned %d", res);
|
cut_fail("pthread_create() returned %d", res);
|
||||||
|
|
|
@ -177,8 +177,6 @@ initiator_thread(void *arg)
|
||||||
void
|
void
|
||||||
test_dep_states(void)
|
test_dep_states(void)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
|
|
||||||
CutTestContext *test_context = cut_get_current_test_context();
|
CutTestContext *test_context = cut_get_current_test_context();
|
||||||
struct thread_data target_data = {
|
struct thread_data target_data = {
|
||||||
.device = first_device,
|
.device = first_device,
|
||||||
|
@ -191,6 +189,7 @@ test_dep_states(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
|
int res;
|
||||||
if ((res = pthread_create(&(threads[1]), NULL, target_thread, &target_data)))
|
if ((res = pthread_create(&(threads[1]), NULL, target_thread, &target_data)))
|
||||||
cut_fail("pthread_create() returned %d", res);
|
cut_fail("pthread_create() returned %d", res);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue