make style

This commit is contained in:
Philippe Teuwen
2019-07-13 00:38:30 +02:00
parent ed47ca7186
commit b0dbbd3683
15 changed files with 55 additions and 56 deletions

View File

@@ -1348,7 +1348,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
data[3][5] = uid[1];
data[3][6] = uid[0];
for (int i=0; i<4; i++) {
for (int i = 0; i < 4; i++) {
AddCrc15(data[i], 7);
clearCommandBuffer();

View File

@@ -957,7 +957,7 @@ static bool CheckChipType(bool getDeviceData) {
retval = true;
goto out;
}
//check for t55xx chip...
if (tryDetectP1(true)) {
PrintAndLogEx(SUCCESS, "\nChipset detection : " _GREEN_("T55xx") "found");
@@ -1084,8 +1084,8 @@ int CmdLFfind(const char *Cmd) {
}
out:
// identify chipset
if ( CheckChipType(isOnline) == false ) {
PrintAndLogEx(DEBUG, "Automatic chip type detection " _RED_("failed") );
if (CheckChipType(isOnline) == false) {
PrintAndLogEx(DEBUG, "Automatic chip type detection " _RED_("failed"));
}
return PM3_SUCCESS;
}

View File

@@ -1373,10 +1373,10 @@ static void printEM4x05config(uint32_t wordData) {
PrintAndLogEx(NORMAL, " PSK CF: %u | %s", PSKcf, cf);
PrintAndLogEx(NORMAL, " Delay: %u | %s", delay, cdelay);
PrintAndLogEx(NORMAL, " LastWordR: %02u | Address of last word for default read - meaning %u blocks are output", LWR, numblks);
PrintAndLogEx(NORMAL, " ReadLogin: %u | Read login is %s", readLogin, readLogin ? _YELLOW_("required") : _GREEN_("not required") );
PrintAndLogEx(NORMAL, " ReadHKL: %u | Read housekeeping words login is %s", readHKL, readHKL ? _YELLOW_("required") : _GREEN_("not required") );
PrintAndLogEx(NORMAL, "WriteLogin: %u | Write login is %s", writeLogin, writeLogin ? _YELLOW_("required") : _GREEN_("not required") );
PrintAndLogEx(NORMAL, " WriteHKL: %u | Write housekeeping words login is %s", writeHKL, writeHKL ? _YELLOW_("required") : _GREEN_("not Required") );
PrintAndLogEx(NORMAL, " ReadLogin: %u | Read login is %s", readLogin, readLogin ? _YELLOW_("required") : _GREEN_("not required"));
PrintAndLogEx(NORMAL, " ReadHKL: %u | Read housekeeping words login is %s", readHKL, readHKL ? _YELLOW_("required") : _GREEN_("not required"));
PrintAndLogEx(NORMAL, "WriteLogin: %u | Write login is %s", writeLogin, writeLogin ? _YELLOW_("required") : _GREEN_("not required"));
PrintAndLogEx(NORMAL, " WriteHKL: %u | Write housekeeping words login is %s", writeHKL, writeHKL ? _YELLOW_("required") : _GREEN_("not Required"));
PrintAndLogEx(NORMAL, " R.A.W.: %u | Read after write is %s", raw, raw ? "on" : "off");
PrintAndLogEx(NORMAL, " Disable: %u | Disable command is %s", disable, disable ? "accepted" : "not accepted");
PrintAndLogEx(NORMAL, " R.T.F.: %u | Reader talk first is %s", rtf, rtf ? _YELLOW_("enabled") : "disabled");
@@ -1396,7 +1396,7 @@ static void printEM4x05info(uint32_t block0, uint32_t serial) {
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4305");
break;
case 8:
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4205");
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4205");
break;
case 4:
snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "Unknown");

View File

@@ -2153,7 +2153,7 @@ bool tryDetectP1(bool getData) {
}
return false;
}
// try ask clock detect. it could be another type even if successful.
clk = GetAskClock("", false);
if (clk > 0) {
@@ -2162,14 +2162,14 @@ bool tryDetectP1(bool getData) {
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
st = true;
if ((ASKDemod_ext("0 1 1", false, false, 1, &st) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
if ((ASKbiphaseDemod("0 0 0 2", false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
@@ -2182,7 +2182,7 @@ bool tryDetectP1(bool getData) {
return true;
}
}
// try NRZ clock detect. it could be another type even if successful.
clk = GetNrzClock("", false); //has the most false positives :(
if (clk > 0) {

View File

@@ -314,7 +314,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
PrintAndLogEx(WARNING, "Is the add-on blue light blinking? (Say 'n' if you want to abort) [y/n]");
char input[3];
if ((fgets(input,sizeof(input),stdin) == NULL) || (strncmp(input, "y\n", sizeof(input)) != 0)) {
if ((fgets(input, sizeof(input), stdin) == NULL) || (strncmp(input, "y\n", sizeof(input)) != 0)) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(FAILED, "Aborting.");
return PM3_EOPABORTED;

View File

@@ -136,7 +136,7 @@ static void SendCommandNG_internal(uint16_t cmd, uint8_t *data, size_t len, bool
txBufferNG.pre.ng = ng;
txBufferNG.pre.length = len;
txBufferNG.pre.cmd = cmd;
if ( len > 0 && data )
if (len > 0 && data)
memcpy(&txBufferNG.data, data, len);
if ((conn.send_via_fpc_usart && conn.send_with_crc_on_fpc) || ((!conn.send_via_fpc_usart) && conn.send_with_crc_on_usb)) {

View File

@@ -6,18 +6,18 @@
#define SLEEP_H__
#ifdef _WIN32
#include <windows.h>
#define msleep(n) Sleep(n)
#include <windows.h>
#define msleep(n) Sleep(n)
#else
#include <time.h>
#include <errno.h>
static void nsleep(uint64_t n) {
struct timespec timeout;
timeout.tv_sec = n / 1000000000;
timeout.tv_nsec = n % 1000000000;
while (nanosleep(&timeout, &timeout) && errno == EINTR);
}
#define msleep(n) nsleep(1000000 * (uint64_t)n)
#include <time.h>
#include <errno.h>
static void nsleep(uint64_t n) {
struct timespec timeout;
timeout.tv_sec = n / 1000000000;
timeout.tv_nsec = n % 1000000000;
while (nanosleep(&timeout, &timeout) && errno == EINTR);
}
#define msleep(n) nsleep(1000000 * (uint64_t)n)
#endif
#endif

View File

@@ -347,7 +347,7 @@ static int wait_for_ack(PacketResponseNG *ack) {
}
// Go into flashing mode
int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t * chipinfo) {
int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t *chipinfo) {
uint32_t state;
if (enter_bootloader(serial_port_name) < 0)

View File

@@ -61,8 +61,7 @@ int kbd_enter_pressed(void) {
#include <conio.h>
int kbd_enter_pressed(void) {
int ret = 0;
while(kbhit())
{
while (kbhit()) {
ret |= getch() == '\r';
}
return ret;
@@ -178,8 +177,8 @@ bool CheckStringIsHEXValue(const char *value) {
void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len, const size_t hex_max_len,
const size_t min_str_len, const size_t spaces_between, bool uppercase) {
if (buf == NULL ) return;
if (buf == NULL) return;
char *tmp = (char *)buf;
size_t i;
memset(tmp, 0x00, hex_max_len);
@@ -205,16 +204,16 @@ void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex
// printing and converting functions
void print_hex(const uint8_t *data, const size_t len) {
if (data == NULL || len == 0 ) return;
if (data == NULL || len == 0) return;
for (size_t i = 0; i < len; i++)
printf("%02x ", data[i]);
printf("\n");
}
void print_hex_break(const uint8_t *data, const size_t len, uint8_t breaks) {
if (data == NULL || len == 0 ) return;
if (data == NULL || len == 0) return;
int rownum = 0;
printf("[%02d] | ", rownum);
for (size_t i = 0; i < len; ++i) {