Skip to content

Commit

Permalink
static fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
merlokk committed Jun 14, 2021
1 parent bbd2e19 commit 5e5080f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions libs/stm32fs/stm32fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,15 @@ bool Stm32fs::FileExist(std::string_view fileName) {

int Stm32fs::FileLength(std::string_view fileName) {
if (!CheckValid())
return false;
return -1;

Stm32FSFileHeader header = SearchFileHeader(fileName);
if (header.FileState != fsFileHeader)
return -1;
return -2;

Stm32FSFileVersion ver = SearchFileVersion(header.FileID);
if (ver.FileState != fsFileVersion)
return -2;
return -3;

return ver.FileSize;
}
Expand Down
24 changes: 12 additions & 12 deletions src/applications/openpgp/openpgpstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ struct ApplicationState {
};

struct ApplicationConfig {
LifeCycleState state;
LifeCycleState state = LifeCycleState::NoInfo;

Util::Error Load(File::FileSystem &fs);
Util::Error Save(File::FileSystem &fs);
};

struct __attribute__ ((packed)) PWStatusBytes {
uint8_t PW1ValidSeveralCDS;
uint8_t MaxLengthAndFormatPW1;
uint8_t MaxLengthRCforPW1;
uint8_t MaxLengthAndFormatPW3;
uint8_t ErrorCounterPW1;
uint8_t ErrorCounterRC;
uint8_t ErrorCounterPW3;
uint8_t PW1ValidSeveralCDS = 0;
uint8_t MaxLengthAndFormatPW1 = 0;
uint8_t MaxLengthRCforPW1 = 0;
uint8_t MaxLengthAndFormatPW3 = 0;
uint8_t ErrorCounterPW1 = 0;
uint8_t ErrorCounterRC = 0;
uint8_t ErrorCounterPW3 = 0;

void DecErrorCounter(Password passwdId);
uint8_t PasswdTryRemains(Password passwdId);
Expand All @@ -67,9 +67,9 @@ struct __attribute__ ((packed)) PWStatusBytes {

// Open PGP 3.3.1 page 31
struct RSAAlgorithmAttr {
uint16_t NLen; // modulus length in bit
uint16_t PubExpLen; // public exponent length in bits
uint8_t KeyFormat; // Crypto::RSAKeyImportFormat. Import-Format of private key
uint16_t NLen = 0; // modulus length in bit
uint16_t PubExpLen = 0; // public exponent length in bits
uint8_t KeyFormat = 0; // Crypto::RSAKeyImportFormat. Import-Format of private key

void clear() {
NLen = 0x0000;
Expand Down Expand Up @@ -97,7 +97,7 @@ struct AlgoritmAttr {

uint8_t AlgorithmID = 0; // Crypto::AlgoritmID
RSAAlgorithmAttr RSAa = {0};
ECDSAAlgorithmAttr ECDSAa = {0};
ECDSAAlgorithmAttr ECDSAa = {{0}};

void Clear();
Util::Error DecodeData(bstr &vdata, KeyID_t key_id);
Expand Down
2 changes: 1 addition & 1 deletion src/tlv.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class TLVTree {
}

constexpr bool GoChild() {
if (currLevel >= MaxTreeLevel - 1 || !_elm[currLevel].IsConstructed())
if ((currLevel >= MaxTreeLevel - 1) || !_elm[currLevel].IsConstructed())
return false;

bstr data = _elm[currLevel].GetData();
Expand Down

0 comments on commit 5e5080f

Please sign in to comment.