From b538a67ba348f339df71e76fbf53997db21a7477 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 15 Mar 2019 00:20:42 +0100 Subject: [PATCH] make style --- client/cmdlfhitag.c | 46 ++++++++++++++++++++++----------------------- client/util.c | 8 ++++---- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/client/cmdlfhitag.c b/client/cmdlfhitag.c index ac5d6f795..717b2b854 100644 --- a/client/cmdlfhitag.c +++ b/client/cmdlfhitag.c @@ -348,17 +348,17 @@ static void printHitagConfiguration(uint8_t config) { memset(msg, 0, sizeof(msg)); // encoding if (config & 0x1) { - strcat(msg, "Biphase encoding"); + strcat(msg, "Biphase encoding"); } else { strcat(msg, "Manchester encoding"); } PrintAndLogEx(SUCCESS, "%s", msg); memset(msg, 0, sizeof(msg)); - + // version strcat(msg, "Coding in HITAG 2 operation: %s"); uint8_t foo = (config & 0x6) >> 1; - switch ( foo ) { + switch (foo) { case 0: PrintAndLogEx(SUCCESS, "Version: public mode B, Coding: biphase"); PrintAndLogEx(SUCCESS, msg, (config & 0x1) ? "biphase" : "manchester"); @@ -366,60 +366,60 @@ static void printHitagConfiguration(uint8_t config) { case 1: PrintAndLogEx(SUCCESS, "Version: public mode A, Coding: manchester"); PrintAndLogEx(SUCCESS, msg, (config & 0x1) ? "biphase" : "manchester"); - break; + break; case 2: PrintAndLogEx(SUCCESS, "Version: public mode C, Coding: biphase"); PrintAndLogEx(SUCCESS, msg, (config & 0x1) ? "biphase" : "manchester"); - break; + break; case 3: PrintAndLogEx(SUCCESS, "Version: Hitag2"); PrintAndLogEx(SUCCESS, msg, (config & 0x1) ? "biphase" : "manchester"); break; } memset(msg, 0, sizeof(msg)); - + // mode if (config & 0x8) { - strcat(msg, "Tag is in : " _YELLOW_("Crypto mode") ); + strcat(msg, "Tag is in : " _YELLOW_("Crypto mode")); } else { - strcat(msg, "Tag is in : " _YELLOW_("Password mode") ); + strcat(msg, "Tag is in : " _YELLOW_("Password mode")); } - PrintAndLogEx(SUCCESS, "%s", msg); + PrintAndLogEx(SUCCESS, "%s", msg); memset(msg, 0, sizeof(msg)); - + // page access if (config & 0x10) { strcat(msg, "Page 6,7 : read only"); } else { strcat(msg, "Page 6,7 : " _GREEN_("read write")); } - PrintAndLogEx(SUCCESS, "%s", msg); + PrintAndLogEx(SUCCESS, "%s", msg); memset(msg, 0, sizeof(msg)); - + // page access if (config & 0x20) { strcat(msg, "Page 4,5 : read only"); } else { strcat(msg, "Page 4,5 : " _GREEN_("read write")); } - PrintAndLogEx(SUCCESS, "%s", msg); + PrintAndLogEx(SUCCESS, "%s", msg); memset(msg, 0, sizeof(msg)); - + // OTP if (config & 0x40) { - strcat(msg, "Page 3 : read only. Configuration byte and password tag " _RED_("FIXED / IRREVERSIBLE") ); + strcat(msg, "Page 3 : read only. Configuration byte and password tag " _RED_("FIXED / IRREVERSIBLE")); } else { strcat(msg, "Page 3 : " _GREEN_("read write")); - } - PrintAndLogEx(SUCCESS, "%s", msg); + } + PrintAndLogEx(SUCCESS, "%s", msg); memset(msg, 0, sizeof(msg)); - + // OTP if (config & 0x80) { strcat(msg, "Page 1 " _RED_("locked") "\n"); - + if (config & 0x8) { - strcat(msg + strlen(msg), "Page 2 : " _RED_("locked") ); + strcat(msg + strlen(msg), "Page 2 : " _RED_("locked")); } else { strcat(msg + strlen(msg), "Page 2 : read only"); } @@ -434,14 +434,14 @@ int CmdLFHitagInfo(const char *Cmd) { PrintAndLogEx(INFO, "Hitag2 tag information "); PrintAndLogEx(INFO, "To be done!"); PrintAndLogEx(INFO, "------------------------------------"); - + char ctmp = tolower(param_getchar(Cmd, 0)); if (ctmp == 'h') return usage_hitag_info(); - + // read block3, get configuration byte. // common configurations. - printHitagConfiguration( 0x06 ); + printHitagConfiguration(0x06); //printHitagConfiguration( 0x0E ); //printHitagConfiguration( 0x02 ); //printHitagConfiguration( 0x00 ); diff --git a/client/util.c b/client/util.c index 03680bb48..a3f275a0b 100644 --- a/client/util.c +++ b/client/util.c @@ -694,7 +694,7 @@ int binarraytohex(char *target, const size_t targetlen, char *source, size_t src uint32_t r = 0; // consumed bits uint8_t w = 0; // wrong bits separator printed for (size_t s = 0 ; s < srclen; s++) { - if ((source[s]==0) || (source[s]==1)) { + if ((source[s] == 0) || (source[s] == 1)) { w = 0; x += (source[s] << (3 - i)); i++; @@ -702,7 +702,7 @@ int binarraytohex(char *target, const size_t targetlen, char *source, size_t src if (t >= targetlen - 2) return r; sprintf(target + t, "%X", x); t++; - r+=4; + r += 4; x = 0; i = 0; } @@ -711,8 +711,8 @@ int binarraytohex(char *target, const size_t targetlen, char *source, size_t src if (t >= targetlen - 5) return r; w = 0; sprintf(target + t, "%X[%i]", x, i); - t+=4; - r+=i; + t += 4; + r += i; x = 0; i = 0; }