mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8272626: Avoid C-style array declarations in java.*
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
e8f1219d6f
commit
30b0f820ce
54 changed files with 140 additions and 140 deletions
|
@ -80,7 +80,7 @@ class DatagramPacket {
|
|||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int offset, int length) {
|
||||
public DatagramPacket(byte[] buf, int offset, int length) {
|
||||
setData(buf, offset, length);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ class DatagramPacket {
|
|||
* or if the length is greater than the length of the
|
||||
* packet's given buffer.
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int length) {
|
||||
public DatagramPacket(byte[] buf, int length) {
|
||||
this (buf, 0, length);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ class DatagramPacket {
|
|||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int offset, int length,
|
||||
public DatagramPacket(byte[] buf, int offset, int length,
|
||||
InetAddress address, int port) {
|
||||
setData(buf, offset, length);
|
||||
setAddress(address);
|
||||
|
@ -152,7 +152,7 @@ class DatagramPacket {
|
|||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int offset, int length, SocketAddress address) {
|
||||
public DatagramPacket(byte[] buf, int offset, int length, SocketAddress address) {
|
||||
setData(buf, offset, length);
|
||||
setSocketAddress(address);
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ class DatagramPacket {
|
|||
*
|
||||
* @see java.net.InetAddress
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int length,
|
||||
public DatagramPacket(byte[] buf, int length,
|
||||
InetAddress address, int port) {
|
||||
this(buf, 0, length, address, port);
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ class DatagramPacket {
|
|||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public DatagramPacket(byte buf[], int length, SocketAddress address) {
|
||||
public DatagramPacket(byte[] buf, int length, SocketAddress address) {
|
||||
this(buf, 0, length, address);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class Inet4Address extends InetAddress {
|
|||
holder().family = IPv4;
|
||||
}
|
||||
|
||||
Inet4Address(String hostName, byte addr[]) {
|
||||
Inet4Address(String hostName, byte[] addr) {
|
||||
holder().hostName = hostName;
|
||||
holder().family = IPv4;
|
||||
if (addr != null) {
|
||||
|
|
|
@ -223,13 +223,13 @@ class Inet6Address extends InetAddress {
|
|||
*/
|
||||
boolean scope_ifname_set; // false;
|
||||
|
||||
void setAddr(byte addr[]) {
|
||||
void setAddr(byte[] addr) {
|
||||
if (addr.length == INADDRSZ) { // normal IPv6 address
|
||||
System.arraycopy(addr, 0, ipaddress, 0, INADDRSZ);
|
||||
}
|
||||
}
|
||||
|
||||
void init(byte addr[], int scope_id) {
|
||||
void init(byte[] addr, int scope_id) {
|
||||
setAddr(addr);
|
||||
|
||||
if (scope_id >= 0) {
|
||||
|
@ -238,7 +238,7 @@ class Inet6Address extends InetAddress {
|
|||
}
|
||||
}
|
||||
|
||||
void init(byte addr[], NetworkInterface nif)
|
||||
void init(byte[] addr, NetworkInterface nif)
|
||||
throws UnknownHostException
|
||||
{
|
||||
setAddr(addr);
|
||||
|
@ -377,27 +377,27 @@ class Inet6Address extends InetAddress {
|
|||
/* checking of value for scope_id should be done by caller
|
||||
* scope_id must be >= 0, or -1 to indicate not being set
|
||||
*/
|
||||
Inet6Address(String hostName, byte addr[], int scope_id) {
|
||||
Inet6Address(String hostName, byte[] addr, int scope_id) {
|
||||
holder.init(hostName, IPv6);
|
||||
holder6 = new Inet6AddressHolder();
|
||||
holder6.init(addr, scope_id);
|
||||
}
|
||||
|
||||
Inet6Address(String hostName, byte addr[]) {
|
||||
Inet6Address(String hostName, byte[] addr) {
|
||||
holder6 = new Inet6AddressHolder();
|
||||
try {
|
||||
initif (hostName, addr, null);
|
||||
} catch (UnknownHostException e) {} /* cant happen if ifname is null */
|
||||
}
|
||||
|
||||
Inet6Address (String hostName, byte addr[], NetworkInterface nif)
|
||||
Inet6Address (String hostName, byte[] addr, NetworkInterface nif)
|
||||
throws UnknownHostException
|
||||
{
|
||||
holder6 = new Inet6AddressHolder();
|
||||
initif (hostName, addr, nif);
|
||||
}
|
||||
|
||||
Inet6Address (String hostName, byte addr[], String ifname)
|
||||
Inet6Address (String hostName, byte[] addr, String ifname)
|
||||
throws UnknownHostException
|
||||
{
|
||||
holder6 = new Inet6AddressHolder();
|
||||
|
@ -474,7 +474,7 @@ class Inet6Address extends InetAddress {
|
|||
throw new UnknownHostException("addr is of illegal length");
|
||||
}
|
||||
|
||||
private void initstr(String hostName, byte addr[], String ifname)
|
||||
private void initstr(String hostName, byte[] addr, String ifname)
|
||||
throws UnknownHostException
|
||||
{
|
||||
try {
|
||||
|
@ -488,7 +488,7 @@ class Inet6Address extends InetAddress {
|
|||
}
|
||||
}
|
||||
|
||||
private void initif(String hostName, byte addr[], NetworkInterface nif)
|
||||
private void initif(String hostName, byte[] addr, NetworkInterface nif)
|
||||
throws UnknownHostException
|
||||
{
|
||||
int family = -1;
|
||||
|
|
|
@ -962,7 +962,7 @@ public class Socket implements java.io.Closeable {
|
|||
return (n > 0) ? (a[0] & 0xff) : -1;
|
||||
}
|
||||
@Override
|
||||
public int read(byte b[], int off, int len) throws IOException {
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
return in.read(b, off, len);
|
||||
}
|
||||
@Override
|
||||
|
@ -1031,7 +1031,7 @@ public class Socket implements java.io.Closeable {
|
|||
write(a, 0, 1);
|
||||
}
|
||||
@Override
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
out.write(b, off, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -1818,7 +1818,7 @@ public abstract class URLConnection {
|
|||
* Returns -1, If EOF is reached before len bytes are read, returns 0
|
||||
* otherwise
|
||||
*/
|
||||
private static int readBytes(int c[], int len, InputStream is)
|
||||
private static int readBytes(int[] c, int len, InputStream is)
|
||||
throws IOException {
|
||||
|
||||
byte buf[] = new byte[len];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue