changing {} style to match majority of previous style

This commit is contained in:
Philippe Teuwen 2019-03-10 11:20:22 +01:00
commit 961d929f4d
320 changed files with 5502 additions and 10485 deletions

View file

@ -15,8 +15,7 @@ static int CmdHelp(const char *Cmd);
static uint8_t *trace;
long traceLen = 0;
int usage_trace_list()
{
int usage_trace_list() {
PrintAndLogEx(NORMAL, "List protocol data in trace buffer.");
PrintAndLogEx(NORMAL, "Usage: trace list <protocol> [f][c| <0|1>");
PrintAndLogEx(NORMAL, " f - show frame delay times as well");
@ -43,16 +42,14 @@ int usage_trace_list()
PrintAndLogEx(NORMAL, " trace list iclass");
return 0;
}
int usage_trace_load()
{
int usage_trace_load() {
PrintAndLogEx(NORMAL, "Load protocol data from file to trace buffer.");
PrintAndLogEx(NORMAL, "Usage: trace load <filename>");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " trace load mytracefile.bin");
return 0;
}
int usage_trace_save()
{
int usage_trace_save() {
PrintAndLogEx(NORMAL, "Save protocol data from trace buffer to file.");
PrintAndLogEx(NORMAL, "Usage: trace save <filename>");
PrintAndLogEx(NORMAL, "Examples:");
@ -60,20 +57,17 @@ int usage_trace_save()
return 0;
}
bool is_last_record(uint16_t tracepos, uint8_t *trace, uint16_t traceLen)
{
bool is_last_record(uint16_t tracepos, uint8_t *trace, uint16_t traceLen) {
return (tracepos + sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t) >= traceLen);
}
bool next_record_is_response(uint16_t tracepos, uint8_t *trace)
{
bool next_record_is_response(uint16_t tracepos, uint8_t *trace) {
uint16_t next_records_datalen = *((uint16_t *)(trace + tracepos + sizeof(uint32_t) + sizeof(uint16_t)));
return (next_records_datalen & 0x8000);
}
bool merge_topaz_reader_frames(uint32_t timestamp, uint32_t *duration, uint16_t *tracepos, uint16_t traceLen,
uint8_t *trace, uint8_t *frame, uint8_t *topaz_reader_command, uint16_t *data_len)
{
uint8_t *trace, uint8_t *frame, uint8_t *topaz_reader_command, uint16_t *data_len) {
#define MAX_TOPAZ_READER_CMD_LEN 16
@ -110,8 +104,7 @@ bool merge_topaz_reader_frames(uint32_t timestamp, uint32_t *duration, uint16_t
return true;
}
uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, uint8_t protocol, bool showWaitCycles, bool markCRCBytes)
{
uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, uint8_t protocol, bool showWaitCycles, bool markCRCBytes) {
// sanity check
if (tracepos + sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t) > traceLen) return traceLen;
@ -197,10 +190,10 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
uint8_t parityBits = parityBytes[j >> 3];
if (protocol != LEGIC &&
protocol != ISO_14443B &&
protocol != ISO_7816_4 &&
(isResponse || protocol == ISO_14443A) &&
(oddparity8(frame[j]) != ((parityBits >> (7 - (j & 0x0007))) & 0x01))) {
protocol != ISO_14443B &&
protocol != ISO_7816_4 &&
(isResponse || protocol == ISO_14443A) &&
(oddparity8(frame[j]) != ((parityBits >> (7 - (j & 0x0007))) & 0x01))) {
snprintf(line[j / 18] + ((j % 18) * 4), 110, "%02x! ", frame[j]);
} else {
@ -311,8 +304,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
return tracepos;
}
void printFelica(uint16_t traceLen, uint8_t *trace)
{
void printFelica(uint16_t traceLen, uint8_t *trace) {
PrintAndLogEx(NORMAL, "ISO18092 / FeliCa - Timings are not as accurate");
PrintAndLogEx(NORMAL, " Gap | Src | Data | CRC | Annotation |");
@ -512,8 +504,7 @@ static int SanityOfflineCheck( bool useTraceBuffer ){
}
*/
int CmdTraceList(const char *Cmd)
{
int CmdTraceList(const char *Cmd) {
clearCommandBuffer();
@ -647,8 +638,7 @@ int CmdTraceList(const char *Cmd)
return 0;
}
int CmdTraceLoad(const char *Cmd)
{
int CmdTraceLoad(const char *Cmd) {
FILE *f = NULL;
char filename[FILE_PATH_SIZE];
@ -695,8 +685,7 @@ int CmdTraceLoad(const char *Cmd)
return 0;
}
int CmdTraceSave(const char *Cmd)
{
int CmdTraceSave(const char *Cmd) {
if (traceLen == 0) {
PrintAndLogEx(WARNING, "trace is empty, exiting...");
@ -720,15 +709,13 @@ static command_t CommandTable[] = {
{NULL, NULL, 0, NULL}
};
int CmdTrace(const char *Cmd)
{
int CmdTrace(const char *Cmd) {
clearCommandBuffer();
CmdsParse(CommandTable, Cmd);
return 0;
}
int CmdHelp(const char *Cmd)
{
int CmdHelp(const char *Cmd) {
CmdsHelp(CommandTable);
return 0;
}