- Update to upstream SVN r700; drop all now upstreamed patches
This commit is contained in:
parent
8e879d7f94
commit
85c51a9364
@ -1 +0,0 @@
|
||||
jna-3.0.4.svn630.tar.bz2
|
@ -1,66 +0,0 @@
|
||||
diff -ur jna-3.0.4-svn630/src/com/sun/jna/CallbackReference.java jna-3.0.4-svn630.orig/src/com/sun/jna/CallbackReference.java
|
||||
--- jna-3.0.4-svn630/src/com/sun/jna/CallbackReference.java 2008-07-31 13:44:21.000000000 -0400
|
||||
+++ jna-3.0.4-svn630.orig/src/com/sun/jna/CallbackReference.java 2008-09-03 09:04:35.000000000 -0400
|
||||
@@ -16,6 +16,7 @@
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -150,22 +151,45 @@
|
||||
}
|
||||
return cls;
|
||||
}
|
||||
+
|
||||
+ private static Method checkMethod(Method m) {
|
||||
+ if (m.getParameterTypes().length > Function.MAX_NARGS) {
|
||||
+ String msg = "Method signature exceeds the maximum "
|
||||
+ + "parameter count: " + m;
|
||||
+ throw new IllegalArgumentException(msg);
|
||||
+ }
|
||||
+ return m;
|
||||
+ }
|
||||
|
||||
private static Method getCallbackMethod(Callback callback) {
|
||||
- Method[] mlist = callback.getClass().getMethods();
|
||||
+ Class klass = callback.getClass();
|
||||
+ Method[] mlist = klass.getDeclaredMethods();
|
||||
+
|
||||
+ /* If there's only one method, just try it. */
|
||||
+ if (mlist.length == 1)
|
||||
+ return checkMethod(mlist[0]);
|
||||
+
|
||||
+ /* Now try looking for a field named "METHOD_NAME" which
|
||||
+ * tells us which method to use.
|
||||
+ */
|
||||
+ String methName = Callback.METHOD_NAME;
|
||||
+ try {
|
||||
+ Field methNameField = klass.getField("METHOD_NAME");
|
||||
+ methName = (String) methNameField.get(null);
|
||||
+ } catch (NoSuchFieldException e) {
|
||||
+ } catch (Exception e) {
|
||||
+ String msg = "Callback METHOD_NAME field is invalid";
|
||||
+ throw new IllegalArgumentException(msg);
|
||||
+ }
|
||||
+
|
||||
for (int mi=0;mi < mlist.length;mi++) {
|
||||
Method m = mlist[mi];
|
||||
- if (Callback.METHOD_NAME.equals(m.getName())) {
|
||||
- if (m.getParameterTypes().length > Function.MAX_NARGS) {
|
||||
- String msg = "Method signature exceeds the maximum "
|
||||
- + "parameter count: " + m;
|
||||
- throw new IllegalArgumentException(msg);
|
||||
- }
|
||||
- return m;
|
||||
+ if (methName.equals(m.getName())) {
|
||||
+ return checkMethod(m);
|
||||
}
|
||||
}
|
||||
String msg = "Callback must implement method named '"
|
||||
- + Callback.METHOD_NAME + "'";
|
||||
+ + methName + "'";
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
|
@ -1,81 +0,0 @@
|
||||
Only in jna-3.0.4-svn630.orig/: build-d64
|
||||
Only in jna-3.0.4-svn630.orig/: build.number
|
||||
Only in jna-3.0.4-svn630.orig/: debugfiles.list
|
||||
Only in jna-3.0.4-svn630.orig/: debuglinks.list
|
||||
Only in jna-3.0.4-svn630.orig/: debugsources.list
|
||||
Only in jna-3.0.4-svn630.orig/doc: javadoc
|
||||
diff -ur jna-3.0.4-svn630/src/com/sun/jna/Native.java jna-3.0.4-svn630.orig/src/com/sun/jna/Native.java
|
||||
--- jna-3.0.4-svn630/src/com/sun/jna/Native.java 2008-09-01 12:12:50.000000000 -0400
|
||||
+++ jna-3.0.4-svn630.orig/src/com/sun/jna/Native.java 2008-09-01 12:12:27.000000000 -0400
|
||||
@@ -51,7 +51,9 @@
|
||||
* which would require every {@link Structure} which requires custom mapping
|
||||
* or alignment to define a constructor and pass parameters to the superclass.
|
||||
* To avoid lots of boilerplate, the base {@link Structure} constructor
|
||||
- * figures out these properties based on its enclosing interface.<p>
|
||||
+ * figures out these properties based on its enclosing interface. Alternatively,
|
||||
+ * A field named TYPE_MAPPER may be declared.
|
||||
+ * <p>
|
||||
* <a name=library_loading></a>
|
||||
* <h2>Library Loading</h2>
|
||||
* When JNA classes are loaded, the native shared library (jnidispatch) is
|
||||
@@ -350,32 +352,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ private static final TypeMapper getClassTypeMapper(Class cls) {
|
||||
+ try {
|
||||
+ Field field = cls.getField("TYPE_MAPPER");
|
||||
+ return (TypeMapper) field.get(null);
|
||||
+ }
|
||||
+ catch (NoSuchFieldException e) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ catch (Exception e) {
|
||||
+ throw new IllegalArgumentException("TYPE_MAPPER must be a public field of type "
|
||||
+ + TypeMapper.class.getName() + " ("
|
||||
+ + e + "): " + cls);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/** Return the preferred {@link TypeMapper} for the given native interface.
|
||||
* See {@link com.sun.jna.Library#OPTION_TYPE_MAPPER}.
|
||||
*/
|
||||
public static TypeMapper getTypeMapper(Class cls) {
|
||||
+ if (Callback.class.isAssignableFrom(cls)) {
|
||||
+ return getClassTypeMapper(cls);
|
||||
+ }
|
||||
synchronized(libraries) {
|
||||
Class interfaceClass = findLibraryClass(cls);
|
||||
if (interfaceClass == null)
|
||||
return null;
|
||||
+ TypeMapper mapper = getClassTypeMapper(interfaceClass);
|
||||
+ if (mapper != null) {
|
||||
+ typeMappers.put(interfaceClass, mapper);
|
||||
+ } else {
|
||||
+ Map options = getLibraryOptions(cls);
|
||||
+ if (options != null
|
||||
+ && options.containsKey(Library.OPTION_TYPE_MAPPER)) {
|
||||
+ typeMappers.put(interfaceClass, options.get(Library.OPTION_TYPE_MAPPER));
|
||||
+ }
|
||||
+ }
|
||||
if (!loadInstance(interfaceClass)
|
||||
|| !typeMappers.containsKey(interfaceClass)) {
|
||||
- try {
|
||||
- Field field = interfaceClass.getField("TYPE_MAPPER");
|
||||
- typeMappers.put(interfaceClass, field.get(null));
|
||||
- }
|
||||
- catch (NoSuchFieldException e) {
|
||||
- Map options = getLibraryOptions(cls);
|
||||
- if (options != null
|
||||
- && options.containsKey(Library.OPTION_TYPE_MAPPER)) {
|
||||
- typeMappers.put(interfaceClass, options.get(Library.OPTION_TYPE_MAPPER));
|
||||
- }
|
||||
- }
|
||||
- catch (Exception e) {
|
||||
- throw new IllegalArgumentException("TYPE_MAPPER must be a public field of type "
|
||||
- + TypeMapper.class.getName() + " ("
|
||||
- + e + "): " + interfaceClass);
|
||||
- }
|
||||
}
|
||||
return (TypeMapper)typeMappers.get(interfaceClass);
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
diff -ur jna-3.0.4.orig/build.xml jna-3.0.4-svn630/build.xml
|
||||
--- jna-3.0.4.orig/build.xml 2008-07-31 13:44:34.000000000 -0400
|
||||
+++ jna-3.0.4-svn630/build.xml 2008-07-31 14:08:58.000000000 -0400
|
||||
@@ -348,17 +348,7 @@
|
||||
<arg value="VERSION=${jni.version}"/>
|
||||
<arg value="CHECKSUM=${jni.md5}"/>
|
||||
</exec>
|
||||
- <mkdir dir="${classes}/com/sun/jna/${os.prefix}"/>
|
||||
- <copy todir="${classes}/com/sun/jna/${os.prefix}">
|
||||
- <fileset dir="${build.native}"
|
||||
- includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
- </copy>
|
||||
- <mkdir dir="${eclipse.classes}/com/sun/jna/${os.prefix}"/>
|
||||
- <copy todir="${eclipse.classes}/com/sun/jna/${os.prefix}"
|
||||
- failonerror="false">
|
||||
- <fileset dir="${build.native}"
|
||||
- includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
- </copy>
|
||||
+ <antcall target="copy-native"/>
|
||||
<!-- For web start, native libraries may be provided in the root of -->
|
||||
<!-- an included jar file -->
|
||||
<jar jarfile="${build}/${native.jar}">
|
||||
@@ -369,6 +359,20 @@
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
+
|
||||
+ <target name="copy-native" unless="nomixedjar.native">
|
||||
+ <mkdir dir="${classes}/com/sun/jna/${os.prefix}" unless="nomixedjar.native"/>
|
||||
+ <copy todir="${classes}/com/sun/jna/${os.prefix}" unless="nomixedjar.native">
|
||||
+ <fileset dir="${build.native}"
|
||||
+ includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
+ </copy>
|
||||
+ <mkdir dir="${eclipse.classes}/com/sun/jna/${os.prefix}"/>
|
||||
+ <copy todir="${eclipse.classes}/com/sun/jna/${os.prefix}"
|
||||
+ failonerror="false">
|
||||
+ <fileset dir="${build.native}"
|
||||
+ includes="jnidispatch.dll,libjnidispatch.*"/>
|
||||
+ </copy>
|
||||
+ </target>
|
||||
|
||||
<target name="compile-tests" depends="compile,native"
|
||||
description="Compile all test code">
|
@ -1,40 +0,0 @@
|
||||
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);
|
@ -1,46 +0,0 @@
|
||||
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.
|
24
jna.spec
24
jna.spec
@ -1,6 +1,6 @@
|
||||
Name: jna
|
||||
Version: 3.0.4
|
||||
Release: 3.svn630%{?dist}
|
||||
Release: 4.svn700%{?dist}
|
||||
Summary: Pure Java access to native libraries
|
||||
|
||||
Group: Development/Libraries
|
||||
@ -10,20 +10,10 @@ URL: https://jna.dev.java.net/
|
||||
# following commands to generate the tarball:
|
||||
# svn export https://jna.dev.java.net/svn/jna/tags/%{version}/jnalib/ --username guest jna-%{version}
|
||||
# tar -cjf jna-%{version}.tar.bz2 jna-%{version}
|
||||
Source0: %{name}-%{version}.svn630.tar.bz2
|
||||
Source0: %{name}-%{version}.svn700.tar.bz2
|
||||
# This patch is Fedora-specific for now until we get the huge
|
||||
# JNI library location mess sorted upstream
|
||||
Patch1: jna-3.0.2-loadlibrary.patch
|
||||
# Will send upstream...
|
||||
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=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
|
||||
@ -52,13 +42,8 @@ This package contains the javadocs for %{name}.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}-svn630
|
||||
%setup -q -n %{name}-%{version}-svn700
|
||||
sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH1} | patch -p1
|
||||
%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 '{}' \;
|
||||
@ -115,6 +100,9 @@ rm -rf %{buildroot}
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Sep 09 2008 Colin Walters <walters@redhat.com> - 3.0.4-4.svn700
|
||||
- Update to upstream SVN r700; drop all now upstreamed patches
|
||||
|
||||
* Sat Sep 06 2008 Colin Walters <walters@redhat.com> - 3.0.4-3.svn630
|
||||
- A few more patches for JGIR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user