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 23, 2019
1 parent 2797add commit d7dde7f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Swift/BRCrypto/common/BRBlockChainDB.swift
Expand Up @@ -918,7 +918,7 @@ public class BlockChainDB {
.flatMap { BlockChainDB.getManyExpected(data: $0, transform: Model.asBlock) }
.recover { error = $0; return [] }.get()

if let moreURL = more, nil == error {
if let _ = more, nil == error {
moreResults = true
begBlockNumber = results.reduce(0) {
max ($0, $1.height)
Expand Down Expand Up @@ -1101,7 +1101,7 @@ public class BlockChainDB {
completion: @escaping (Result<String,QueryError>) -> Void) {
let json: JSON.Dict = [ "id" : ridIncr ]

var queryDict = [
let queryDict = [
"module" : "account",
"action" : "tokenbalance",
"address" : address,
Expand Down Expand Up @@ -1170,7 +1170,7 @@ public class BlockChainDB {
"account" : address,
"id" : ridIncr ]

var queryDict = [
let queryDict = [
"module" : "account",
"action" : "txlist",
"address" : address,
Expand Down
5 changes: 4 additions & 1 deletion crypto/BRCryptoWallet.c
Expand Up @@ -363,7 +363,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 @@ -373,13 +374,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
19 changes: 10 additions & 9 deletions crypto/BRCryptoWalletManager.c
Expand Up @@ -546,14 +546,14 @@ cryptoWalletManagerInstallETHTokensForCurrencies (BRCryptoWalletManager cwm) {
// Argubably EWM should create a wallet for the token. But, it doesn't.
// So we'll call `ewmGetWalletHoldingToken()` to get a wallet.

BREthereumToken token = ewmCreateToken (cwm->u.eth,
address,
cryptoCurrencyGetCode (c),
cryptoCurrencyGetName(c),
cryptoCurrencyGetUids(c), // description
cryptoUnitGetBaseDecimalOffset(unitDefault),
ethGasLimit,
ethGasPrice);
ewmCreateToken (cwm->u.eth,
address,
cryptoCurrencyGetCode (c),
cryptoCurrencyGetName(c),
cryptoCurrencyGetUids(c), // description
cryptoUnitGetBaseDecimalOffset(unitDefault),
ethGasLimit,
ethGasPrice);
}
break;
}
Expand Down Expand Up @@ -720,7 +720,8 @@ cryptoWalletManagerSubmit (BRCryptoWalletManager cwm,
cryptoTransferAsGEN (transfer),
seed);

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

break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions ethereum/bcs/BREthereumBCS.c
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 d7dde7f

Please sign in to comment.