Use getInt() in a couple more places.

This commit is contained in:
akwizgran
2023-02-20 11:33:48 +00:00
parent 98064e9efe
commit 0ced10b3a9
4 changed files with 4 additions and 4 deletions

View File

@@ -73,7 +73,7 @@ class PayloadParserImpl implements PayloadParser {
List<TransportDescriptor> recognised = new ArrayList<>(); List<TransportDescriptor> recognised = new ArrayList<>();
for (int i = 1; i < payload.size(); i++) { for (int i = 1; i < payload.size(); i++) {
BdfList descriptor = payload.getList(i); BdfList descriptor = payload.getList(i);
long transportId = descriptor.getLong(0); int transportId = descriptor.getInt(0);
if (transportId == TRANSPORT_ID_BLUETOOTH) { if (transportId == TRANSPORT_ID_BLUETOOTH) {
TransportId id = BluetoothConstants.ID; TransportId id = BluetoothConstants.ID;
recognised.add(new TransportDescriptor(id, descriptor)); recognised.add(new TransportDescriptor(id, descriptor));

View File

@@ -217,7 +217,7 @@ public class LanTcpPluginTest extends BrambleTestCase {
// The plugin should have bound a socket and stored the port number // The plugin should have bound a socket and stored the port number
BdfList descriptor = kal.getDescriptor(); BdfList descriptor = kal.getDescriptor();
assertEquals(3, descriptor.size()); assertEquals(3, descriptor.size());
assertEquals(TRANSPORT_ID_LAN, descriptor.getLong(0).longValue()); assertEquals(TRANSPORT_ID_LAN, descriptor.getInt(0).intValue());
byte[] address = descriptor.getRaw(1); byte[] address = descriptor.getRaw(1);
InetAddress addr = InetAddress.getByAddress(address); InetAddress addr = InetAddress.getByAddress(address);
assertTrue(addr instanceof Inet4Address); assertTrue(addr instanceof Inet4Address);

View File

@@ -76,7 +76,7 @@ class AvatarValidator implements MessageValidator {
// 0.0: Message Type, Version, Content-Type // 0.0: Message Type, Version, Content-Type
checkSize(body, 3); checkSize(body, 3);
// Message Type // Message Type
long messageType = body.getLong(0); long messageType = body.getInt(0);
if (messageType != MSG_TYPE_UPDATE) throw new FormatException(); if (messageType != MSG_TYPE_UPDATE) throw new FormatException();
// Version // Version
long version = body.getLong(1); long version = body.getLong(1);

View File

@@ -366,7 +366,7 @@ class PrivateGroupManagerImpl extends BdfIncomingMessageHook
// parse the metadata // parse the metadata
for (Entry<MessageId, BdfDictionary> entry : metadata.entrySet()) { for (Entry<MessageId, BdfDictionary> entry : metadata.entrySet()) {
BdfDictionary meta = entry.getValue(); BdfDictionary meta = entry.getValue();
if (meta.getLong(KEY_TYPE) == JOIN.getInt()) { if (meta.getInt(KEY_TYPE) == JOIN.getInt()) {
headers.add(getJoinMessageHeader(txn, g, entry.getKey(), headers.add(getJoinMessageHeader(txn, g, entry.getKey(),
meta, authorInfos)); meta, authorInfos));
} else { } else {