rpms/jna/devel jna-3.0.4-structure-handle-null.patch, NONE, 1.1 jna-3.0.4-structure-reason.patch, NONE, 1.1 jna.spec, 1.5, 1.6

Colin Walters walters at fedoraproject.org
Sat Sep 6 22:13:52 UTC 2008


Author: walters

Update of /cvs/pkgs/rpms/jna/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13135

Modified Files:
	jna.spec 
Added Files:
	jna-3.0.4-structure-handle-null.patch 
	jna-3.0.4-structure-reason.patch 
Log Message:
* Sat Sep 06 2008 Colin Walters <walters at redhat.com> - 3.0.4-3.svn630
- A few more patches for JGIR


jna-3.0.4-structure-handle-null.patch:

--- NEW FILE jna-3.0.4-structure-handle-null.patch ---
diff -ur jna-3.0.4-svn630/src/com/sun/jna/Structure.java jna-3.0.4-svn630.orig/src/com/sun/jna/Structure.java
--- jna-3.0.4-svn630/src/com/sun/jna/Structure.java	2008-09-05 21:49:16.000000000 -0400
+++ jna-3.0.4-svn630.orig/src/com/sun/jna/Structure.java	2008-09-06 17:43:34.000000000 -0400
@@ -612,28 +612,28 @@
 
         // Set the value at the offset according to its type
         if (nativeType == boolean.class || nativeType == Boolean.class) {
-            memory.setInt(offset, Boolean.TRUE.equals(value) ? -1 : 0);
+            memory.setInt(offset, (value != null && Boolean.TRUE.equals(value)) ? -1 : 0);
         }
         else if (nativeType == byte.class || nativeType == Byte.class) {
-            memory.setByte(offset, ((Byte)value).byteValue());
+            memory.setByte(offset, value != null ? ((Byte)value).byteValue() : 0);
         }
         else if (nativeType == short.class || nativeType == Short.class) {
-            memory.setShort(offset, ((Short)value).shortValue());
+            memory.setShort(offset, value != null ? ((Short)value).shortValue() : 0);
         }
         else if (nativeType == char.class || nativeType == Character.class) {
-            memory.setChar(offset, ((Character)value).charValue());
+            memory.setChar(offset, value != null ? ((Character)value).charValue() : '\0');
         }
         else if (nativeType == int.class || nativeType == Integer.class) {
-            memory.setInt(offset, ((Integer)value).intValue());
+            memory.setInt(offset, value != null ? ((Integer)value).intValue() : 0);
         }
         else if (nativeType == long.class || nativeType == Long.class) {
-            memory.setLong(offset, ((Long)value).longValue());
+            memory.setLong(offset, value != null ? ((Long)value).longValue() : 0);
         }
         else if (nativeType == float.class || nativeType == Float.class) {
-            memory.setFloat(offset, ((Float)value).floatValue());
+            memory.setFloat(offset, value != null ? ((Float)value).floatValue() : 0.0f);
         }
         else if (nativeType == double.class || nativeType == Double.class) {
-            memory.setDouble(offset, ((Double)value).doubleValue());
+            memory.setDouble(offset, value != null ? ((Double)value).doubleValue() : 0.0);
         }
         else if (nativeType == Pointer.class) {
             memory.setPointer(offset, (Pointer)value);

jna-3.0.4-structure-reason.patch:

--- NEW FILE jna-3.0.4-structure-reason.patch ---
diff -ur jna-3.0.4-svn630/src/com/sun/jna/Structure.java jna-3.0.4-svn630.orig/src/com/sun/jna/Structure.java
--- jna-3.0.4-svn630/src/com/sun/jna/Structure.java	2008-07-31 13:44:21.000000000 -0400
+++ jna-3.0.4-svn630.orig/src/com/sun/jna/Structure.java	2008-09-05 21:47:51.000000000 -0400
@@ -126,8 +126,16 @@
     }
 
     protected Structure(int size, int alignment) {
+	this(size, alignment, null);
+    }
+
+    protected Structure(TypeMapper mapper) {
+	this(CALCULATE_SIZE, ALIGN_DEFAULT, mapper);
+    }
+
+    protected Structure(int size, int alignment, TypeMapper mapper) {
         setAlignType(alignment);
-        setTypeMapper(null);
+        setTypeMapper(mapper);
         allocateMemory(size);
     }
 
@@ -974,7 +982,8 @@
         }
         catch(IllegalArgumentException e) {
             throw new IllegalArgumentException("The type \"" + type.getName()
-                                               + "\" is not supported as a structure field");
+                                               + "\" is not supported as a structure field: "
+					       + e.getMessage());
         }
     }
 
diff -ur jna-3.0.4-svn630/src/com/sun/jna/Union.java jna-3.0.4-svn630.orig/src/com/sun/jna/Union.java
--- jna-3.0.4-svn630/src/com/sun/jna/Union.java	2008-07-31 13:44:21.000000000 -0400
+++ jna-3.0.4-svn630.orig/src/com/sun/jna/Union.java	2008-09-05 21:47:18.000000000 -0400
@@ -39,6 +39,11 @@
     protected Union(int size, int alignType) {
         super(size, alignType);
     }
+
+    protected Union(TypeMapper mapper) {
+	super(mapper);
+    }
+
     /** Indicates which field will be used to write to native memory. 
      * @throws IllegalArgumentException if the type does not correspond to 
      * any declared union field.


Index: jna.spec
===================================================================
RCS file: /cvs/pkgs/rpms/jna/devel/jna.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- jna.spec	4 Sep 2008 19:00:45 -0000	1.5
+++ jna.spec	6 Sep 2008 22:13:22 -0000	1.6
@@ -1,6 +1,6 @@
 Name:           jna
 Version:        3.0.4
-Release:        2.svn630%{?dist}
+Release:        3.svn630%{?dist}
 Summary:        Pure Java access to native libraries
 
 Group:          Development/Libraries
@@ -18,8 +18,12 @@
 Patch2:         jna-3.0.4-nomixedjar.patch
 # https://jna.dev.java.net/issues/show_bug.cgi?id=84
 Patch3:         jna-3.0.4-callbacks-typemappers.patch
-# https://jna.dev.java.net/issues/show_bug.cgi?id=XXX
+# https://jna.dev.java.net/issues/show_bug.cgi?id=85
 Patch4:         jna-3.0.4-callbacks-methodname.patch
+# https://jna.dev.java.net/issues/show_bug.cgi?id=86
+Patch5:         jna-3.0.4-structure-reason.patch 
+# https://jna.dev.java.net/issues/show_bug.cgi?id=87
+Patch6:         jna-3.0.4-structure-handle-null.patch 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  java-devel >= 1.6 ant jpackage-utils ant-nodeps
@@ -53,6 +57,8 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 # all java binaries must be removed from the sources
 find . -name '*.jar' -exec rm -f '{}' \;
@@ -109,6 +115,9 @@
 
 
 %changelog
+* Sat Sep 06 2008 Colin Walters <walters at redhat.com> - 3.0.4-3.svn630
+- A few more patches for JGIR
+
 * Thu Sep 04 2008 Colin Walters <walters at redhat.com> - 3.0.4-2.svn630
 - Add two (sent upstream) patches that I need for JGIR
 




More information about the fedora-extras-commits mailing list