Fix cppcheck style: "The scope of the variable can be reduced"
This commit is contained in:
parent
0aa1ff309e
commit
f0d5896140
2 changed files with 5 additions and 6 deletions
|
@ -496,7 +496,6 @@ sprint_nfc_jewel_info(char *dst, const nfc_jewel_info nji, bool verbose)
|
||||||
void
|
void
|
||||||
sprint_nfc_iso14443b_info(char *dst, const nfc_iso14443b_info nbi, bool verbose)
|
sprint_nfc_iso14443b_info(char *dst, const nfc_iso14443b_info nbi, bool verbose)
|
||||||
{
|
{
|
||||||
const int iMaxFrameSizes[] = { 16, 24, 32, 40, 48, 64, 96, 128, 256 };
|
|
||||||
dst += sprintf(dst, " PUPI: ");
|
dst += sprintf(dst, " PUPI: ");
|
||||||
dst += sprint_hex(dst, nbi.abtPupi, 4);
|
dst += sprint_hex(dst, nbi.abtPupi, 4);
|
||||||
dst += sprintf(dst, " Application Data: ");
|
dst += sprintf(dst, " Application Data: ");
|
||||||
|
@ -533,6 +532,7 @@ sprint_nfc_iso14443b_info(char *dst, const nfc_iso14443b_info nbi, bool verbose)
|
||||||
dst += sprintf(dst, " * ERROR unknown value\n");
|
dst += sprintf(dst, " * ERROR unknown value\n");
|
||||||
}
|
}
|
||||||
if ((nbi.abtProtocolInfo[1] & 0xf0) <= 0x80) {
|
if ((nbi.abtProtocolInfo[1] & 0xf0) <= 0x80) {
|
||||||
|
const int iMaxFrameSizes[] = { 16, 24, 32, 40, 48, 64, 96, 128, 256 };
|
||||||
dst += sprintf(dst, "* Maximum frame sizes: %d bytes\n", iMaxFrameSizes[((nbi.abtProtocolInfo[1] & 0xf0) >> 4)]);
|
dst += sprintf(dst, "* Maximum frame sizes: %d bytes\n", iMaxFrameSizes[((nbi.abtProtocolInfo[1] & 0xf0) >> 4)]);
|
||||||
}
|
}
|
||||||
if ((nbi.abtProtocolInfo[1] & 0x0f) == PI_ISO14443_4_SUPPORTED) {
|
if ((nbi.abtProtocolInfo[1] & 0x0f) == PI_ISO14443_4_SUPPORTED) {
|
||||||
|
|
|
@ -430,8 +430,6 @@ main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
action_t atAction = ACTION_USAGE;
|
action_t atAction = ACTION_USAGE;
|
||||||
uint8_t *pbtUID;
|
uint8_t *pbtUID;
|
||||||
FILE *pfKeys = NULL;
|
|
||||||
FILE *pfDump = NULL;
|
|
||||||
int unlock = 0;
|
int unlock = 0;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
|
@ -469,7 +467,7 @@ main(int argc, const char *argv[])
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (bUseKeyFile) {
|
if (bUseKeyFile) {
|
||||||
pfKeys = fopen(argv[4], "rb");
|
FILE *pfKeys = fopen(argv[4], "rb");
|
||||||
if (pfKeys == NULL) {
|
if (pfKeys == NULL) {
|
||||||
printf("Could not open keys file: %s\n", argv[4]);
|
printf("Could not open keys file: %s\n", argv[4]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -485,11 +483,12 @@ main(int argc, const char *argv[])
|
||||||
if (atAction == ACTION_READ) {
|
if (atAction == ACTION_READ) {
|
||||||
memset(&mtDump, 0x00, sizeof(mtDump));
|
memset(&mtDump, 0x00, sizeof(mtDump));
|
||||||
} else {
|
} else {
|
||||||
pfDump = fopen(argv[3], "rb");
|
FILE *pfDump = fopen(argv[3], "rb");
|
||||||
|
|
||||||
if (pfDump == NULL) {
|
if (pfDump == NULL) {
|
||||||
printf("Could not open dump file: %s\n", argv[3]);
|
printf("Could not open dump file: %s\n", argv[3]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread(&mtDump, 1, sizeof(mtDump), pfDump) != sizeof(mtDump)) {
|
if (fread(&mtDump, 1, sizeof(mtDump), pfDump) != sizeof(mtDump)) {
|
||||||
|
@ -578,7 +577,7 @@ main(int argc, const char *argv[])
|
||||||
if (read_card(unlock)) {
|
if (read_card(unlock)) {
|
||||||
printf("Writing data to file: %s ...", argv[3]);
|
printf("Writing data to file: %s ...", argv[3]);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
pfDump = fopen(argv[3], "wb");
|
FILE *pfDump = fopen(argv[3], "wb");
|
||||||
if (pfDump == NULL) {
|
if (pfDump == NULL) {
|
||||||
printf("Could not open dump file: %s\n", argv[3]);
|
printf("Could not open dump file: %s\n", argv[3]);
|
||||||
nfc_close(pnd);
|
nfc_close(pnd);
|
||||||
|
|
Loading…
Reference in a new issue