Merge "Replace uses of libcore.io.SizeOf with X.BYTES." am: 131fa56b4f am: acba653204
am: b07e48e159
Change-Id: I2bfb7c6ed65b77ed772fc9567734fd6737d872e7
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user