From 86c049ad9504e7c31aee0f94498acfdcc5c14beb Mon Sep 17 00:00:00 2001 From: Wiktor Lawski Date: Mon, 3 Sep 2012 11:57:23 +0200 Subject: [PATCH] plugins: Improve code & comments formatting --- plugins/nfctype1.c | 12 +++++++----- plugins/nfctype4.c | 9 +++++---- src/ndef.c | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/nfctype1.c b/plugins/nfctype1.c index d21584c..c614697 100644 --- a/plugins/nfctype1.c +++ b/plugins/nfctype1.c @@ -189,7 +189,8 @@ out_err: return err; } -/* The dynamic read function: +/* + * The dynamic read function: * Bytes [0..3] : CC * [4..8]: TLV Lock ControlIT (0x01, 0x03, v1, V2, V3) * [9..13]: TLV Reserved Memory Control (0x02, 0x03, V1, V2, V3) @@ -213,9 +214,10 @@ static int read_dynamic_tag(uint8_t *cc, int length, void *data) pndef = pndef + 5; /* skip TLV Lock bits bytes */ pndef = pndef + 5; /* skip TLV ControlIT bytes */ - /* Save first NFC bytes to tag memory + /* + * Save first NFC bytes to tag memory * 10 blocks[0x3..0xC] of 8 bytes + 2 bytes from block 2 - * */ + */ memcpy(tagdata, pndef, 10 * BLOCK_SIZE + 2); /* Read the next one, up to the end of the data area */ @@ -297,7 +299,7 @@ static int meta_recv(uint8_t *resp, int length, void *data) t1_tag->tag = tag; memcpy(t1_tag->uid, cookie->uid, UID_LENGTH); - /*s Set the ReadWrite flag */ + /* Set the ReadWrite flag */ if (TAG_T1_WRITE_FLAG(cc) == TYPE1_NOWRITE_ACCESS) near_tag_set_ro(tag, TRUE); else @@ -621,7 +623,7 @@ static int nfctype1_write(uint32_t adapter_idx, uint32_t target_idx, return -EINVAL; /* This check is valid for only static tags. - * Max data length on Type 2 Tag including TLV's + * Max data length on Type 1 Tag including TLV's * is TYPE1_STATIC_MAX_DATA_SIZE */ if (near_tag_get_memory_layout(tag) == NEAR_TAG_MEMORY_STATIC) { if ((ndef->length + 3) > TYPE1_STATIC_MAX_DATA_SIZE) { diff --git a/plugins/nfctype4.c b/plugins/nfctype4.c index f9bb2aa..17cfc15 100644 --- a/plugins/nfctype4.c +++ b/plugins/nfctype4.c @@ -396,9 +396,10 @@ static int t4_readbin_NDEF_ID(uint8_t *resp, int length, void *data) else near_tag_set_ro(tag, FALSE); - /* TODO: see how we can get the UID value: + /* + * TODO: see how we can get the UID value: * near_tag_set_uid(tag, resp + NFC_HEADER_SIZE, 8); - * */ + */ /* Read 1st block */ err = ISO_ReadBinary(2, cookie->r_apdu_max_size - 2, @@ -647,7 +648,7 @@ static int nfctype4_read(uint32_t adapter_idx, cookie->target_idx = target_idx; cookie->cb = cb; cookie->tag = NULL; - cookie->read_data = 0;; + cookie->read_data = 0; /* Check for V2 type 4 tag */ err = ISO_Select(iso_appname_v2, ARRAY_SIZE(iso_appname_v2), @@ -816,7 +817,7 @@ static int nfctype4_check_presence(uint32_t adapter_idx, cookie->target_idx = target_idx; cookie->cb = cb; cookie->tag = NULL; - cookie->read_data = 0;; + cookie->read_data = 0; /* Check for V2 type 4 tag */ err = ISO_Select(iso_appname_v2, ARRAY_SIZE(iso_appname_v2), diff --git a/src/ndef.c b/src/ndef.c index e6c909d..2dd51e8 100644 --- a/src/ndef.c +++ b/src/ndef.c @@ -1552,9 +1552,9 @@ static struct near_ndef_ac_record *parse_ac_record(uint8_t *rec, /* Carrier data reference length */ ac_record->cdr_len = rec[offset]; + offset++; /* Carrier data reference */ - offset++; ac_record->cdr = rec[offset]; offset = offset + ac_record->cdr_len; -- 2.7.4