You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2008/08/22 09:15:27 UTC
svn commit: r687988 [4/11] - in /harmony/enhanced/classlib/branches/java6:
./ depends/build/ depends/build/platform/ depends/jars/
depends/jars/icu4jni_3.4/ depends/manifests/bcel-5.2/
depends/manifests/bcel-5.2/META-INF/ make/ modules/accessibility/ m...
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectOutputStream.java Fri Aug 22 00:15:00 2008
@@ -115,6 +115,11 @@
private ObjectAccessor accessor = AccessorFactory.getObjectAccessor();
+ /*
+ * Descriptor for java.lang.reflect.Proxy
+ */
+ private final ObjectStreamClass proxyClassDesc = ObjectStreamClass.lookup(Proxy.class);
+
/**
* Inner class to provide access to serializable fields
*/
@@ -468,8 +473,8 @@
*
* @see #nextHandle
*/
- private Integer registerObjectWritten(Object obj) {
- Integer handle = Integer.valueOf(nextHandle());
+ private int registerObjectWritten(Object obj) {
+ int handle = nextHandle();
objectsWritten.put(obj, handle);
return handle;
}
@@ -740,9 +745,10 @@
}
// If we got here, it is a new (non-null) classDesc that will have
// to be registered as well
- handle = registerObjectWritten(classDesc);
+ handle = nextHandle();
+ objectsWritten.put(classDesc, handle);
- if (Proxy.isProxyClass(classToWrite)) {
+ if (classDesc.isProxy()) {
output.writeByte(TC_PROXYCLASSDESC);
Class<?>[] interfaces = classToWrite.getInterfaces();
output.writeInt(interfaces.length);
@@ -751,7 +757,7 @@
}
annotateProxyClass(classToWrite);
output.writeByte(TC_ENDBLOCKDATA);
- writeClassDescForClass(Proxy.class);
+ writeClassDesc(proxyClassDesc, false);
if (unshared) {
// remove reference to unshared object
removeUnsharedReference(classDesc, previousHandle);
@@ -783,25 +789,6 @@
}
/**
- * Writes a class descriptor (an <code>ObjectStreamClass</code>) that
- * corresponds to the <code>java.lang.Class objClass</code> to the stream.
- *
- * @param objClass
- * The class for which a class descriptor (an
- * <code>ObjectStreamClass</code>) will be dumped.
- * @return the handle assigned to the class descriptor
- *
- * @throws IOException
- * If an IO exception happened when writing the class
- * descriptor.
- *
- */
- private Integer writeClassDescForClass(Class<?> objClass)
- throws IOException {
- return writeClassDesc(ObjectStreamClass.lookup(objClass), false);
- }
-
- /**
* Writes a handle representing a cyclic reference (object previously
* dumped).
*
@@ -1176,19 +1163,15 @@
* @throws IOException
* If an IO exception happened when writing the array.
*/
- private Integer writeNewArray(Object array, Class<?> arrayClass,
+ private Integer writeNewArray(Object array, Class<?> arrayClass, ObjectStreamClass arrayClDesc,
Class<?> componentType, boolean unshared) throws IOException {
output.writeByte(TC_ARRAY);
- writeClassDescForClass(arrayClass);
+ writeClassDesc(arrayClDesc, false);
- Integer previousHandle = null;
- if (unshared) {
- previousHandle = objectsWritten.get(array);
- }
- Integer handle = registerObjectWritten(array);
- if (unshared) {
- // remove reference to unshared object
- removeUnsharedReference(array, previousHandle);
+ int handle = nextHandle();
+
+ if (!unshared) {
+ objectsWritten.put(array, handle);
}
// Now we have code duplication just because Java is typed. We have to
@@ -1253,6 +1236,10 @@
Object[] objectArray = (Object[]) array;
output.writeInt(objectArray.length);
for (int i = 0; i < objectArray.length; i++) {
+ // TODO: This place is the opportunity for enhancement
+ // We can implement writing elements through fast-path,
+ // without setting up the context (see writeObject()) for
+ // each element with public API
writeObject(objectArray[i]);
}
}
@@ -1282,24 +1269,20 @@
// We cannot call lookup because it returns null if the parameter
// represents instances that cannot be serialized, and that is not what
// we want.
-
+ ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(object);
+
// The handle for the classDesc is NOT the handle for the class object
// being dumped. We must allocate a new handle and return it.
- if (object.isEnum()) {
- writeEnumDesc(object, unshared);
+ if (clDesc.isEnum()) {
+ writeEnumDesc(object, clDesc, unshared);
} else {
- writeClassDesc(ObjectStreamClass.lookupStreamClass(object),
- unshared);
+ writeClassDesc(clDesc, unshared);
}
+
+ int handle = nextHandle();
- Integer previousHandle = null;
- if (unshared) {
- previousHandle = objectsWritten.get(object);
- }
- Integer handle = registerObjectWritten(object);
- if (unshared) {
- // remove reference to unshared object
- removeUnsharedReference(object, previousHandle);
+ if (!unshared) {
+ objectsWritten.put(object, handle);
}
return handle;
@@ -1324,9 +1307,8 @@
output.writeUTF(classDesc.getName());
output.writeLong(classDesc.getSerialVersionUID());
byte flags = classDesc.getFlags();
- boolean externalizable = false;
- externalizable = ObjectStreamClass.isExternalizable(classDesc
- .forClass());
+
+ boolean externalizable = classDesc.isExternalizable();
if (externalizable) {
if (protocolVersion == PROTOCOL_VERSION_1) {
@@ -1411,7 +1393,7 @@
* @throws IOException
* If an IO exception happened when writing the object.
*/
- private Integer writeNewObject(Object object, Class<?> theClass,
+ private Integer writeNewObject(Object object, Class<?> theClass, ObjectStreamClass clDesc,
boolean unshared) throws IOException {
// Not String, not null, not array, not cyclic reference
@@ -1419,8 +1401,8 @@
currentPutField = null; // null it, to make sure one will be computed if
// needed
- boolean externalizable = ObjectStreamClass.isExternalizable(theClass);
- boolean serializable = ObjectStreamClass.isSerializable(theClass);
+ boolean externalizable = clDesc.isExternalizable();
+ boolean serializable = clDesc.isSerializable();
if (!externalizable && !serializable) {
// Object is neither externalizable nor serializable. Error
throw new NotSerializableException(theClass.getName());
@@ -1428,19 +1410,20 @@
// Either serializable or externalizable, now we can save info
output.writeByte(TC_OBJECT);
- writeClassDescForClass(theClass);
+ writeClassDesc(clDesc, false);
Integer previousHandle = null;
if (unshared) {
previousHandle = objectsWritten.get(object);
}
- Integer handle = registerObjectWritten(object);
+ int handle = nextHandle();
+ objectsWritten.put(object, handle);
// This is how we know what to do in defaultWriteObject. And it is also
// used by defaultWriteObject to check if it was called from an invalid
// place.
// It allows writeExternal to call defaultWriteObject and have it work.
currentObject = object;
- currentClass = ObjectStreamClass.lookup(theClass);
+ currentClass = clDesc;
try {
if (externalizable) {
boolean noBlockData = protocolVersion == PROTOCOL_VERSION_1;
@@ -1478,7 +1461,7 @@
return handle;
}
-
+
/**
* Write String <code>object</code> into the receiver. It is assumed the
* String has not been dumped yet. Return an <code>Integer</code> that
@@ -1503,16 +1486,13 @@
output.writeLong(count);
}
output.writeUTFBytes(object, count);
+
+ int handle = nextHandle();
- Integer previousHandle = null;
- if (unshared) {
- previousHandle = objectsWritten.get(object);
- }
- Integer handle = registerObjectWritten(object);
- if (unshared) {
- // remove reference to unshared object
- removeUnsharedReference(object, previousHandle);
+ if (!unshared) {
+ objectsWritten.put(object, handle);
}
+
return handle;
}
@@ -1634,6 +1614,8 @@
// Non-null object, first time seen...
Class<?> objClass = object.getClass();
+ ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(objClass);
+
nestedLevels++;
try {
@@ -1648,9 +1630,8 @@
}
}
- if (ObjectStreamClass.isSerializable(object.getClass())
+ if (clDesc.isSerializable()
&& computeClassBasedReplacement) {
- ObjectStreamClass clDesc = ObjectStreamClass.lookupStreamClass(objClass);
if(clDesc.hasMethodWriteReplace()){
Method methodWriteReplace = clDesc.getMethodWriteReplace();
Object replObj = null;
@@ -1724,7 +1705,7 @@
// Is it an Array ?
if (objClass.isArray()) {
- return writeNewArray(object, objClass, objClass
+ return writeNewArray(object, objClass, clDesc, objClass
.getComponentType(), unshared);
}
@@ -1733,17 +1714,17 @@
}
// Not a String or Class or Array. Default procedure.
- return writeNewObject(object, objClass, unshared);
+ return writeNewObject(object, objClass, clDesc, unshared);
} finally {
nestedLevels--;
}
}
// write for Enum Class Desc only, which is different from other classes
- private ObjectStreamClass writeEnumDesc(Class<?> theClass, boolean unshared)
+ private ObjectStreamClass writeEnumDesc(Class<?> theClass, ObjectStreamClass classDesc, boolean unshared)
throws IOException {
// write classDesc, classDesc for enum is different
- ObjectStreamClass classDesc = ObjectStreamClass.lookup(theClass);
+
// set flag for enum, the flag is (SC_SERIALIZABLE | SC_ENUM)
classDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
Integer previousHandle = null;
@@ -1758,7 +1739,7 @@
Class<?> classToWrite = classDesc.forClass();
// If we got here, it is a new (non-null) classDesc that will have
// to be registered as well
- registerObjectWritten(classDesc);
+ objectsWritten.put(classDesc, nextHandle());
output.writeByte(TC_CLASSDESC);
if (protocolVersion == PROTOCOL_VERSION_1) {
@@ -1775,11 +1756,11 @@
drain(); // flush primitive types in the annotation
output.writeByte(TC_ENDBLOCKDATA);
// write super class
- ObjectStreamClass superClass = classDesc.getSuperclass();
- if (null != superClass) {
+ ObjectStreamClass superClassDesc = classDesc.getSuperclass();
+ if (null != superClassDesc) {
// super class is also enum
- superClass.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
- writeEnumDesc(superClass.forClass(), unshared);
+ superClassDesc.setFlags((byte) (SC_SERIALIZABLE | SC_ENUM));
+ writeEnumDesc(superClassDesc.forClass(), superClassDesc, unshared);
} else {
output.writeByte(TC_NULL);
}
@@ -1803,13 +1784,15 @@
// write enum only
theClass = theClass.getSuperclass();
}
- ObjectStreamClass classDesc = writeEnumDesc(theClass, unshared);
+ ObjectStreamClass classDesc = ObjectStreamClass.lookup(theClass);
+ writeEnumDesc(theClass, classDesc, unshared);
Integer previousHandle = null;
if (unshared) {
previousHandle = objectsWritten.get(object);
}
- Integer handle = registerObjectWritten(object);
+ int handle = nextHandle();
+ objectsWritten.put(object, handle);
ObjectStreamField[] fields = classDesc.getSuperclass().fields();
Class<?> declaringClass = classDesc.getSuperclass().forClass();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectStreamClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectStreamClass.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectStreamClass.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/ObjectStreamClass.java Fri Aug 22 00:15:00 2008
@@ -148,6 +148,27 @@
private transient Method methodReadObjectNoData;
+ /**
+ * Indicates whether the class properties resolved
+ *
+ * @see #resolveProperties()
+ */
+ private transient boolean arePropertiesResolved;
+
+ /**
+ * Cached class properties
+ *
+ * @see #resolveProperties()
+ * @see #isSerializable()
+ * @see #isExternalizable()
+ * @see #isProxy()
+ * @see #isEnum()
+ */
+ private transient boolean isSerializable;
+ private transient boolean isExternalizable;
+ private transient boolean isProxy;
+ private transient boolean isEnum;
+
// ClassDesc //
// Name of the class this descriptor represents
@@ -203,26 +224,24 @@
}
/**
- * Compute class descriptor for a given class <code>cl</code>. If
- * <code>computeSUID</code> is true, this method will compute the SUID for
- * this class.
+ * Compute class descriptor for a given class <code>cl</code>.
*
* @param cl
* a java.langClass for which to compute the corresponding
- * descriptor
- * @param computeSUID
- * a boolean indicating if SUID should be computed or not.
+ * descriptor
* @return the computer class descriptor
*/
- private static ObjectStreamClass createClassDesc(Class<?> cl,
- boolean computeSUID) {
+ private static ObjectStreamClass createClassDesc(Class<?> cl) {
ObjectStreamClass result = new ObjectStreamClass();
- boolean isProxy = Proxy.isProxyClass(cl);
- boolean isEnum = Enum.class.isAssignableFrom(cl);
boolean isArray = cl.isArray();
+ boolean serializable = isSerializable(cl);
+ boolean externalizable = isExternalizable(cl);
+ result.isSerializable = serializable;
+ result.isExternalizable = externalizable;
+
// Now we fill in the values
result.setName(cl.getName());
result.setClass(cl);
@@ -232,9 +251,10 @@
}
Field[] declaredFields = null;
- if (computeSUID) {
- // Lazy computation, to save speed & space
- if (isEnum || isProxy) {
+
+ // Compute the SUID
+ if(serializable || externalizable) {
+ if (result.isEnum() || result.isProxy()) {
result.setSerialVersionUID(0L);
} else {
declaredFields = cl.getDeclaredFields();
@@ -243,7 +263,6 @@
}
}
- boolean serializable = isSerializable(cl);
// Serializables need field descriptors
if (serializable && !isArray) {
if (declaredFields == null) {
@@ -274,7 +293,6 @@
}
byte flags = 0;
- boolean externalizable = isExternalizable(cl);
if (externalizable) {
flags |= ObjectStreamConstants.SC_EXTERNALIZABLE;
flags |= ObjectStreamConstants.SC_BLOCK_DATA; // use protocol version 2 by default
@@ -688,7 +706,7 @@
ObjectStreamField[] fields() {
if (fields == null) {
Class<?> forCl = forClass();
- if (forCl != null && isSerializable(forCl) && !forCl.isArray()) {
+ if (forCl != null && isSerializable() && !forCl.isArray()) {
buildFieldDescriptors(forCl.getDeclaredFields());
} else {
// Externalizables or arrays do not need FieldDesc info
@@ -869,6 +887,63 @@
}
/**
+ * Resolves the class properties, if they weren't already
+ */
+ private void resolveProperties() {
+ if (arePropertiesResolved) {
+ return;
+ }
+
+ Class<?> cl = forClass();
+ isProxy = Proxy.isProxyClass(cl);
+ isEnum = Enum.class.isAssignableFrom(cl);
+ isSerializable = isSerializable(cl);
+ isExternalizable = isExternalizable(cl);
+
+ arePropertiesResolved = true;
+ }
+
+ /**
+ * Answers whether the class for this descriptor is serializable
+ *
+ * @return true if class implements Serializable
+ */
+ boolean isSerializable() {
+ resolveProperties();
+ return isSerializable;
+ }
+
+ /**
+ * Answers whether the class for this descriptor is serializable
+ *
+ * @return true if class implements Serializable
+ */
+ boolean isExternalizable() {
+ resolveProperties();
+ return isExternalizable;
+ }
+
+ /**
+ * Answers whether the class for this descriptor is proxied class
+ *
+ * @return true if class is proxied
+ */
+ boolean isProxy() {
+ resolveProperties();
+ return isProxy;
+ }
+
+ /**
+ * Answers whether the class for this descriptor is subclass of Enum
+ *
+ * @return true if class is subclass of Enum
+ */
+ boolean isEnum() {
+ resolveProperties();
+ return isEnum;
+ }
+
+ /**
* Return a little endian long stored in a given position of the buffer
*
* @param buffer
@@ -899,15 +974,13 @@
* the class <code>cl</code> is Serializable or Externalizable
*/
public static ObjectStreamClass lookup(Class<?> cl) {
- boolean serializable = isSerializable(cl);
- boolean externalizable = isExternalizable(cl);
-
- // Has to be either Serializable or Externalizable
- if (!serializable && !externalizable) {
- return null;
+ ObjectStreamClass osc = lookupStreamClass(cl);
+
+ if (osc.isSerializable() || osc.isExternalizable()) {
+ return osc;
}
-
- return lookupStreamClass(cl, true);
+
+ return null;
}
/**
@@ -922,22 +995,7 @@
* @since 1.6
*/
public static ObjectStreamClass lookupAny(Class<?> cl) {
- return isSerializable(cl) ? lookupStreamClass(cl, true)
- : lookupStreamClass(cl, false);
- }
-
- /**
- * Return the descriptor (ObjectStreamClass) corresponding to the class
- * <code>cl</code>. Returns an ObjectStreamClass even if instances of the
- * class cannot be serialized
- *
- * @param cl
- * a java.langClass for which to obtain the corresponding
- * descriptor
- * @return the corresponding descriptor
- */
- static ObjectStreamClass lookupStreamClass(Class<?> cl) {
- return lookupStreamClass(cl, isSerializable(cl) || isExternalizable(cl));
+ return lookupStreamClass(cl);
}
/**
@@ -952,14 +1010,13 @@
* a boolean indicating if SUID should be computed or not.
* @return the corresponding descriptor
*/
- private static ObjectStreamClass lookupStreamClass(Class<?> cl,
- boolean computeSUID) {
+ static ObjectStreamClass lookupStreamClass(Class<?> cl) {
WeakHashMap<Class<?>,ObjectStreamClass> tlc = OSCThreadLocalCache.oscWeakHashMap.get();
ObjectStreamClass cachedValue = tlc.get(cl);
if (cachedValue == null) {
- cachedValue = createClassDesc(cl, computeSUID);
+ cachedValue = createClassDesc(cl);
tlc.put(cl, cachedValue);
}
return cachedValue;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ThreadLocal.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ThreadLocal.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ThreadLocal.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/lang/ThreadLocal.java Fri Aug 22 00:15:00 2008
@@ -17,6 +17,12 @@
package java.lang;
+/*
+ * Note that the Harmony VM "DRLVM" uses a different implementation of ThreadLocal.
+ * See DRLVM's classes here:
+ * http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/
+ */
+
/**
* A ThreadLocal is a variable that has a per-thread value. Different Threads
* may reference the same ThreadLocal object, but the values they observe will
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java Fri Aug 22 00:15:00 2008
@@ -103,7 +103,7 @@
pos++;
lastPosition = -1;
if (modCount != expectedModCount) {
- expectedModCount++;
+ expectedModCount = modCount;
}
} else {
throw new ConcurrentModificationException();
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Arrays.java Fri Aug 22 00:15:00 2008
@@ -2795,7 +2795,7 @@
Object fromVal = in[start];
Object rVal = in[r];
if (c.compare(fromVal, rVal) <= 0) {
- int l_1 = find(in, rVal, -1, start + 1, med - 1, c);
+ int l_1 = find(in, rVal, 0, start + 1, med - 1, c);
int toCopy = l_1 - start + 1;
System.arraycopy(in, start, out, i, toCopy);
i += toCopy;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java Fri Aug 22 00:15:00 2008
@@ -69,7 +69,7 @@
@SuppressWarnings("unchecked")
private static final class EmptyList extends AbstractList implements
- Serializable {
+ RandomAccess, Serializable {
private static final long serialVersionUID = 8842843931221139166L;
@Override
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumSet.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/EnumSet.java Fri Aug 22 00:15:00 2008
@@ -20,7 +20,7 @@
public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
implements Cloneable, Serializable {
- private static final long serialVersionUID = 4782406773684236311L;
+ private static final long serialVersionUID = 1009687484059888093L;
final Class<E> elementClass;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java Fri Aug 22 00:15:00 2008
@@ -28,6 +28,7 @@
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.math.MathContext;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.security.AccessController;
@@ -1727,9 +1728,18 @@
boolean requireScientificRepresentation = true;
double d = ((Number) argument).doubleValue();
d = Math.abs(d);
- long l = Math.round(d);
+ if (Double.isInfinite(d)) {
+ precision = formatToken.getPrecision();
+ precision--;
+ formatToken.setPrecision(precision);
+ transform_e();
+ return;
+ }
+ BigDecimal b = new BigDecimal(d, new MathContext(precision));
+ d = b.doubleValue();
+ long l = b.longValue();
- if (l >= 1) {
+ if (d >= 1 && d < Math.pow(10, precision)) {
if (l < Math.pow(10, precision)) {
requireScientificRepresentation = false;
precision -= String.valueOf(l).length();
@@ -1743,19 +1753,20 @@
}
} else {
- l = Math.round(d * Math.pow(10, 4));
- if (l >= 1) {
+ l = b.movePointRight(4).longValue();
+ b.movePointLeft(4);
+ if (d >= Math.pow(10, -4) && d < 1) {
requireScientificRepresentation = false;
precision += 4 - String.valueOf(l).length();
- l = Math.round(d * Math.pow(10, precision + 1));
+ l = b.movePointRight(precision + 1).longValue();
+ b.movePointLeft(precision + 1);
if (String.valueOf(l).length() <= formatToken
.getPrecision()) {
precision++;
}
- l = Math.round(d * Math.pow(10, precision));
- if (l < Math.pow(10, precision - 4)) {
- requireScientificRepresentation = true;
- } else {
+ l = b.movePointRight(precision).longValue();
+ b.movePointLeft(precision);
+ if (l >= Math.pow(10, precision - 4)) {
formatToken.setPrecision(precision);
}
}
@@ -2067,9 +2078,10 @@
private void transform_Z() {
TimeZone timeZone = calendar.getTimeZone();
- result
- .append(timeZone.getDisplayName(true, TimeZone.SHORT,
- locale));
+ result.append(timeZone
+ .getDisplayName(
+ timeZone.inDaylightTime(calendar.getTime()),
+ TimeZone.SHORT, locale));
}
private void transform_z() {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/HashMap.java Fri Aug 22 00:15:00 2008
@@ -679,13 +679,17 @@
return null;
}
+ /*
+ * Remove the given entry from the hashmap.
+ * Assumes that the entry is in the map.
+ */
final void removeEntry(Entry<K, V> entry) {
int index = entry.origKeyHash & (elementData.length - 1);
Entry<K, V> m = elementData[index];
if (m == entry) {
elementData[index] = entry.next;
} else {
- while (m.next != entry && m.next != null) {
+ while (m.next != entry) {
m = m.next;
}
m.next = entry.next;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZone.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZone.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZone.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZone.java Fri Aug 22 00:15:00 2008
@@ -72,6 +72,24 @@
AvailableZones.put(zones[i].getID(), zones[i]);
}
}
+
+ private static boolean isAvailableIDInICU(String name) {
+ String[] availableIDs = com.ibm.icu.util.TimeZone.getAvailableIDs();
+ for (int i = 0; i < availableIDs.length; i++) {
+ if (availableIDs[i].equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static void appendAvailableZones(String name) {
+ com.ibm.icu.util.TimeZone icuTZ = com.ibm.icu.util.TimeZone
+ .getTimeZone(name);
+ int raw = icuTZ.getRawOffset();
+ TimeZone zone = new SimpleTimeZone(raw, name);
+ AvailableZones.put(name, zone);
+ }
/**
* Constructs a new instance of this class.
@@ -104,16 +122,7 @@
* @return an array of time zone ID strings
*/
public static synchronized String[] getAvailableIDs() {
- if (AvailableZones == null) {
- initializeAvailable();
- }
- int length = AvailableZones.size();
- String[] answer = new String[length];
- Iterator<String> keys = AvailableZones.keySet().iterator();
- for (int i = 0; i < length; i++) {
- answer[i] = keys.next();
- }
- return answer;
+ return com.ibm.icu.util.TimeZone.getAvailableIDs();
}
/**
@@ -125,14 +134,13 @@
* @return an array of time zone ID strings
*/
public static synchronized String[] getAvailableIDs(int offset) {
- if (AvailableZones == null) {
- initializeAvailable();
- }
- int count = 0, length = AvailableZones.size();
+ String[] availableIDs = com.ibm.icu.util.TimeZone.getAvailableIDs();
+ int count = 0;
+ int length = availableIDs.length;
String[] all = new String[length];
- Iterator<TimeZone> zones = AvailableZones.values().iterator();
for (int i = 0; i < length; i++) {
- TimeZone tz = zones.next();
+ com.ibm.icu.util.TimeZone tz = com.ibm.icu.util.TimeZone
+ .getTimeZone(availableIDs[i]);
if (tz.getRawOffset() == offset) {
all[count++] = tz.getID();
}
@@ -303,7 +311,11 @@
initializeAvailable();
}
- TimeZone zone = AvailableZones.get(name);
+ TimeZone zone = AvailableZones.get(name);
+ if(zone == null && isAvailableIDInICU(name)){
+ appendAvailableZones(name);
+ zone = AvailableZones.get(name);
+ }
if (zone == null) {
if (name.startsWith("GMT") && name.length() > 3) {
char sign = name.charAt(3);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZones.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZones.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZones.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TimeZones.java Fri Aug 22 00:15:00 2008
@@ -19,7 +19,8 @@
final class TimeZones {
- private static final int ONE_HOUR = 3600000;
+ private static final int HALF_HOUR = 1800000;
+ private static final int ONE_HOUR = HALF_HOUR * 2;
public static TimeZone[] getTimeZones() {
return new TimeZone[] {
@@ -582,7 +583,7 @@
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Almaty", Calendar.MARCH,//$NON-NLS-1$
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
- new SimpleTimeZone(6 * ONE_HOUR, "Asia/Colombo"),//$NON-NLS-1$
+ new SimpleTimeZone(5 * ONE_HOUR + HALF_HOUR, "Asia/Colombo"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Dacca"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Dhaka"),//$NON-NLS-1$
new SimpleTimeZone(6 * ONE_HOUR,
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Timer.java Fri Aug 22 00:15:00 2008
@@ -45,115 +45,116 @@
private static final class TimerImpl extends Thread {
- private static final class TimerNode {
- TimerNode parent, left, right;
+ private static final class TimerHeap {
+ private int DEFAULT_HEAP_SIZE = 256;
- TimerTask task;
+ private TimerTask[] timers = new TimerTask[DEFAULT_HEAP_SIZE];
- public TimerNode(TimerTask value) {
- this.task = value;
+ private int size = 0;
+
+ private int deletedCancelledNumber = 0;
+
+ public TimerTask minimum() {
+ return timers[0];
}
- public void deleteIfCancelled(TimerTree tasks) {
- /*
- * All changes in the tree structure during deleting this node
- * affect only the structure of the subtree having this node as
- * its root
- */
- if (left != null) {
- left.deleteIfCancelled(tasks);
- }
- if (right != null) {
- right.deleteIfCancelled(tasks);
- }
- if (task.cancelled) {
- tasks.delete(this);
- tasks.deletedCancelledNumber++;
- }
+ public boolean isEmpty() {
+ return size == 0;
+ }
+
+ public void insert(TimerTask task) {
+ if (timers.length == size) {
+ TimerTask[] appendedTimers = new TimerTask[size * 2];
+ System.arraycopy(timers, 0, appendedTimers, 0, size);
+ timers = appendedTimers;
+ }
+ timers[size++] = task;
+ upHeap();
}
- }
- private static final class TimerTree {
+ public void delete(int pos) {
+ // posible to delete any position of the heap
+ if (pos >= 0 && pos < size) {
+ timers[pos] = timers[--size];
+ timers[size] = null;
+ downHeap(pos);
+ }
+ }
- int deletedCancelledNumber;
+ private void upHeap() {
+ int current = size - 1;
+ int parent = (current - 1) / 2;
- TimerNode root;
+ while (timers[current].when < timers[parent].when) {
+ // swap the two
+ TimerTask tmp = timers[current];
+ timers[current] = timers[parent];
+ timers[parent] = tmp;
- boolean isEmpty() {
- return root == null;
+ // update pos and current
+ current = parent;
+ parent = (current - 1) / 2;
+ }
}
- void insert(TimerNode z) {
- TimerNode y = null, x = root;
- while (x != null) {
- y = x;
- if (z.task.getWhen() < x.task.getWhen()) {
- x = x.left;
- } else {
- x = x.right;
+ private void downHeap(int pos) {
+ int current = pos;
+ int child = 2 * current + 1;
+
+ while (child < size && size > 0) {
+ // compare the children if they exist
+ if (child + 1 < size
+ && timers[child + 1].when < timers[child].when) {
+ child++;
}
- }
- z.parent = y;
- if (y == null) {
- root = z;
- } else if (z.task.getWhen() < y.task.getWhen()) {
- y.left = z;
- } else {
- y.right = z;
+
+ // compare selected child with parent
+ if (timers[current].when < timers[child].when)
+ break;
+
+ // swap the two
+ TimerTask tmp = timers[current];
+ timers[current] = timers[child];
+ timers[child] = tmp;
+
+ // update pos and current
+ current = child;
+ child = 2 * current + 1;
}
}
- void delete(TimerNode z) {
- TimerNode y = null, x = null;
- if (z.left == null || z.right == null) {
- y = z;
- } else {
- y = successor(z);
- }
- if (y.left != null) {
- x = y.left;
- } else {
- x = y.right;
- }
- if (x != null) {
- x.parent = y.parent;
- }
- if (y.parent == null) {
- root = x;
- } else if (y == y.parent.left) {
- y.parent.left = x;
- } else {
- y.parent.right = x;
- }
- if (y != z) {
- z.task = y.task;
- }
+ public void reset() {
+ timers = new TimerTask[DEFAULT_HEAP_SIZE];
+ size = 0;
}
- private TimerNode successor(TimerNode x) {
- if (x.right != null) {
- return minimum(x.right);
- }
- TimerNode y = x.parent;
- while (y != null && x == y.right) {
- x = y;
- y = y.parent;
- }
- return y;
+ public void adjustMinimum() {
+ downHeap(0);
}
- private TimerNode minimum(TimerNode x) {
- while (x.left != null) {
- x = x.left;
+ public void deleteIfCancelled() {
+ for (int i = 0; i < size; i++) {
+ if (timers[i].cancelled) {
+ deletedCancelledNumber++;
+ delete(i);
+ // re-try this point
+ i--;
+ }
}
- return x;
}
-
- TimerNode minimum() {
- return minimum(root);
+
+ private int getTask(TimerTask task) {
+ for (int i = 0; i < timers.length; i++) {
+ if (timers[i] == task){
+ return i;
+ }
+ }
+ return -1;
}
+
}
+
/**
* True if the method cancel() of the Timer was called or the !!!stop()
* method was invoked
@@ -169,7 +170,7 @@
* Vector consists of scheduled events, sorted according to
* <code>when</code> field of TaskScheduled object.
*/
- private TimerTree tasks = new TimerTree();
+ private TimerHeap tasks = new TimerHeap();
/**
* Starts a new timer.
@@ -214,13 +215,12 @@
long currentTime = System.currentTimeMillis();
- TimerNode taskNode = tasks.minimum();
- task = taskNode.task;
+ task = tasks.minimum();
long timeToSleep;
synchronized (task.lock) {
if (task.cancelled) {
- tasks.delete(taskNode);
+ tasks.delete(0);
continue;
}
@@ -241,8 +241,12 @@
// no sleep is necessary before launching the task
synchronized (task.lock) {
+ int pos = 0;
+ if(tasks.minimum().when != task.when){
+ pos = tasks.getTask(task);
+ }
if (task.cancelled) {
- tasks.delete(taskNode);
+ tasks.delete(tasks.getTask(task));
continue;
}
@@ -250,7 +254,7 @@
task.setScheduledTime(task.when);
// remove task from queue
- tasks.delete(taskNode);
+ tasks.delete(pos);
// set when the next task should be launched
if (task.period >= 0) {
@@ -283,7 +287,7 @@
private void insertTask(TimerTask newTask) {
// callers are synchronized
- tasks.insert(new TimerNode(newTask));
+ tasks.insert(newTask);
this.notify();
}
@@ -292,7 +296,7 @@
*/
public synchronized void cancel() {
cancelled = true;
- tasks = new TimerTree();
+ tasks.reset();
this.notify();
}
@@ -302,7 +306,7 @@
}
// callers are synchronized
tasks.deletedCancelledNumber = 0;
- tasks.root.deleteIfCancelled(tasks);
+ tasks.deleteIfCancelled();
return tasks.deletedCancelledNumber;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/shared/vmizip.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/shared/vmizip.h?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/shared/vmizip.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/shared/vmizip.h Fri Aug 22 00:15:00 2008
@@ -93,6 +93,8 @@
char _vmipadding0065[3]; /* 3 bytes of automatic padding */
} VMIZipFile;
+struct HyZipCache; /* forward declaration */
+
typedef struct VMIZipFunctionTable {
I_32 (PVMCALL zip_closeZipFile) (VMInterface * vmi, VMIZipFile * zipFile) ;
void (PVMCALL zip_freeZipEntry) (VMInterface * vmi, VMIZipEntry * entry) ;
@@ -109,7 +111,7 @@
IDATA (PVMCALL zipCache_enumElement) (void *handle, char *nameBuf, UDATA nameBufSize, UDATA * offset) ;
IDATA (PVMCALL zipCache_enumGetDirName) (void *handle, char *nameBuf, UDATA nameBufSize) ;
void (PVMCALL zipCache_enumKill) (void *handle) ;
- IDATA (PVMCALL zipCache_enumNew) (void * zipCache, char *directoryName, void **handle) ;
+ IDATA (PVMCALL zipCache_enumNew) (struct HyZipCache * zipCache, char *directoryName, void **handle) ;
void *reserved;
} VMIZipFunctionTable;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/unix/jclprots.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/unix/jclprots.h?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/unix/jclprots.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/unix/jclprots.h Fri Aug 22 00:15:00 2008
@@ -188,7 +188,7 @@
/* NativesCommonNetHelpers*/
void throwJavaNetBindException PROTOTYPE((JNIEnv* env, I_32 errorNumber));
-jobject newJavaNetInetAddressGenericBS PROTOTYPE((JNIEnv * env, jbyte *address, U_32 length, char *hostName, U_32 scope_id ));
+jobject newJavaNetInetAddressGenericBS PROTOTYPE((JNIEnv * env, jbyte *address, U_32 length, const char *hostName, U_32 scope_id ));
void throwJavaNetUnknownHostException PROTOTYPE((JNIEnv* env, I_32 errorNumber));
jobject newJavaNetInetAddressGenericB PROTOTYPE((JNIEnv * env, jbyte *address, U_32 length, U_32 scope_id ));
jobject newJavaLangByte PROTOTYPE((JNIEnv * env, U_8 aByte));
@@ -196,7 +196,7 @@
I_32 intValue PROTOTYPE((JNIEnv * env, jobject anInteger));
void throwJavaNetPortUnreachableException PROTOTYPE((JNIEnv* env, I_32 errorNumber));
jobject newJavaByteArray PROTOTYPE((JNIEnv * env, jbyte *bytes, jint length));
-jobjectArray createAliasArrayFromAddrinfo PROTOTYPE((JNIEnv* env, hyaddrinfo_t addresses, char* hName ));
+jobjectArray createAliasArrayFromAddrinfo PROTOTYPE((JNIEnv* env, hyaddrinfo_t addresses, const char* hName ));
BOOLEAN booleanValue PROTOTYPE((JNIEnv * env, jobject aBoolean));
jobject newJavaLangInteger PROTOTYPE((JNIEnv * env, I_32 anInt));
BOOLEAN preferIPv4Stack PROTOTYPE((JNIEnv * env));
@@ -211,7 +211,7 @@
void throwJavaNetConnectException PROTOTYPE((JNIEnv* env, I_32 errorNumber));
void netGetJavaNetInetAddressScopeId PROTOTYPE((JNIEnv * env, jobject anInetAddress, U_32 *scope_id));
BOOLEAN preferIPv6Addresses PROTOTYPE((JNIEnv * env));
-jobjectArray createAliasArray PROTOTYPE((JNIEnv* env, jbyte **addresses, I_32 *family, U_32 count, char* hName, U_32* scope_id_array ));
+jobjectArray createAliasArray PROTOTYPE((JNIEnv* env, jbyte **addresses, I_32 *family, U_32 count, const char* hName, U_32* scope_id_array ));
void throwJavaNetSocketException PROTOTYPE((JNIEnv* env, I_32 errorNumber));
I_32 netGetSockAddr PROTOTYPE((JNIEnv *env, jobject fileDescriptor, hysockaddr_t sockaddrP, jboolean preferIPv6Addresses));
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/windows/jclprots.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/windows/jclprots.h?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/windows/jclprots.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/include/windows/jclprots.h Fri Aug 22 00:15:00 2008
@@ -343,8 +343,8 @@
/* NativesCommonNetHelpers*/
void throwJavaNetBindException PROTOTYPE ((JNIEnv * env, I_32 errorNumber));
jobject newJavaNetInetAddressGenericBS
- PROTOTYPE ((JNIEnv * env, jbyte * address, U_32 length, char *hostName,
- U_32 scope_id));
+ PROTOTYPE ((JNIEnv * env, jbyte * address, U_32 length,
+ const char *hostName, U_32 scope_id));
void throwJavaNetUnknownHostException
PROTOTYPE ((JNIEnv * env, I_32 errorNumber));
jobject newJavaNetInetAddressGenericB
@@ -357,7 +357,7 @@
jobject newJavaByteArray
PROTOTYPE ((JNIEnv * env, jbyte * bytes, jint length));
jobjectArray createAliasArrayFromAddrinfo
- PROTOTYPE ((JNIEnv * env, hyaddrinfo_t addresses, char *hName));
+ PROTOTYPE ((JNIEnv * env, hyaddrinfo_t addresses, const char *hName));
BOOLEAN booleanValue PROTOTYPE ((JNIEnv * env, jobject aBoolean));
jobject newJavaLangInteger PROTOTYPE ((JNIEnv * env, I_32 anInt));
BOOLEAN preferIPv4Stack PROTOTYPE ((JNIEnv * env));
@@ -382,7 +382,7 @@
BOOLEAN preferIPv6Addresses PROTOTYPE ((JNIEnv * env));
jobjectArray createAliasArray
PROTOTYPE ((JNIEnv * env, jbyte ** addresses, I_32 * family, U_32 count,
- char *hName, U_32 * scope_id_array));
+ const char *hName, U_32 * scope_id_array));
void throwJavaNetSocketException
PROTOTYPE ((JNIEnv * env, I_32 errorNumber));
I_32 netGetSockAddr
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/libhlp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/libhlp.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/libhlp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/libhlp.c Fri Aug 22 00:15:00 2008
@@ -28,7 +28,7 @@
{
/* append a separator, first */
- if (*classPath && (*classPath)->data[strlen ((*classPath)->data)] != sep)
+ if (*classPath && (*classPath)->data[strlen ((char *)((*classPath)->data))] != sep)
{
char separator[2];
separator[0] = (char) sep;
@@ -65,8 +65,8 @@
if (*classPath == NULL)
return -1;
hysysinfo_get_env (envvar,
- (*classPath)->data + strlen ((*classPath)->data),
- rc);
+ (char *)((*classPath)->data) + strlen ((char *)((*classPath)->data)),
+ (U_32)rc);
(*classPath)->remaining -= rc;
break;
}
@@ -266,7 +266,7 @@
if (((*env)->ExceptionCheck (env)))
return 1;
- (*env)->SetByteArrayRegion (env, bytearray, (UDATA) 0, strLength, chars);
+ (*env)->SetByteArrayRegion (env, bytearray, (UDATA) 0, strLength, (jbyte*)chars);
string =
(*env)->NewObject (env, stringClass, stringMid, bytearray, (UDATA) 0,
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/main.c Fri Aug 22 00:15:00 2008
@@ -941,7 +941,7 @@
}
/* FIXME: buffer leak ignored */
- options[j].optionString = lineBuf->data;
+ options[j].optionString = (char *)(lineBuf->data);
options[j].extraInfo = NULL;
++j;
}
@@ -989,7 +989,7 @@
/* Check that the minimum required -D options have been included. If not, calculate and add the defaults */
initDefaultDefines (portLibrary, (void **)&options, argc, argv,
isStandaloneJar ? classArg : 0, &classPath2, &javaHome,
- &javaLibraryPath, vmdllsubdir, &j);
+ &javaLibraryPath, vmdllsubdir, (int *) &j);
// Slam in the pointer to the HyPortLibrary
portLibOptionStr = hymem_allocate_memory (strlen(PORT_LIB_OPTION) + 1);
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/strbuf.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/strbuf.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/strbuf.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/launcher/shared/strbuf.c Fri Aug 22 00:15:00 2008
@@ -30,7 +30,7 @@
buffer = strBufferEnsure (portLibrary, buffer, len);
if (buffer)
{
- strcat (buffer->data, string);
+ strcat ((char *)(buffer->data), string);
buffer->remaining -= len;
}
@@ -60,12 +60,12 @@
PORT_ACCESS_FROM_PORT (portLibrary);
UDATA newSize = len > MIN_GROWTH ? len : MIN_GROWTH;
HyStringBuffer *new =
- hymem_allocate_memory (strlen (buffer->data) + newSize +
+ hymem_allocate_memory (strlen ((char *)(buffer->data)) + newSize +
sizeof (UDATA) + 1);
if (new)
{
new->remaining = newSize;
- strcpy (new->data, buffer->data);
+ strcpy ((char *)(new->data), (char *)(buffer->data));
}
hymem_free_memory (buffer);
return new;
@@ -83,8 +83,8 @@
buffer = strBufferEnsure (portLibrary, buffer, len);
if (buffer)
{
- memmove (buffer->data + len, buffer->data, strlen (buffer->data) + 1);
- strncpy (buffer->data, string, len);
+ memmove (buffer->data + len, buffer->data, strlen ((char *)(buffer->data)) + 1);
+ strncpy ((char *)(buffer->data), string, len);
buffer->remaining -= len;
}
@@ -94,5 +94,5 @@
char *
strBufferData (HyStringBuffer * buffer)
{
- return buffer ? buffer->data : NULL;
+ return buffer ? (char *)(buffer->data) : NULL;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Fri Aug 22 00:15:00 2008
@@ -352,7 +352,7 @@
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
- (env, thisClz, fileDescriptor, (jlong) message, count, timeout);
+ (env, thisClz, fileDescriptor, (jlong) (IDATA)message, count, timeout);
if (result > 0) {
(*env)->SetByteArrayRegion(env, data, offset, result, (jbyte *) message);
@@ -377,7 +377,7 @@
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t hysocketP;
- jbyte *message = (jbyte *) address;
+ jbyte *message = (jbyte *) (IDATA)address;
I_32 result, localCount;
hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
@@ -446,7 +446,7 @@
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
- (env, thisClz, fileDescriptor, (jlong) message, count);
+ (env, thisClz, fileDescriptor, (jlong)(IDATA) message, count);
out:
if ((U_8 *) message != internalBuffer) {
@@ -467,12 +467,12 @@
jint count)
{
PORT_ACCESS_FROM_ENV(env);
- hysocket_t socketP;
- jbyte *message = (jbyte *) address;
+ jbyte *message = (jbyte *) (IDATA)address;
I_32 result = 0, sent = 0;
if (sent < count) {
- socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+ hysocket_t socketP =
+ getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
if (!hysock_socketIsValid(socketP)) {
throwJavaNetSocketException(env,
sent ==0 ?
@@ -480,16 +480,16 @@
HYPORT_ERROR_SOCKET_INTERRUPTED);
return (jint) 0;
}
- }
- while (sent < count) {
- result =
- hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
- HYSOCK_NOFLAGS);
- if (result < 0) {
- break;
+ while (sent < count) {
+ result =
+ hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
+ HYSOCK_NOFLAGS);
+ if (result < 0) {
+ break;
+ }
+ sent += result;
}
- sent += result;
}
/**
@@ -1097,7 +1097,7 @@
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirectImpl
- (env, thisClz, fileDescriptor, datagramPacket, (jlong) message, offset,
+ (env, thisClz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
localCount, timeout, peek);
if (result > 0) {
@@ -1119,7 +1119,7 @@
jint timeout, jboolean peek)
{
PORT_ACCESS_FROM_ENV(env);
- jbyte *message = (jbyte *) address;
+ jbyte *message = (jbyte *) (IDATA)address;
hysocket_t hysocketP;
hysockaddr_struct sockaddrP;
I_32 result, localCount;
@@ -1192,7 +1192,7 @@
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
- (env, thisClz, fileDescriptor, datagramPacket, (jlong) message, offset,
+ (env, thisClz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
localCount, timeout, peek);
if (result > 0) {
@@ -1217,7 +1217,7 @@
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t hysocketP;
- jbyte *message = (jbyte *) address;
+ jbyte *message = (jbyte *) (IDATA)address;
I_32 result;
I_32 localCount;
I_32 flags = HYSOCK_NOFLAGS;
@@ -1293,7 +1293,7 @@
(*env)->GetByteArrayRegion(env, data, offset, msgLength, message);
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirectImpl
- (env, thisClz, fileDescriptor, (jlong) message, offset, msgLength,
+ (env, thisClz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
targetPort, bindToDevice, trafficClass, inetAddress);
hymem_free_memory(message);
return result;
@@ -1311,7 +1311,7 @@
jint trafficClass, jobject inetAddress)
{
PORT_ACCESS_FROM_ENV(env);
- jbyte *message = (jbyte *) address;
+ jbyte *message = (jbyte *) (IDATA)address;
jbyte nhostAddrBytes[HYSOCK_INADDR6_LEN];
int length;
@@ -1388,7 +1388,7 @@
(*env)->GetByteArrayRegion(env, data, offset, msgLength, message);
result =
Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
- (env, thisClz, fileDescriptor, (jlong) message, offset, msgLength,
+ (env, thisClz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
bindToDevice);
/* ok free the buffer and return the length sent */
hymem_free_memory(message);
@@ -1406,7 +1406,7 @@
jint offset, jint msgLength, jboolean bindToDevice)
{
PORT_ACCESS_FROM_ENV(env);
- jbyte *message = (jbyte *) address;
+ jbyte *message = (jbyte *) (IDATA)address;
I_32 result = 0;
I_32 sent = 0;
hysocket_t socketP;
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/bigint.c Fri Aug 22 00:15:00 2008
@@ -712,7 +712,6 @@
{
if (topSize >= topLength * 2)
{ /* allocate extra space */
- IDATA i;
U_32 *tempPtr;
jlongArray tempObject;
if (!(tempObject = NEW_OBJECT (topLength + 1)))
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/file.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/file.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/file.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/file.c Fri Aug 22 00:15:00 2008
@@ -180,7 +180,6 @@
JNIEXPORT jlong JNICALL
Java_java_io_File_getTotalSpaceImpl (JNIEnv * env, jobject recv, jbyteArray path)
{
- PORT_ACCESS_FROM_ENV (env);
char pathCopy[HyMaxPath];
jsize length = (*env)->GetArrayLength (env, path);
if(!Java_java_io_File_existsImpl(env, recv, path)) {
@@ -197,7 +196,6 @@
JNIEXPORT jlong JNICALL
Java_java_io_File_getFreeSpaceImpl (JNIEnv * env, jobject recv, jbyteArray path)
{
- PORT_ACCESS_FROM_ENV (env);
char pathCopy[HyMaxPath];
jsize length = (*env)->GetArrayLength (env, path);
if(!Java_java_io_File_existsImpl(env, recv, path)) {
@@ -214,7 +212,6 @@
JNIEXPORT jlong JNICALL
Java_java_io_File_getUsableSpaceImpl (JNIEnv * env, jobject recv, jbyteArray path)
{
- PORT_ACCESS_FROM_ENV (env);
char pathCopy[HyMaxPath];
jsize length = (*env)->GetArrayLength (env, path);
if(!Java_java_io_File_existsImpl(env, recv, path)) {
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/inetadds.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/inetadds.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/inetadds.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/inetadds.c Fri Aug 22 00:15:00 2008
@@ -65,7 +65,7 @@
return NULL;
}
- aliases = createAliasArrayFromAddrinfo (env, &addrinfo, (char *) str);
+ aliases = createAliasArrayFromAddrinfo (env, &addrinfo, str);
hysock_freeaddrinfo (&addrinfo);
(*env)->ReleaseStringUTFChars (env, aName, str);
return aliases;
@@ -267,14 +267,14 @@
if (NULL == strHost)
{
- return (jint) NULL;
+ return (jint) 0;
}
result = hysock_inetaddr ((char *) strHost, &nipAddr); /* Resolve the dotted ip string to an address */
(*env)->ReleaseStringUTFChars (env, host, strHost);
if (0 != result)
{
throwJavaNetUnknownHostException (env, result);
- return (jint) NULL;
+ return (jint) 0;
}
return (jint) hysock_ntohl (nipAddr);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c Fri Aug 22 00:15:00 2008
@@ -733,7 +733,7 @@
jobjectArray
createAliasArray (JNIEnv * env, jbyte ** addresses, I_32 * family, U_32 count,
- char *hName, U_32 * scope_id_array)
+ const char *hName, U_32 * scope_id_array)
{
U_32 i, length;
jobjectArray aliases = NULL;
@@ -786,7 +786,7 @@
jobjectArray
createAliasArrayFromAddrinfo (JNIEnv * env, hyaddrinfo_t addresses,
- char *hName)
+ const char *hName)
{
PORT_ACCESS_FROM_ENV (env);
U_32 count = 0;
@@ -1026,7 +1026,7 @@
jobject
newJavaNetInetAddressGenericBS (JNIEnv * env, jbyte * address, U_32 length,
- char *hostName, U_32 scope_id)
+ const char *hostName, U_32 scope_id)
{
jclass tempClass;
jmethodID tempMethod;
@@ -1571,7 +1571,7 @@
if (descriptor == 0)
{
/* hytty_get_chars() returns zero on EOF */
- if ((result = hytty_get_chars (buf, count)) == 0)
+ if ((result = hytty_get_chars ((char*)buf, count)) == 0)
result = -1;
}
else
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.h Fri Aug 22 00:15:00 2008
@@ -46,7 +46,7 @@
getJavaIoFileDescriptorContentsAsAPointer (JNIEnv * env, jobject fd);
void throwJavaNetBindException (JNIEnv * env, I_32 errorNumber);
jobject newJavaNetInetAddressGenericBS (JNIEnv * env, jbyte * address,
- U_32 length, char *hostName,
+ U_32 length, const char *hostName,
U_32 scope_id);
void throwJavaNetUnknownHostException (JNIEnv * env, I_32 errorNumber);
jobject newJavaNetInetAddressGenericB (JNIEnv * env, jbyte * address,
@@ -58,7 +58,7 @@
jobject newJavaByteArray (JNIEnv * env, jbyte * bytes, jint length);
jobjectArray createAliasArrayFromAddrinfo (JNIEnv * env,
hyaddrinfo_t addresses,
- char *hName);
+ const char *hName);
BOOLEAN booleanValue (JNIEnv * env, jobject aBoolean);
BOOLEAN harmony_supports_ipv6 (JNIEnv * env);
jobject newJavaLangInteger (JNIEnv * env, I_32 anInt);
@@ -77,7 +77,7 @@
U_32 * scope_id);
BOOLEAN preferIPv6Addresses (JNIEnv * env);
jobjectArray createAliasArray (JNIEnv * env, jbyte ** addresses,
- I_32 * family, U_32 count, char *hName,
+ I_32 * family, U_32 count, const char *hName,
U_32 * scope_id_array);
void throwJavaNetSocketException (JNIEnv * env, I_32 errorNumber);
I_32 netGetSockAddr (JNIEnv * env, jobject fileDescriptor,
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/netif.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/netif.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/netif.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/netif.c Fri Aug 22 00:15:00 2008
@@ -1152,7 +1152,7 @@
}
}
- /* generate the object with the inet addresses for the itnerface */
+ /* generate the object with the inet addresses for the interface */
for (i = 0; i < networkInterfaceArray.elements[j].numberAddresses; i++)
{
element = newJavaNetInetAddressGenericB (env,
@@ -1339,8 +1339,6 @@
jclass interfaceAddressClass = NULL;
jmethodID methodID = NULL;
- PORT_ACCESS_FROM_ENV (env);
-
interfaceAddressClass =
(*env)->FindClass (env, "java/net/InterfaceAddress");
if (interfaceAddressClass == NULL)
@@ -1407,6 +1405,8 @@
return interfaceAddresses;
}
+jbyteArray getPlatformGetHardwareAddress(JNIEnv * env, jstring ifname, jint index);
+
JNIEXPORT jbyteArray JNICALL
Java_java_net_NetworkInterface_getHardwareAddressImpl(JNIEnv * env, jobject obj, jstring ifname, jint index)
{
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Fri Aug 22 00:15:00 2008
@@ -57,7 +57,6 @@
// Alternative Select function
int
selectRead (JNIEnv * env,hysocket_t hysocketP, I_32 uSecTime, BOOLEAN accept){
- PORT_ACCESS_FROM_ENV (env);
I_32 result = 0;
I_32 timeout;
struct pollfd my_pollfd;
@@ -269,7 +268,7 @@
(*env)->DeleteLocalRef(env, gotFD);
/* hysocketP is -1 if the socket is closed */
- my_pollfds[val].fd = hysocketP == -1 ? -1 : hysocketP->sock;
+ my_pollfds[val].fd = (IDATA)hysocketP == -1 ? -1 : hysocketP->sock;
my_pollfds[val].events = POLLIN | POLLPRI;
my_pollfds[val].revents = 0;
}
@@ -280,7 +279,7 @@
(*env)->DeleteLocalRef(env, gotFD);
/* hysocketP is -1 if the socket is closed */
- my_pollfds[countReadC + val].fd = hysocketP == -1 ? -1 : hysocketP->sock;
+ my_pollfds[countReadC + val].fd = (IDATA)hysocketP == -1 ? -1 : hysocketP->sock;
my_pollfds[countReadC + val].events = POLLOUT;
my_pollfds[countReadC + val].revents = 0;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.c Fri Aug 22 00:15:00 2008
@@ -76,4 +76,4 @@
throwJavaIoIOException(env, "fails to set stdin attributes when echoing on.");
}
}
-
\ No newline at end of file
+
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.h?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/consoleimpl.h Fri Aug 22 00:15:00 2008
@@ -47,4 +47,4 @@
*/
JNIEXPORT void JNICALL Java_java_io_Console_setEchoOnImpl
(JNIEnv *, jclass);
-
\ No newline at end of file
+
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c Fri Aug 22 00:15:00 2008
@@ -551,13 +551,11 @@
}
}
-getNextNetlinkMsg (JNIEnv * env,
+jint getNextNetlinkMsg (JNIEnv * env,
struct netlinkContext_struct * netlinkContext,
struct nlmsghdr ** nextMessage)
{
- struct sockaddr_nl address;
U_32 receiveLength;
- socklen_t addressLength = sizeof (address);
PORT_ACCESS_FROM_ENV (env);
@@ -611,8 +609,6 @@
int reallocLoop = 1;
while (reallocLoop) {
- int len = recvmsg(netlinkContext->netlinkSocketHandle, &msg, MSG_PEEK);
-
/*
* if the peek shows that we would truncate, realloc to 2x the buffer size
*/
@@ -673,8 +669,8 @@
}
/* we are done if the NLM_F_MULTI flag is not set in this header */
*nextMessage = netlinkContext->netlinkHeader;
- if (netlinkContext->netlinkHeader->nlmsg_flags & NLM_F_MULTI !=
- NLM_F_MULTI)
+ if (netlinkContext->netlinkHeader->nlmsg_flags & (NLM_F_MULTI !=
+ NLM_F_MULTI))
{
netlinkContext->done = 1;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h?rev=687988&r1=687987&r2=687988&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.h Fri Aug 22 00:15:00 2008
@@ -20,6 +20,7 @@
#include "vmi.h"
#include "hysock.h"
+struct stat;
/* structure for returning interface address information */
typedef struct interfaceAddress_struct
{