Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Aug 22, 2024
1 parent 204c23d commit bd85e73
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions app/src/items.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ char base64_hash[45];
items_error_t items_initItems() {
MEMZERO(&item_array, sizeof(item_array_t));

item_array.numOfUnknownCapabitilies = 1;
item_array.numOfUnknownCapabilities = 1;

for (uint8_t i = 0; i < sizeof(item_array.items) / sizeof(item_array.items[0]); i++) {
for (uint8_t i = 0; i < MAX_NUMBER_OF_ITEMS; i++) {
item_array.items[i].can_display = bool_true;
}

Expand Down Expand Up @@ -412,8 +412,8 @@ static items_error_t items_storeGasItem(uint16_t json_token_index) {
PARSER_TO_ITEMS_ERROR(array_get_element_count(json_all, token_index, &args_count));

if (args_count > 0) {
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabitilies);
item_array.numOfUnknownCapabitilies++;
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabilities);
item_array.numOfUnknownCapabilities++;
item_array.toString[item_array.numOfItems] = items_unknownCapabilityToDisplayString;
} else {
strcpy(item->key, "Paying Gas");
Expand All @@ -437,8 +437,8 @@ static items_error_t items_storeTxItem(parsed_json_t *json_all, uint16_t transfe
(*num_of_transfers)++;
item_array.toString[item_array.numOfItems] = items_transferToDisplayString;
} else {
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabitilies);
item_array.numOfUnknownCapabitilies++;
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabilities);
item_array.numOfUnknownCapabilities++;
item_array.toString[item_array.numOfItems] = items_unknownCapabilityToDisplayString;

if (num_of_args > 5 ||
Expand All @@ -465,8 +465,8 @@ static items_error_t items_storeTxCrossItem(parsed_json_t *json_all, uint16_t tr
(*num_of_transfers)++;
item_array.toString[item_array.numOfItems] = items_crossTransferToDisplayString;
} else {
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabitilies);
item_array.numOfUnknownCapabitilies++;
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabilities);
item_array.numOfUnknownCapabilities++;
item_array.toString[item_array.numOfItems] = items_unknownCapabilityToDisplayString;

if (num_of_args > 5 ||
Expand All @@ -491,8 +491,8 @@ static items_error_t items_storeTxRotateItem(parsed_json_t *json_all, uint16_t t
snprintf(item->key, sizeof(item->key), "Rotate for account");
item_array.toString[item_array.numOfItems] = items_rotateToDisplayString;
} else {
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabitilies);
item_array.numOfUnknownCapabitilies++;
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabilities);
item_array.numOfUnknownCapabilities++;
item_array.toString[item_array.numOfItems] = items_unknownCapabilityToDisplayString;

if (num_of_args > 5 ||
Expand All @@ -513,8 +513,8 @@ static items_error_t items_storeUnknownItem(parsed_json_t *json_all, uint16_t tr

PARSER_TO_ITEMS_ERROR(array_get_element_count(json_all, token_index, &num_of_args));

snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabitilies);
item_array.numOfUnknownCapabitilies++;
snprintf(item->key, sizeof(item->key), "Unknown Capability %d", item_array.numOfUnknownCapabilities);
item_array.numOfUnknownCapabilities++;
item_array.toString[item_array.numOfItems] = items_unknownCapabilityToDisplayString;

if (num_of_args > 5 ||
Expand Down
2 changes: 1 addition & 1 deletion app/src/items_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ typedef enum {
typedef struct {
item_t items[MAX_NUMBER_OF_ITEMS];
uint8_t numOfItems;
uint8_t numOfUnknownCapabitilies;
uint8_t numOfUnknownCapabilities;
items_error_t (*toString[MAX_NUMBER_OF_ITEMS])(item_t item, char *outVal, uint16_t outValLen);
} item_array_t;
2 changes: 1 addition & 1 deletion app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ parser_error_t parser_parse(parser_context_t *ctx, const uint8_t *data, size_t d
CHECK_ERROR(parser_init_context(ctx, data, dataLen))
ctx->tx_obj = tx_obj;

CHECK_ERROR(_read_json_tx(ctx, tx_obj));
CHECK_ERROR(_read_json_tx(ctx));

ITEMS_TO_PARSER_ERROR(items_initItems());
ITEMS_TO_PARSER_ERROR(items_storeItems());
Expand Down
4 changes: 2 additions & 2 deletions app/src/parser_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

tx_json_t *parser_tx_obj;

parser_error_t _read_json_tx(parser_context_t *c, tx_json_t *v) {
parser_tx_obj = v;
parser_error_t _read_json_tx(parser_context_t *c) {
parser_tx_obj = c->tx_obj;

CHECK_ERROR(json_parse(&(parser_tx_obj->json), (const char *)c->buffer, c->bufferLen));

Expand Down
2 changes: 1 addition & 1 deletion app/src/parser_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef struct {
tx_json_t *tx_obj;
} parser_context_t;

parser_error_t _read_json_tx(parser_context_t *c, tx_json_t *v);
parser_error_t _read_json_tx(parser_context_t *c);
tx_json_t *parser_getParserTxObj();
parser_error_t parser_findPubKeyInClist(uint16_t key_token_index);
parser_error_t parser_arrayElementToString(uint16_t json_token_index, uint16_t element_idx, char *outVal,
Expand Down

1 comment on commit bd85e73

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format reports: 1 file(s) not formatted
  • app/src/items_format.c

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.