make style

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

View file

@ -140,7 +140,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
uint16_t checker = 0;
while (true) {
if ( checker == 1000 ) {
if (checker == 1000) {
if (BUTTON_PRESS() || data_available())
break;
else
@ -296,8 +296,8 @@ void doT55x7Acquisition(size_t sample_size) {
uint16_t checker = 0;
while ( skipCnt < 1000 && (i < bufsize)) {
if ( checker == 1000 ) {
while (skipCnt < 1000 && (i < bufsize)) {
if (checker == 1000) {
if (BUTTON_PRESS() || data_available())
break;
else
@ -373,7 +373,7 @@ void doCotagAcquisition(size_t sample_size) {
uint16_t checker = 0;
while ((i < bufsize) && (noise_counter < (COTAG_T1 << 1))) {
if ( checker == 1000 ) {
if (checker == 1000) {
if (BUTTON_PRESS() || data_available())
break;
else
@ -433,7 +433,7 @@ uint32_t doCotagAcquisitionManchester() {
uint16_t checker = 0;
while ((sample_counter < bufsize) && (noise_counter < (COTAG_T1 << 1))) {
if ( checker == 1000 ) {
if (checker == 1000) {
if (BUTTON_PRESS() || data_available())
break;
else

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

@ -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");

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) {
#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)
}
#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,7 +177,7 @@ 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;
@ -205,7 +204,7 @@ 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]);
@ -213,7 +212,7 @@ void print_hex(const uint8_t *data, const size_t len) {
}
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);

View file

@ -1366,7 +1366,7 @@ int BiphaseRawDecode(uint8_t *bits, size_t *size, int *offset, int invert) {
//sanity check
if (*size < 51) return -1;
if ( *offset < 0 ) *offset = 0;
if (*offset < 0) *offset = 0;
uint16_t bitnum = 0;
uint16_t errCnt = 0;