diff --git a/examples/nfc-emulate-forum-tag2.c b/examples/nfc-emulate-forum-tag2.c index 2e8ef6e..c636c7d 100644 --- a/examples/nfc-emulate-forum-tag2.c +++ b/examples/nfc-emulate-forum-tag2.c @@ -172,11 +172,11 @@ main(int argc, char *argv[]) }; struct nfc_emulation_state_machine state_machine = { - .io = nfcforum_tag2_io + .io = nfcforum_tag2_io }; struct nfc_emulator emulator = { - .target= &nt, + .target = &nt, .state_machine = &state_machine, .user_data = __nfcforum_tag2_memory_area, }; diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index 4ceee23..aad5006 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -80,7 +80,7 @@ int main(int argc, const char* argv[]) FILE* input = NULL; if (argc >= 2) { - if((input=fopen(argv[1], "r"))==NULL) { + if((input = fopen(argv[1], "r"))==NULL) { ERR ("%s", "Cannot open file."); return EXIT_FAILURE; } @@ -105,12 +105,12 @@ int main(int argc, const char* argv[]) char *cmd; char *prompt = "> "; while(1) { - int offset=0; + int offset = 0; #if defined(HAVE_READLINE) - if (input==NULL) { // means we use stdin - cmd=readline(prompt); + if (input == NULL) { // means we use stdin + cmd = readline(prompt); // NULL if ctrl-d - if (cmd==NULL) { + if (cmd == NULL) { printf("Bye!\n"); break; } @@ -137,18 +137,18 @@ int main(int argc, const char* argv[]) #if defined(HAVE_READLINE) } #endif //HAVE_READLINE - if (cmd[0]=='q') { + if (cmd[0] == 'q') { printf("Bye!\n"); free(cmd); break; } - if (cmd[0]=='p') { - int s=0; + if (cmd[0] == 'p') { + int s = 0; offset++; while (isspace(cmd[offset])) { offset++; } - sscanf(cmd+offset, "%d", &s); + sscanf(cmd + offset, "%d", &s); printf("Pause for %i msecs\n", s); if (s>0) { sleep(s * SUSP_TIME); @@ -157,14 +157,14 @@ int main(int argc, const char* argv[]) continue; } szTx = 0; - for(int i = 0; itype == PN532) { size_t szTargetTypes = 0; pn53x_target_type apttTargetTypes[32]; - for (size_t n=0; nlast_error = NFC_EINVARG; @@ -1122,8 +1122,8 @@ pn53x_initiator_poll_target (struct nfc_device *pnd, pn53x_set_property_bool (pnd, NP_INFINITE_SELECT, true); // FIXME It does not support DEP targets do { - for (size_t p=0; p> 8); BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOLevel & 0xff); BUFFER_APPEND (abtWriteRegisterCmd, SYMBOL_FLUSH_BUFFER); - for (i=0; i< ((szTxBits / 8) + 1); i++) { + for (i = 0; i < ((szTxBits / 8) + 1); i++) { BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOData >> 8); BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOData & 0xff); BUFFER_APPEND (abtWriteRegisterCmd, pbtTx[i]); @@ -1440,7 +1440,7 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb // our PN53x timer saturates after 4.8ms so this function shouldn't be used for // responses coming very late anyway. // Ideally we should implement a real timer here too but looping a few times is good enough. - for (i=0; i<(3 *(CHIP_DATA (pnd)->timer_prescaler * 2 + 1)); i++) { + for (i = 0; i < (3 *(CHIP_DATA (pnd)->timer_prescaler * 2 + 1)); i++) { pn53x_read_register (pnd, PN53X_REG_CIU_FIFOLevel, &sz); if (sz > 0) break; @@ -1453,7 +1453,7 @@ pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pb while (1) { BUFFER_INIT (abtReadRegisterCmd, PN53x_EXTENDED_FRAME__DATA_MAX_LEN); BUFFER_APPEND (abtReadRegisterCmd, ReadRegister); - for (i=0; i> 8); BUFFER_APPEND (abtReadRegisterCmd, PN53X_REG_CIU_FIFOData & 0xff); } @@ -1515,7 +1515,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOLevel >> 8); BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOLevel & 0xff); BUFFER_APPEND (abtWriteRegisterCmd, SYMBOL_FLUSH_BUFFER); - for (i=0; i< szTx; i++) { + for (i = 0; i < szTx; i++) { BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOData >> 8); BUFFER_APPEND (abtWriteRegisterCmd, PN53X_REG_CIU_FIFOData & 0xff); BUFFER_APPEND (abtWriteRegisterCmd, pbtTx[i]); @@ -1535,7 +1535,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p // our PN53x timer saturates after 4.8ms so this function shouldn't be used for // responses coming very late anyway. // Ideally we should implement a real timer here too but looping a few times is good enough. - for (i=0; i<(3 *(CHIP_DATA (pnd)->timer_prescaler * 2 + 1)); i++) { + for (i = 0; i < (3 *(CHIP_DATA (pnd)->timer_prescaler * 2 + 1)); i++) { pn53x_read_register (pnd, PN53X_REG_CIU_FIFOLevel, &sz); if (sz > 0) break; @@ -1548,7 +1548,7 @@ pn53x_initiator_transceive_bytes_timed (struct nfc_device *pnd, const uint8_t *p while (1) { BUFFER_INIT (abtReadRegisterCmd, PN53x_EXTENDED_FRAME__DATA_MAX_LEN); BUFFER_APPEND (abtReadRegisterCmd, ReadRegister); - for (i=0; i> 8); BUFFER_APPEND (abtReadRegisterCmd, PN53X_REG_CIU_FIFOData & 0xff); } diff --git a/test/test_dep_active.c b/test/test_dep_active.c index de0692d..42b180d 100644 --- a/test/test_dep_active.c +++ b/test/test_dep_active.c @@ -165,7 +165,7 @@ test_dep (void) .cut_test_context = test_context, }; - for (int i=0; i<3; i++) { + for (int i = 0; i < 3; i++) { initiator_data.nbr = nbrs[i]; if ((res = pthread_create (&(threads[TARGET]), NULL, target_thread, &target_data))) diff --git a/utils/nfc-mfsetuid.c b/utils/nfc-mfsetuid.c index 64ea4d2..4bf01b6 100644 --- a/utils/nfc-mfsetuid.c +++ b/utils/nfc-mfsetuid.c @@ -344,7 +344,7 @@ main (int argc, char *argv[]) transmit_bytes (abtWrite,4); transmit_bytes (abtData,18); if(format) { - for(i= 3 ; i < 64 ; i += 4) { + for(i = 3 ; i < 64 ; i += 4) { abtWrite[1]= (char) i; iso14443a_crc_append (abtWrite, 2); transmit_bytes (abtWrite,4); diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index cc25a14..6b2b7b3 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -98,7 +98,7 @@ nfc_forum_tag_type3_check (nfc_device *pnd, const nfc_target nt, const uint16_t }; size_t payload_len = 1 + 2 + 1; - for (uint8_t b=0; b MAX_FRAME_LEN) { return EXIT_FAILURE; } - if (fprintf (fd4, "#%s %04zx: ", pchPrefix, szBytes)<0) { + if (fprintf (fd4, "#%s %04zx: ", pchPrefix, szBytes) < 0) { return EXIT_FAILURE; } for (szPos = 0; szPos < szBytes; szPos++) { - if (fprintf (fd4, "%02x ", pbtData[szPos])<0) { + if (fprintf (fd4, "%02x ", pbtData[szPos]) < 0) { return EXIT_FAILURE; } } - if (fprintf (fd4, "\n")<0) { + if (fprintf (fd4, "\n") < 0) { return EXIT_FAILURE; } fflush(fd4); @@ -129,7 +129,7 @@ bool scan_hex_fd3 (uint8_t *pbtData, size_t *pszBytes, const char *pchPrefix) } strncpy(pchScan, pchPrefix, 250); strcat(pchScan, " %04x:"); - if (fscanf (fd3, pchScan, &uiBytes)<1) { + if (fscanf (fd3, pchScan, &uiBytes) < 1) { return EXIT_FAILURE; } *pszBytes=uiBytes; @@ -137,7 +137,7 @@ bool scan_hex_fd3 (uint8_t *pbtData, size_t *pszBytes, const char *pchPrefix) return EXIT_FAILURE; } for (szPos = 0; szPos < *pszBytes; szPos++) { - if (fscanf (fd3, "%02x", &uiData)<1) { + if (fscanf (fd3, "%02x", &uiData) < 1) { return EXIT_FAILURE; } pbtData[szPos]=uiData; @@ -168,7 +168,7 @@ main (int argc, char *argv[]) initiator_only_mode = true; target_only_mode = false; } else if (0 == strcmp (argv[arg], "-n")) { - if (++arg==argc || (sscanf(argv[arg], "%i", &waiting_time)<1)) { + if (++arg == argc || (sscanf(argv[arg], "%i", &waiting_time) < 1)) { ERR ("Missing or wrong waiting time value: %s.", argv[arg]); print_usage (argv); return EXIT_FAILURE;