eosnetworkfoundation / ledger-app

EOS app for ledger devices
Apache License 2.0
1 stars 0 forks source link

Remove Dead Code in eos_parse #5

Closed ericpassmore closed 2 years ago

ericpassmore commented 2 years ago

src/eos_parse.c:198:5: warning: Value stored to 'inLength' is never read [deadcode.DeadStores] inLength -= readFromBuffer;

ericpassmore commented 2 years ago

Removing inLength -= readFromBuffer; it is never read. From function below.

eos_parse.c:parseStringField(uint8_t *in, uint32_t inLength, const char fieldName[], actionArgument_t *arg, uint32_t *read, uint32_t *written)
ericpassmore commented 2 years ago

From looking at the code the inLength is not needed because fieldLength is used. This has been in place since the very first commit.

Note paseStringField called two times. First Instance

parseStringField(null, sizeof(null), "Parent", arg, &read, &written);

Second Instance

parseStringField(buffer, bufferLength, "Memo", arg, &read, &written);