make style

This commit is contained in:
Philippe Teuwen 2020-06-19 18:34:47 +02:00
commit f69739da79
16 changed files with 62 additions and 63 deletions

View file

@ -19,7 +19,7 @@ extern uint8_t _stack_start, __bss_end__;
// BigBuf is the large multi-purpose buffer, typically used to hold A/D samples or traces. // BigBuf is the large multi-purpose buffer, typically used to hold A/D samples or traces.
// Also used to hold various smaller buffers and the Mifare Emulator Memory. // Also used to hold various smaller buffers and the Mifare Emulator Memory.
// We know that bss is aligned to 4 bytes. // We know that bss is aligned to 4 bytes.
static uint8_t* BigBuf = &__bss_end__; static uint8_t *BigBuf = &__bss_end__;
/* BigBuf memory layout: /* BigBuf memory layout:
Pointer to highest available memory: BigBuf_hi Pointer to highest available memory: BigBuf_hi

View file

@ -2080,7 +2080,7 @@ void __attribute__((noreturn)) AppMain(void) {
SpinDelay(100); SpinDelay(100);
BigBuf_initialize(); BigBuf_initialize();
for (uint32_t * p = &_stack_start; p < (uint32_t *)((uintptr_t)&_stack_end - 0x200); ++p) { for (uint32_t *p = &_stack_start; p < (uint32_t *)((uintptr_t)&_stack_end - 0x200); ++p) {
*p = 0xdeadbeef; *p = 0xdeadbeef;
} }

View file

@ -19,7 +19,7 @@
#include "cmd.h" #include "cmd.h"
static void RAMFUNC optimizedSniff(uint16_t *dest, uint16_t dsize) { static void RAMFUNC optimizedSniff(uint16_t *dest, uint16_t dsize) {
for (;dsize > 0; dsize -= sizeof(dsize)) { for (; dsize > 0; dsize -= sizeof(dsize)) {
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) { if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
*dest = (uint16_t)(AT91C_BASE_SSC->SSC_RHR); *dest = (uint16_t)(AT91C_BASE_SSC->SSC_RHR);
dest++; dest++;
@ -95,7 +95,7 @@ int HfSniff(uint32_t samplesToSkip, uint32_t triggersToSkip, uint16_t *len) {
waitcount--; waitcount--;
} }
optimizedSniff((uint16_t*)mem, (*len) >> 2); optimizedSniff((uint16_t *)mem, (*len) >> 2);
Dbprintf("Trigger kicked in (%d >= 180)", r); Dbprintf("Trigger kicked in (%d >= 180)", r);
} }

View file

@ -258,7 +258,7 @@ int CmdHFSniff(const char *Cmd) {
params.triggersToSkip = param_get32ex(Cmd, 1, 0, 10); params.triggersToSkip = param_get32ex(Cmd, 1, 0, 10);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_HF_SNIFF, (uint8_t*)&params, sizeof(params)); SendCommandNG(CMD_HF_SNIFF, (uint8_t *)&params, sizeof(params));
for (;;) { for (;;) {

View file

@ -1014,7 +1014,7 @@ int EM4x50Read(const char *Cmd, bool verbose) {
PrintAndLogEx(INFO, "%03d | %08x", block, Code[block]); PrintAndLogEx(INFO, "%03d | %08x", block, Code[block]);
} }
PrintAndLogEx(INFO, "----+--------------"); PrintAndLogEx(INFO, "----+--------------");
PrintAndLogEx( (AllPTest) ? SUCCESS : WARNING, "Parities checks | %s", (AllPTest) ? _GREEN_("Passed") : _RED_("Fail")); PrintAndLogEx((AllPTest) ? SUCCESS : WARNING, "Parities checks | %s", (AllPTest) ? _GREEN_("Passed") : _RED_("Fail"));
if (AllPTest == false) { if (AllPTest == false) {
PrintAndLogEx(HINT, "Try cleaning the read samples with " _YELLOW_("'data askedge'")); PrintAndLogEx(HINT, "Try cleaning the read samples with " _YELLOW_("'data askedge'"));

View file

@ -36,8 +36,7 @@
// Partly ripped from PyRun_SimpleFileExFlags // Partly ripped from PyRun_SimpleFileExFlags
// but does not terminate client on sys.exit // but does not terminate client on sys.exit
// and print exit code only if != 0 // and print exit code only if != 0
static int Pm3PyRun_SimpleFileNoExit(FILE *fp, const char *filename) static int Pm3PyRun_SimpleFileNoExit(FILE *fp, const char *filename) {
{
PyObject *m, *d, *v; PyObject *m, *d, *v;
int set_file_name = 0, ret = -1; int set_file_name = 0, ret = -1;
m = PyImport_AddModule("__main__"); m = PyImport_AddModule("__main__");
@ -86,7 +85,7 @@ static int Pm3PyRun_SimpleFileNoExit(FILE *fp, const char *filename)
} }
Py_DECREF(v); Py_DECREF(v);
ret = 0; ret = 0;
done: done:
if (set_file_name && PyDict_DelItemString(d, "__file__")) if (set_file_name && PyDict_DelItemString(d, "__file__"))
PyErr_Clear(); PyErr_Clear();
Py_XDECREF(m); Py_XDECREF(m);

View file

@ -1455,7 +1455,7 @@ static int CmdEMVScan(const char *Cmd) {
// current path + file name // current path + file name
if (MergeJSON) { if (MergeJSON) {
root = json_load_file( (char*)filename, 0, &error); root = json_load_file((char *)filename, 0, &error);
if (!root) { if (!root) {
PrintAndLogEx(ERR, "Json error on line %d: %s", error.line, error.text); PrintAndLogEx(ERR, "Json error on line %d: %s", error.line, error.text);
return PM3_EFILE; return PM3_EFILE;
@ -1750,15 +1750,15 @@ static int CmdEMVScan(const char *Cmd) {
if (MergeJSON == false) { if (MergeJSON == false) {
// create unique new name // create unique new name
char *fname = newfilenamemcopy((char*)filename, ".json"); char *fname = newfilenamemcopy((char *)filename, ".json");
if (fname == NULL) { if (fname == NULL) {
return PM3_EMALLOC; return PM3_EMALLOC;
} }
strcpy((char*)filename, fname); strcpy((char *)filename, fname);
free(fname); free(fname);
} }
res = json_dump_file(root, (char*)filename, JSON_INDENT(2)); res = json_dump_file(root, (char *)filename, JSON_INDENT(2));
if (res) { if (res) {
PrintAndLogEx(ERR, "Can't save the file: %s", filename); PrintAndLogEx(ERR, "Can't save the file: %s", filename);
return PM3_EFILE; return PM3_EFILE;

View file

@ -1369,8 +1369,8 @@ static int convert_plain_mfu_dump(uint8_t **dump, size_t *dumplen, bool verbose)
} }
static int convert_old_mfu_dump(uint8_t **dump, size_t *dumplen, bool verbose) { static int convert_old_mfu_dump(uint8_t **dump, size_t *dumplen, bool verbose) {
/* For reference /* For reference
typedef struct { typedef struct {
uint8_t version[8]; uint8_t version[8];
uint8_t tbo[2]; uint8_t tbo[2];
uint8_t tearing[3]; uint8_t tearing[3];
@ -1378,8 +1378,8 @@ typedef struct {
uint8_t tbo1[1]; uint8_t tbo1[1];
uint8_t signature[32]; uint8_t signature[32];
uint8_t data[1024]; uint8_t data[1024];
} PACKED old_mfu_dump_t; } PACKED old_mfu_dump_t;
*/ */
// convert old format // convert old format
old_mfu_dump_t *old_mfu_dump = (old_mfu_dump_t *)*dump; old_mfu_dump_t *old_mfu_dump = (old_mfu_dump_t *)*dump;

View file

@ -882,7 +882,7 @@ void mifare_cypher_blocks_chained(desfiretag_t tag, desfirekey_t key, uint8_t *i
} }
void desfire_crc32(const uint8_t *data, const size_t len, uint8_t *crc) { void desfire_crc32(const uint8_t *data, const size_t len, uint8_t *crc) {
crc32_ex(data,len,crc); crc32_ex(data, len, crc);
} }
void desfire_crc32_append(uint8_t *data, const size_t len) { void desfire_crc32_append(uint8_t *data, const size_t len) {