Remove useless casts.

This commit is contained in:
Carsten Otto
2015-07-04 20:45:07 +02:00
committed by Andreas Schildbach
parent c3c2916151
commit dbda2b9280
9 changed files with 19 additions and 19 deletions

View File

@@ -49,7 +49,7 @@ public class GetBlocksMessage extends Message {
int startCount = (int) readVarInt();
if (startCount > 500)
throw new ProtocolException("Number of locators cannot be > 500, received: " + startCount);
length = (int) (cursor - offset + ((startCount + 1) * 32));
length = cursor - offset + ((startCount + 1) * 32);
}
@Override

View File

@@ -90,7 +90,7 @@ public class TransactionSignature extends ECKey.ECDSASignature {
if (signature.length < 9 || signature.length > 73)
return false;
int hashType = signature[signature.length-1] & ((int)(~Transaction.SIGHASH_ANYONECANPAY_VALUE));
int hashType = signature[signature.length-1] & ~Transaction.SIGHASH_ANYONECANPAY_VALUE;
if (hashType < (Transaction.SigHash.ALL.ordinal() + 1) || hashType > (Transaction.SigHash.SINGLE.ordinal() + 1))
return false;

View File

@@ -667,10 +667,10 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
txOutChanges = bos.toByteArray();
} else {
int numTxn = undoableBlock.getTransactions().size();
bos.write((int) (0xFF & numTxn));
bos.write((int) (0xFF & (numTxn >> 8)));
bos.write((int) (0xFF & (numTxn >> 16)));
bos.write((int) (0xFF & (numTxn >> 24)));
bos.write(0xFF & numTxn);
bos.write(0xFF & (numTxn >> 8));
bos.write(0xFF & (numTxn >> 16));
bos.write(0xFF & (numTxn >> 24));
for (Transaction tx : undoableBlock.getTransactions())
tx.bitcoinSerialize(bos);
transactions = bos.toByteArray();

View File

@@ -180,10 +180,10 @@ public class PostgresFullPrunedBlockStore extends DatabaseFullPrunedBlockStore {
txOutChanges = bos.toByteArray();
} else {
int numTxn = undoableBlock.getTransactions().size();
bos.write((int) (0xFF & numTxn));
bos.write((int) (0xFF & (numTxn >> 8)));
bos.write((int) (0xFF & (numTxn >> 16)));
bos.write((int) (0xFF & (numTxn >> 24)));
bos.write(0xFF & numTxn);
bos.write(0xFF & (numTxn >> 8));
bos.write(0xFF & (numTxn >> 16));
bos.write(0xFF & (numTxn >> 24));
for (Transaction tx : undoableBlock.getTransactions())
tx.bitcoinSerialize(bos);
transactions = bos.toByteArray();

View File

@@ -1380,7 +1380,7 @@ public abstract class BtcFormat extends Format {
*/
protected static void prefixUnitsIndicator(DecimalFormat numberFormat, int scale) {
assert Thread.holdsLock(numberFormat); // make sure caller intends to reset before changing
DecimalFormatSymbols fs = (DecimalFormatSymbols)numberFormat.getDecimalFormatSymbols();
DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
setSymbolAndCode(numberFormat,
prefixSymbol(fs.getCurrencySymbol(), scale), prefixCode(fs.getInternationalCurrencySymbol(), scale)
);

View File

@@ -329,7 +329,7 @@ public class PeerGroupTest extends TestWithPeerGroup {
inbound(p1, b1);
// Now we successfully connect to another peer. There should be no messages sent.
InboundMessageQueuer p2 = connectPeer(2);
Message message = (Message)outbound(p2);
Message message = outbound(p2);
assertNull(message == null ? "" : message.toString(), message);
}

View File

@@ -80,10 +80,10 @@ public class TransactionBroadcastTest extends TestWithPeerGroup {
// We expect two peers to receive a tx message, and at least one of the others must announce for the future to
// complete successfully.
Message[] messages = {
(Message) outbound(channels[0]),
(Message) outbound(channels[1]),
(Message) outbound(channels[2]),
(Message) outbound(channels[3])
outbound(channels[0]),
outbound(channels[1]),
outbound(channels[2]),
outbound(channels[3])
};
// 0 and 3 are randomly selected to receive the broadcast.
assertEquals(tx, messages[0]);
@@ -250,6 +250,6 @@ public class TransactionBroadcastTest extends TestWithPeerGroup {
// Add the wallet to the peer group (simulate initialization). Transactions should be announced.
peerGroup.addWallet(wallet);
// Transaction announced to the first peer. No extra Bloom filter because no change address was needed.
assertEquals(t3.getHash(), ((Transaction) outbound(p1)).getHash());
assertEquals(t3.getHash(), outbound(p1).getHash());
}
}

View File

@@ -69,7 +69,7 @@ public class NetworkAbstractionTests {
channels.openConnection(addr, parser);
if (parser.writeTarget.get() == null)
Thread.sleep(100);
return (MessageWriteTarget) parser.writeTarget.get();
return parser.writeTarget.get();
} else if (clientType == 2)
return new NioClient(addr, parser, 100);
else if (clientType == 3)

View File

@@ -314,7 +314,7 @@ public class BitcoinURITest {
+ "?aardvark=true");
assertEquals("BitcoinURI['aardvark'='true','address'='1KzTSfqjF2iKCduwz59nv2uqh1W2JsTxZH']", testObject.toString());
assertEquals("true", (String) testObject.getParameterByName("aardvark"));
assertEquals("true", testObject.getParameterByName("aardvark"));
// Unknown not required field (isolated)
try {