Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 131fa56b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Replace uses of libcore.io.SizeOf with X.BYTES."

parents ca046e89 c2c7ee19
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import static java.nio.ByteOrder.BIG_ENDIAN;

import android.system.OsConstants;
import android.util.Log;
import libcore.io.SizeOf;

import java.net.Inet4Address;
import java.net.Inet6Address;
+1 −3
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.net.netlink;

import libcore.io.SizeOf;

import java.nio.ByteBuffer;


@@ -29,7 +27,7 @@ import java.nio.ByteBuffer;
 * @hide
 */
public class StructNfGenMsg {
    public static final int STRUCT_SIZE = 2 + SizeOf.SHORT;
    public static final int STRUCT_SIZE = 2 + Short.BYTES;

    public static final int NFNETLINK_V0 = 0;

+3 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.net.netlink;

import android.net.netlink.NetlinkConstants;
import libcore.io.SizeOf;

import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -117,7 +116,7 @@ public class StructNlAttr {
    public StructNlAttr(short type, short value, ByteOrder order) {
        this(order);
        nla_type = type;
        setValue(new byte[SizeOf.SHORT]);
        setValue(new byte[Short.BYTES]);
        getValueAsByteBuffer().putShort(value);
    }

@@ -128,7 +127,7 @@ public class StructNlAttr {
    public StructNlAttr(short type, int value, ByteOrder order) {
        this(order);
        nla_type = type;
        setValue(new byte[SizeOf.INT]);
        setValue(new byte[Integer.BYTES]);
        getValueAsByteBuffer().putInt(value);
    }

@@ -164,7 +163,7 @@ public class StructNlAttr {

    public int getValueAsInt(int defaultValue) {
        final ByteBuffer byteBuffer = getValueAsByteBuffer();
        if (byteBuffer == null || byteBuffer.remaining() != SizeOf.INT) {
        if (byteBuffer == null || byteBuffer.remaining() != Integer.BYTES) {
            return defaultValue;
        }
        return getValueAsByteBuffer().getInt();
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.net.netlink;

import android.net.netlink.NetlinkConstants;
import android.net.netlink.StructNlMsgHdr;
import libcore.io.SizeOf;

import java.nio.ByteBuffer;

@@ -31,7 +30,7 @@ import java.nio.ByteBuffer;
 * @hide
 */
public class StructNlMsgErr {
    public static final int STRUCT_SIZE = SizeOf.INT + StructNlMsgHdr.STRUCT_SIZE;
    public static final int STRUCT_SIZE = Integer.BYTES + StructNlMsgHdr.STRUCT_SIZE;

    public static boolean hasAvailableSpace(ByteBuffer byteBuffer) {
        return byteBuffer != null && byteBuffer.remaining() >= STRUCT_SIZE;