aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/InetAddress.java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2005-04-26 22:07:39 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2005-04-26 22:07:39 +0000
commit9d8dadd8e09f430071f4d7883a54b5dc41255d86 (patch)
tree4cac8697adea6e1471353acdfebf6ec64967851c /libjava/java/net/InetAddress.java
parent52b26143c9fc9a8dd3df7969e4a5e3ca55da6ec9 (diff)
downloadgcc-9d8dadd8e09f430071f4d7883a54b5dc41255d86.zip
gcc-9d8dadd8e09f430071f4d7883a54b5dc41255d86.tar.gz
gcc-9d8dadd8e09f430071f4d7883a54b5dc41255d86.tar.bz2
InetAddress.java: Made all hexadecimal numbers lowercase.
2005-04-26 Michael Koch <konqueror@gmx.de> * java/net/InetAddress.java: Made all hexadecimal numbers lowercase. Fixed typos in javadocs. (isSiteLocalAddress): Fixed handling of byte values. (isMCLinkLocal): Likewise. * java/net/Inet4Address.java (isMulticastAddress): Call super method. (isLoopbackAddress): Likewise. (isAnyLocalAddress): Likewise. (isLinkLocalAddress): Likewise. (isSiteLocalAddress): Likewise. (isMCGlobal): Likewise. (isMCNodeLocal): Likewise. (isMCLinkLocal): Likewise. (isMCSiteLocal): Likewise. (isMCOrgLocal): Likewise. (getHostAddress): Likewise. From-SVN: r98795
Diffstat (limited to 'libjava/java/net/InetAddress.java')
-rw-r--r--libjava/java/net/InetAddress.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java
index cfb7a5f..0c17206 100644
--- a/libjava/java/net/InetAddress.java
+++ b/libjava/java/net/InetAddress.java
@@ -143,7 +143,7 @@ public class InetAddress implements Serializable
{
// Mask against high order bits of 1110
if (addr.length == 4)
- return (addr[0] & 0xF0) == 0xE0;
+ return (addr[0] & 0xf0) == 0xe0;
// Mask against high order bits of 11111111
if (addr.length == 16)
@@ -173,7 +173,7 @@ public class InetAddress implements Serializable
{
// This is the IPv4 implementation.
// Any class derived from InetAddress should override this.
- return addr[0] == 0x7F;
+ return (addr[0] & 0xff) == 0x7f;
}
/**
@@ -198,18 +198,17 @@ public class InetAddress implements Serializable
{
// This is the IPv4 implementation.
// Any class derived from InetAddress should override this.
+
// 10.0.0.0/8
- if (addr[0] == 0x0A)
+ if ((addr[0] & 0xff) == 0x0a)
return true;
- // XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
- // it says 172.16.0.0 - 172.255.255.255 are site local addresses
// 172.16.0.0/12
- if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01)
+ if ((addr[0] & 0xff) == 0xac && (addr[1] & 0xf0) == 0x10)
return true;
// 192.168.0.0/16
- if (addr[0] == 0xC0 && addr[1] == 0xA8)
+ if ((addr[0] & 0xff) == 0xc0 && (addr[1] & 0xff) == 0xa8)
return true;
// XXX: Do we need to check more addresses here ?
@@ -254,7 +253,9 @@ public class InetAddress implements Serializable
if (! isMulticastAddress())
return false;
- return (addr[0] == 0xE0 && addr[1] == 0x00 && addr[2] == 0x00);
+ return ((addr[0] & 0xff) == 0xe0
+ && (addr[1] & 0xff) == 0x00
+ && (addr[2] & 0xff) == 0x00);
}
/**
@@ -447,7 +448,7 @@ public class InetAddress implements Serializable
int i = len > 4 ? len - 4 : 0;
for (; i < len; i++)
- hash = (hash << 8) | (addr[i] & 0xFF);
+ hash = (hash << 8) | (addr[i] & 0xff);
return hash;
}