Skip to content

Commit

Permalink
CORE-551: Address static analysis issues (#1).
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Gamble committed Sep 12, 2019
1 parent 19e2427 commit f987c67
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion crypto/BRCryptoWallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ cryptoWalletGetDefaultFeeBasis (BRCryptoWallet wallet) {
BRWallet *wid = wallet->u.btc.wid;

assert (0); // TODO: Generic Size not 1000
feeBasis = cryptoFeeBasisCreateAsBTC (feeUnit, BRWalletFeePerKb (wid), 1000);
feeBasis = cryptoFeeBasisCreateAsBTC (feeUnit, (uint32_t) BRWalletFeePerKb (wid), 1000);
break;
}
case BLOCK_CHAIN_TYPE_ETH: {
BREthereumEWM ewm = wallet->u.eth.ewm;
Expand All @@ -389,13 +390,15 @@ cryptoWalletGetDefaultFeeBasis (BRCryptoWallet wallet) {
BREthereumGasPrice gasPrice = ewmWalletGetDefaultGasPrice (ewm, wid);

feeBasis = cryptoFeeBasisCreateAsETH (feeUnit, gas, gasPrice);
break;
}
case BLOCK_CHAIN_TYPE_GEN: {
BRGenericWalletManager gwm = wallet->u.gen.gwm;
BRGenericWallet wid = wallet->u.gen.wid;

BRGenericFeeBasis bid = gwmWalletGetDefaultFeeBasis (gwm, wid);
feeBasis = cryptoFeeBasisCreateAsGEN (feeUnit, gwm, bid);
break;
}
}

Expand Down
3 changes: 2 additions & 1 deletion crypto/BRCryptoWalletManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@ cryptoWalletManagerSubmit (BRCryptoWalletManager cwm,
cryptoTransferAsGEN (transfer),
seed);

seed = UINT512_ZERO;
seed = UINT512_ZERO; (void) &seed;

break;
}
}
Expand Down
8 changes: 7 additions & 1 deletion crypto/BRCryptoWalletManagerClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,10 @@ cwmStateFromETH (BREthereumEWMState state) {
}
}

#pragma clang diagnostic push
#pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-function"
static BREthereumEWMState
cwmStateAsETH (BRCryptoWalletManagerState state) {
switch (state) {
Expand All @@ -768,6 +772,8 @@ cwmStateAsETH (BRCryptoWalletManagerState state) {
case CRYPTO_WALLET_MANAGER_STATE_DELETED: return EWM_STATE_DELETED;
}
}
#pragma clang diagnostic pop
#pragma GCC diagnostic pop

static void
cwmWalletManagerEventAsETH (BREthereumClientContext context,
Expand Down Expand Up @@ -1148,7 +1154,7 @@ cwmTransactionEventAsETH (BREthereumClientContext context,

// We'll transition from `oldState` to `newState`; get some placeholder values in place.
BRCryptoTransferState oldState = { CRYPTO_TRANSFER_STATE_CREATED };
BRCryptoTransferState newState = { CRYPTO_TRANSFER_STATE_CREATED };
BRCryptoTransferState newState = { CRYPTO_TRANSFER_STATE_CREATED }; (void) &newState;
if (NULL != transfer) oldState = cryptoTransferGetState (transfer);

switch (event.type) {
Expand Down
5 changes: 3 additions & 2 deletions ethereum/bcs/BREthereumBCS.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,11 @@ bcsCreate (BREthereumNetwork network,
chainHeader = blockCheckpointCreatePartialBlockHeader(checkpoint);
}

#if defined (LES_DISABLE_DISCOVERY)
BREthereumBoolean discoverNodes = ETHEREUM_BOOLEAN_FALSE;
#else
// There is no need to discover nodes if we are in BRD_ONLY mode.
BREthereumBoolean discoverNodes = AS_ETHEREUM_BOOLEAN (mode != SYNC_MODE_BRD_ONLY);
#if defined (LES_DISABLE_DISCOVERY)
discoverNodes = ETHEREUM_BOOLEAN_FALSE;
#endif

BREthereumBoolean handleSync = AS_ETHEREUM_BOOLEAN (SYNC_MODE_P2P_ONLY == mode ||
Expand Down

0 comments on commit f987c67

Please sign in to comment.