Skip to content

Commit

Permalink
Fix cppcheck warning: The scope of the variable X can be reduced.
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Apr 5, 2013
1 parent fc144fe commit 9cb9e0e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/pn53x-diagnose.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ main(int argc, const char *argv[])
nfc_device *pnd = NULL;
const char *acLibnfcVersion;
bool result;
int res = 0;

uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
size_t szRx = sizeof(abtRx);
Expand Down Expand Up @@ -92,6 +91,7 @@ main(int argc, const char *argv[])
}

for (i = 0; i < szFound; i++) {
int res = 0;
pnd = nfc_open(context, connstrings[i]);

if (pnd == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion examples/pn53x-tamashell.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ int main(int argc, const char *argv[])
exit(EXIT_FAILURE);
}

char *cmd;
const char *prompt = "> ";
while (1) {
int offset = 0;
char *cmd;
#if defined(HAVE_READLINE)
if (input == NULL) { // means we use stdin
cmd = readline(prompt);
Expand Down
3 changes: 1 addition & 2 deletions libnfc/drivers/acr122_pcsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ acr122_pcsc_scan(const nfc_context *context, nfc_connstring connstrings[], const
char acDeviceNames[256 + 64 * PCSC_MAX_DEVICES];
size_t szDeviceNamesLen = sizeof(acDeviceNames);
SCARDCONTEXT *pscc;
bool bSupported;
int i;

// Clear the reader list
Expand All @@ -172,7 +171,7 @@ acr122_pcsc_scan(const nfc_context *context, nfc_connstring connstrings[], const

size_t device_found = 0;
while ((acDeviceNames[szPos] != '\0') && (device_found < connstrings_len)) {
bSupported = false;
bool bSupported = false;
for (i = 0; supported_devices[i] && !bSupported; i++) {
int l = strlen(supported_devices[i]);
bSupported = 0 == strncmp(supported_devices[i], acDeviceNames + szPos, l);
Expand Down
2 changes: 1 addition & 1 deletion test/test_dep_active.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ initiator_thread(void *arg)
void
test_dep_active(void)
{
int res;
nfc_baud_rate nbrs[3] = { NBR_106, NBR_212, NBR_424};

CutTestContext *test_context = cut_get_current_test_context();
Expand All @@ -167,6 +166,7 @@ test_dep_active(void)

for (int i = 0; i < 3; i++) {
initiator_data.nbr = nbrs[i];
int res;

if ((res = pthread_create(&(threads[TARGET]), NULL, target_thread, &target_data)))
cut_fail("pthread_create() returned %d", res);
Expand Down
3 changes: 1 addition & 2 deletions test/test_device_modes_as_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ initiator_thread(void *arg)
void
test_dep_states(void)
{
int res;

CutTestContext *test_context = cut_get_current_test_context();
struct thread_data target_data = {
.device = first_device,
Expand All @@ -191,6 +189,7 @@ test_dep_states(void)
};

for (int i = 0; i < 2; i++) {
int res;
if ((res = pthread_create(&(threads[1]), NULL, target_thread, &target_data)))
cut_fail("pthread_create() returned %d", res);

Expand Down

0 comments on commit 9cb9e0e

Please sign in to comment.