changeset 110:239695497634

2009-09-08 Omair Majid <omajid@redhat.com> * src/java/org/classpath/icedtea/pulseaudio/EventLoop.java Changed type of contextPointer and mainloopPointer to byte[] from long. (native_set_sink_volume): Changed type of first paramter to byte[] to store a pointer reliably. (setVolume): Likewise. (getContextPointer): Changed return type to byte[]. (getMainLoopPointer): Likewise. (nativeUpdateTargetPortNameList): Likewise. (nativeUpdateSourcePortList): Likewise. * src/java/org/classpath/icedtea/pulseaudio/Operation.java Changed type of operationPoiter to byte[] from long. (Operation): Changed type of first prameter to byte[] from long. Fixed comparisons to work with byte[]. (finalize): Fixed comparisons to work with byte[]. (addReference): Likewise. (releaseReference): Likewise. (isNull): Likewise. (getState): Likewise. * src/java/org/classpath/icedtea/pusleaudio/PulseAudioClip.java (native_setVolume): Changed return type to byte[]. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java (native_setVolume): Likewise. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java Changed type of contextPointer to byte[]. (native_setVolume): Changed return type to byte[]. (native_updateVolumeInfo): Likewise. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java (native_setVolume): Likewise. * src/java/org/classpath/icedtea/pulseaudio/PulseAuiodSourcePort.java (native_setVolume): Likewise. (native_updateVolumeInfo): Likewise. * src/java/org/classpath/icedtea/pulseuaiod/PulseAudioTargetDataLine.java Changed type of streamPointer to byte[]. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java (native_setVolume): Changed return type to byte[]. (native_updateVolumeInfo): Likewise. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java Changed type of streamPointer to byte[]. * src/java/org/classpath/icedtea/pulseaudio/Stream.java Changed type of streamPointer to byte[]. (native_pa_stream_new): Changed type of pointer paramters to byte[]. (native_pa_stream_get_context): Changed return type to byte[]. (native_pa_stream_connect_playback): Changed type of pointer parameters to byte[]. (native_pa_stream_connect_record): Likewise. (native_pa_stream_drain): Changed return type to byte[]. (native_pa_stream_cork): Likewise. (native_pa_stream_flush): Likewise. (native_pa_stream_trigger): Likewise. (native_pa_stream_set_name): Likewise. (native_pa_stream_set_buffer_attr): Likewise. (native_pa_stream_update_sample_rate): Likewise. (native_setVolume): Likewise. (Stream): Changed type of pointer paramters to byte[] from long. (getContextPointer): Changed return type to byte[]. (connectForPlayback): Changed parameter values to work with byte[]. (connectForRecording): Likewise. (getStreamPointer): Changed return type to byte[]. * src/native/jni-common.c (getJavaByteArrayField): New function. Returns the byte[] corresponding to an object's field. (setJavaByteArrayFiled): New function. Sets the byte[] of an object's field. (getLockObject): Fixed class descriptor. (notifyWaitingOperations): Likewise. (getJavaPointer): Use the byte[] to obtain the pointer's contents. (setJavaPointer): Use the byte[] to set the pointer's contents. (convertJavaLongToPointer): Removed method. (convertJavaPointerToNative): New method. Converts a byte[] into a void*. (convertJavaPointerToLong: Removed method. (convertNativePointerToJava): New method. Converts a void* into a byte[]. * src/native/jni-common.h Removed jPointer data type. (getByteArrayField): New method. (setByteArrayField): New method. (convertJavaLongToPointer): Removed method. (convertPointerToJavaLong): Likewise. (convertJavaPointerToNative): New method. (convertNativePointerToJava): Likewise. * src/native/org_classpath_icedtea_pulseaudio_EventLoop.c (Java_org_classpath_icedtea_pulseaudio_EventLoop_nativeUpdateTargetPortNameList): Fixed method to work with a byte[]. (Java_org_classpath_icedtea_pulseaudio_EventLoop_nativeUpdateSourcePortNameList): Likewise. (Java_org_classpath_icedtea_pulseaudio_EventLoop_native_1set_1sink_1volume): Likewise. * src/native/org_classapath_icedtea_pulseaudio_PulseAudioSourcePort.c (Java_org_classpath_icedtea_pulseaudio_PulseAudioSourcePort_native_1updateVolumeInfo): Likewise. (Java_org_classpath_icedtea_pulseaudio_PulseAudioSourcePort_native_1setVolume): Likewise. * src/native/org_classpath_icedtea_pulseaudio_PulseAudioTargetPort.c (Java_org_classpath_icedtea_pulseaudio_PulseAudioTargetPort_native_1updateVolumeInfo): Likewise. (Java_org_classpath_icedtea_pulseaudio_PulseAudioTargetPort_native_1setVolume): Likewise. * src/native/org_classpath_icedtea_pulseaudio_Stream.c (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1new): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1get_1context): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1connect_1playback): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1connect_1record): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1drain): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1cork): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1flush): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1trigger): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1set_1name): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1set_1buffer_1attr): Likewise. (Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1update_1sample_1rate): Likewise. (JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1setVolume): Likewise.
author Omair Majid <omajid@redhat.com>
date Mon, 08 Sep 2008 11:09:02 -0400
parents c0fcd9764516
children 6fa7b2b70780
files src/java/org/classpath/icedtea/pulseaudio/EventLoop.java src/java/org/classpath/icedtea/pulseaudio/Operation.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java src/java/org/classpath/icedtea/pulseaudio/Stream.java src/native/jni-common.c src/native/jni-common.h src/native/org_classpath_icedtea_pulseaudio_EventLoop.c src/native/org_classpath_icedtea_pulseaudio_PulseAudioSourcePort.c src/native/org_classpath_icedtea_pulseaudio_PulseAudioTargetPort.c src/native/org_classpath_icedtea_pulseaudio_Stream.c
diffstat 17 files changed, 275 insertions(+), 230 deletions(-) [+]
line wrap: on
line diff
--- a/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java	Mon Sep 08 11:09:02 2008 -0400
@@ -89,7 +89,7 @@
 
 	private native void native_shutdown();
 
-	private native void native_set_sink_volume(long streamPointer, int volume);
+	private native void native_set_sink_volume(byte[] streamPointer, int volume);
 
 	/*
 	 * These fields hold pointers
@@ -97,9 +97,9 @@
 	 * 
 	 */
 	@SuppressWarnings("unused")
-	private long contextPointer;
+	private byte[] contextPointer;
 	@SuppressWarnings("unused")
-	private long mainloopPointer;
+	private byte[] mainloopPointer;
 
 	/*
 	 * 
@@ -230,23 +230,23 @@
 
 	}
 
-	public void setVolume(long streamPointer, int volume) {
+	public void setVolume(byte[] streamPointer, int volume) {
 		synchronized (threadLock) {
 			native_set_sink_volume(streamPointer, volume);
 		}
 	}
 
-	public long getContextPointer() {
+	public byte[] getContextPointer() {
 		return contextPointer;
 	}
 
-	public long getMainLoopPointer() {
+	public byte[] getMainLoopPointer() {
 		return mainloopPointer;
 	}
 
-	private native long nativeUpdateTargetPortNameList();
+	private native byte[] nativeUpdateTargetPortNameList();
 
-	private native long nativeUpdateSourcePortNameList();
+	private native byte[] nativeUpdateSourcePortNameList();
 
 	protected synchronized List<String> updateTargetPortNameList() {
 		targetPortNameList = new ArrayList<String>();
--- a/src/java/org/classpath/icedtea/pulseaudio/Operation.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/Operation.java	Mon Sep 08 11:09:02 2008 -0400
@@ -51,7 +51,7 @@
 
 public class Operation {
 
-	long operationPointer;
+	byte[] operationPointer;
 	EventLoop eventLoop;
 
 	public enum State {
@@ -77,8 +77,8 @@
 
 	private native int native_get_state();
 
-	public Operation(long operationPointer) {
-		assert (operationPointer != 0);
+	public Operation(byte[] operationPointer) {
+		assert (operationPointer != null);
 		this.operationPointer = operationPointer;
 		this.eventLoop = EventLoop.getEventLoop();
 	}
@@ -86,34 +86,34 @@
 	@Override
 	protected void finalize() throws Throwable {
 		// might catch operations which havent been released
-		assert (operationPointer == 0);
+		assert (operationPointer == null);
 		super.finalize();
 	}
 
 	public void addReference() {
-		assert (operationPointer != 0);
+		assert (operationPointer != null);
 		synchronized (eventLoop.threadLock) {
 			native_ref();
 		}
 	}
 
 	public void releaseReference() {
-		assert (operationPointer != 0);
+		assert (operationPointer != null);
 		synchronized (eventLoop.threadLock) {
 			native_unref();
 		}
-		operationPointer = 0;
+		operationPointer = null;
 	}
 
 	public boolean isNull() {
-		if (operationPointer == 0) {
+		if (operationPointer == null) {
 			return true;
 		}
 		return false;
 	}
 
 	public State getState() {
-		assert (operationPointer != 0);
+		assert (operationPointer != null);
 		int state;
 		synchronized (eventLoop.threadLock) {
 			state = native_get_state();
@@ -132,7 +132,7 @@
 	}
 
 	public void waitForCompletion() {
-		assert (operationPointer != 0);
+		assert (operationPointer != null);
 		do {
 			synchronized (eventLoop.threadLock) {
 				if (getState() == Operation.State.Done) {
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Mon Sep 08 11:09:02 2008 -0400
@@ -313,7 +313,7 @@
 
 	}
 
-	public long native_setVolume(float value) {
+	public byte[] native_setVolume(float value) {
 		return stream.native_setVolume(value);
 	}
 
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java	Mon Sep 08 11:09:02 2008 -0400
@@ -39,7 +39,7 @@
 
 interface PulseAudioPlaybackLine {
 
-	long native_setVolume(float value);
+	byte[] native_setVolume(float value);
 
 	boolean isMuted();
 
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPort.java	Mon Sep 08 11:09:02 2008 -0400
@@ -51,7 +51,7 @@
 	 * Variable used in native code
 	 */
 	@SuppressWarnings("unused")
-	private long contextPointer;
+	private byte[] contextPointer;
 	@SuppressWarnings("unused")
 	private int channels;
 
@@ -78,9 +78,9 @@
 		System.out.println("Opened Target Port " + name);
 	}
 
-	public abstract long native_setVolume(float newValue);
+	public abstract byte[] native_setVolume(float newValue);
 
-	public abstract long native_updateVolumeInfo();
+	public abstract byte[] native_updateVolumeInfo();
 
 	public boolean isMuted() {
 		return muted;
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Mon Sep 08 11:09:02 2008 -0400
@@ -82,7 +82,7 @@
 
 	}
 
-	public long native_setVolume(float value) {
+	public byte[] native_setVolume(float value) {
 		return stream.native_setVolume(value);
 	}
 
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java	Mon Sep 08 11:09:02 2008 -0400
@@ -45,9 +45,9 @@
 		super(name, eventLoop);
 	}
 
-	public native long native_setVolume(float newValue);
+	public native byte[] native_setVolume(float newValue);
 
-	public synchronized native long native_updateVolumeInfo();
+	public synchronized native byte[] native_updateVolumeInfo();
 
 	@Override
 	public javax.sound.sampled.Line.Info getLineInfo() {
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	Mon Sep 08 11:09:02 2008 -0400
@@ -47,7 +47,7 @@
 	private long currentFramePosition = 0;
 
 	@SuppressWarnings("unused")
-	private long streamPointer;
+	private byte[] streamPointer;
 
 	public PulseAudioTargetDataLine(EventLoop eventLoop, AudioFormat[] formats,
 			AudioFormat defaultFormat) {
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java	Mon Sep 08 11:09:02 2008 -0400
@@ -45,9 +45,9 @@
 		super(name, eventLoop);
 	}
 
-	public native long native_setVolume(float newValue);
+	public native byte[] native_setVolume(float newValue);
 
-	public synchronized native long native_updateVolumeInfo();
+	public synchronized native byte[] native_updateVolumeInfo();
 
 	@Override
 	public javax.sound.sampled.Line.Info getLineInfo() {
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioVolumeControl.java	Mon Sep 08 11:09:02 2008 -0400
@@ -56,7 +56,7 @@
 	}
 
 	@SuppressWarnings("unused")
-	private long streamPointer;
+	private byte[] streamPointer;
 
 	private EventLoop eventLoop;
 	private PulseAudioPlaybackLine line;
--- a/src/java/org/classpath/icedtea/pulseaudio/Stream.java	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/Stream.java	Mon Sep 08 11:09:02 2008 -0400
@@ -96,7 +96,7 @@
 	public static final String DEFAULT_DEVICE = null;
 
 	@SuppressWarnings("unused")
-	private long streamPointer;
+	private byte[] streamPointer;
 
 	static {
 		try {
@@ -123,12 +123,12 @@
 	private List<MovedListener> movedListeners;
 	private List<SuspendedListener> suspendedListeners;
 
-	private native void native_pa_stream_new(long contextPointer, String name,
+	private native void native_pa_stream_new(byte[] contextPointer, String name,
 			String format, int sampleRate, int channels);
 
 	private native int native_pa_stream_get_state();
 
-	private native long native_pa_stream_get_context();
+	private native byte[] native_pa_stream_get_context();
 
 	private native int native_pa_stream_get_index();
 
@@ -141,14 +141,14 @@
 	private native int native_pa_stream_connect_playback(String name,
 			int bufferMaxLength, int bufferTargetLength,
 			int bufferPreBuffering, int bufferMinimumRequest,
-			int bufferFragmentSize, int flags, long volumePointer,
-			long sync_streamPointer);
+			int bufferFragmentSize, int flags, byte[] volumePointer,
+			byte[] sync_streamPointer);
 
 	private native int native_pa_stream_connect_record(String name,
 			int bufferMaxLength, int bufferTargetLength,
 			int bufferPreBuffering, int bufferMinimumRequest,
-			int bufferFragmentSize, int flags, long volumePointer,
-			long sync_streamPointer);
+			int bufferFragmentSize, int flags, byte[] volumePointer,
+			byte[] sync_streamPointer);
 
 	private native int native_pa_stream_disconnect();
 
@@ -166,7 +166,7 @@
 
 	private native int native_pa_stream_readable_size();
 
-	private native long native_pa_stream_drain();
+	private native byte[] native_pa_stream_drain();
 
 	/*
 	 * pa_operation pa_stream_update_timing_info (pa_stream *p,
@@ -174,9 +174,9 @@
 	 * structure update for a stream.
 	 */
 
-	private native long native_pa_stream_cork(int b);
+	private native byte[] native_pa_stream_cork(int b);
 
-	private native long native_pa_stream_flush();
+	private native byte[] native_pa_stream_flush();
 
 	/*
 	 * pa_operation pa_stream_prebuf (pa_stream *s, pa_stream_success_cb_t cb,
@@ -184,10 +184,10 @@
 	 * structure.
 	 */
 
-	private native long native_pa_stream_trigger();
+	private native byte[] native_pa_stream_trigger();
 
 	/* returns an operationPointer */
-	private native long native_pa_stream_set_name(String name);
+	private native byte[] native_pa_stream_set_name(String name);
 
 	/* Return the current playback/recording time */
 	private native long native_pa_stream_get_time();
@@ -209,11 +209,11 @@
 	 */
 	native StreamBufferAttributes native_pa_stream_get_buffer_attr();
 
-	native long native_pa_stream_set_buffer_attr(StreamBufferAttributes info);
+	native byte[] native_pa_stream_set_buffer_attr(StreamBufferAttributes info);
 
-	private native long native_pa_stream_update_sample_rate(int rate);
+	private native byte[] native_pa_stream_update_sample_rate(int rate);
 
-	public native long native_setVolume(float newValue);
+	public native byte[] native_setVolume(float newValue);
 
 	/*
 	 * pa_operation pa_stream_proplist_update (pa_stream *s, pa_update_mode_t
@@ -229,7 +229,7 @@
 	 * pa_stream_set_monitor_stream() ebfore.
 	 */
 
-	public Stream(long contextPointer, String name, Format format,
+	public Stream(byte[] contextPointer, String name, Format format,
 			int sampleRate, int channels) {
 		// System.out.println("format: " + format.toString());
 
@@ -380,7 +380,7 @@
 
 	}
 
-	public long getContextPointer() {
+	public byte[] getContextPointer() {
 		return native_pa_stream_get_context();
 	}
 
@@ -429,7 +429,7 @@
 				bufferAttributes.getMaxLength(), bufferAttributes
 						.getTargetLength(), bufferAttributes.getPreBuffering(),
 				bufferAttributes.getMinimumRequest(), bufferAttributes
-						.getFragmentSize(), 0, 0, 0);
+						.getFragmentSize(), 0, null, null);
 		assert (returnValue == 0);
 	}
 
@@ -444,7 +444,7 @@
 				bufferAttributes.getMaxLength(), bufferAttributes
 						.getTargetLength(), bufferAttributes.getPreBuffering(),
 				bufferAttributes.getMinimumRequest(), bufferAttributes
-						.getFragmentSize(), 0, 0, 0);
+						.getFragmentSize(), 0, null, null);
 		assert (returnValue == 0);
 	}
 
@@ -718,7 +718,7 @@
 
 	}
 
-	public long getStreamPointer() {
+	public byte[] getStreamPointer() {
 		return streamPointer;
 	}
 
--- a/src/native/jni-common.c	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/native/jni-common.c	Mon Sep 08 11:09:02 2008 -0400
@@ -38,6 +38,7 @@
 #include "jni-common.h"
 
 #include <assert.h>
+#include <string.h>
 
 /*
  * Throw an exception by name
@@ -85,6 +86,30 @@
 	(*env)->SetLongField(env, obj, fid, value);
 }
 
+jbyteArray getJavaByteArrayField(JNIEnv* env, jobject obj, char* name) {
+
+	jclass cls = (*env)->GetObjectClass(env, obj);
+	assert(cls);
+	jfieldID fid = (*env)->GetFieldID(env, cls, name, "[B");
+	assert(fid);
+	jbyteArray array = (*env)->GetObjectField(env, obj, fid);
+	assert(array);
+	return array;
+
+}
+
+void setJavaByteArrayField(JNIEnv* env, jobject obj, char* name,
+		jbyteArray array) {
+
+	jclass cls = (*env)->GetObjectClass(env, obj);
+	assert(cls);
+	jfieldID fid = (*env)->GetFieldID(env, cls, name, "[B");
+	assert(fid);
+
+	(*env)->SetObjectField(env, obj, fid, array);
+	return;
+}
+
 void callJavaVoidMethod(JNIEnv* env, jobject obj, const char* method_name) {
 
 	jclass cls = (*env)->GetObjectClass(env, obj);
@@ -105,9 +130,10 @@
 }
 
 jobject getLockObject(JNIEnv* env) {
-	
+
 	const char* eventLoopClassName =
-			"Lorg/classpath/icedtea/pulseaudio/EventLoop;";
+			"org/classpath/icedtea/pulseaudio/EventLoop";
+
 	jclass eventLoopClass = (*env)->FindClass(env, eventLoopClassName);
 	assert(eventLoopClass);
 
@@ -135,7 +161,7 @@
 
 	(*env)->MonitorEnter(env, lockObject);
 
-	jclass objectClass = (*env)->FindClass(env, "Ljava/lang/Object;");
+	jclass objectClass = (*env)->FindClass(env, "java/lang/Object");
 	assert(objectClass);
 	jmethodID notifyAllID = (*env)->GetMethodID(env, objectClass, "notifyAll", "()V");
 	assert(notifyAllID);
@@ -146,93 +172,65 @@
 
 }
 
-/*
- * 
- * 
- * The functions below are going to cause headaches when porting
- * 
- * 
- */
-
 void* getJavaPointer(JNIEnv* env, jobject obj, char* name) {
 
-	/*
-	 * on a 64 bit machine, the value of the long is 64 bits, which should be the pointer
-	 * size and everything should be ok
-	 * 
-	 * So the problem is 32 bit architectures:
-	 * 
-	 * A reference snippet 
-	 * 
-	 int a_int = 0x1020;
-	 long a_long = 0x102030;
-	 long long a_long_long = 0x1020304150607080;
-	 printf("size of int: %d\nsize of long: %d\nsize of long long: %d\n", 
-	 sizeof(int), sizeof(long), sizeof(long long));
-	 printf("int to long long: %X -> %llX\n", a_int, (long long) a_int);
-	 printf("long long to int: %llX -> %X\n", a_long_long, (int)a_long_long); 
+	jbyteArray array = getJavaByteArrayField(env, obj, name);
+	assert(array);
+	void* value = convertJavaPointerToNative(env, array);
+	assert(value);
+	return value;
+}
 
-	 * this shows that long long -> int does a bitwise mask to get the lower order bits only
-	 * this is a guess at how it works:
-	 *  
-	 *   raw data in register is 0x 10203040 50607080
-	 *                               32 bits  32 bits
-	 * 
-	 * we are interested in the 50607080 part of data
-	 * 
-	 *	Big endian:
-	 *    	10	<-- Pointer         <	32bit pointer (for an int)
-	 *    	20						<
-	 *    	30          			<
-	 *    	40                     	<
-	 * 		50
-	 * 		60
-	 * 		70
-	 * 		80
-	 * (for big endian, will need to do masking and shifting)
-	 * 
-	 * 
-	 * 	Little Endian
-	 * 		80	<-- Pointer			< 	32bit pointer (for an int)
-	 * 		70						<
-	 * 		60						<
-	 * 		50						<
-	 * 		40
-	 * 		30
-	 * 		20
-	 * 		10
-	 * (so little endian works by default!)
-	 * 
-	 * 
-	 */
+void setJavaPointer(JNIEnv* env, jobject obj, char* name, void* value) {
 
-	/*
-	 * jlong = 64 bits
-	 * long long = at least 64 bits
-	 */
-
-	long long value = getJavaLongField(env, obj, name);
-
-	jPointer result = (jPointer) value;
-	return (void*) result;
-
+	jbyteArray array = convertNativePointerToJava(env, value);
+	assert(array);
+	setJavaByteArrayField(env, obj, name, array);
+	return;
 }
 
-void setJavaPointer(JNIEnv* env, jobject obj, char* name, void* pointer_value) {
+void* convertJavaPointerToNative(JNIEnv* env, jbyteArray pointer) {
+	//	printf("convertJavaPointerToNative(): entering method\n");
+
+	void* returnPointer = NULL;
+
+	assert(pointer);
 
-	setJavaLongField(env, obj, name, (jPointer) pointer_value);
+	jsize len = (*env)->GetArrayLength(env, pointer);
+	assert(len);
+	assert(len == sizeof(returnPointer));
 
+	jbyte* data = (*env)->GetByteArrayElements(env, pointer, NULL);
+	if (data == NULL) {
+		return NULL; // oome;
+	}
+	memcpy(&returnPointer, data, sizeof(returnPointer));
+	(*env)->ReleaseByteArrayElements(env, pointer, data, 0);
+
+	//	printf("convertJavaPointerToNative(): leaving method\n");
+	return returnPointer;
 }
 
-void* convertJavaLongToPointer(jlong pointer) {
+jbyteArray convertNativePointerToJava(JNIEnv* env, void* pointer) {
+	//	printf("convertNativePointerToJava(): entering method\n");
+
+	//	assert(pointer);
+
+	jbyteArray array = (*env)->NewByteArray(env, sizeof(pointer));
+	if (array == NULL) {
+		return 0; // oome?
+	}
 
-	/* this truncates the jlong */
-	jPointer p = pointer;
-	return (void*) p;
+	jbyte* data = (*env)->GetByteArrayElements(env, array, NULL);
+	if (data == NULL) {
+		return 0;
+	}
 
+	memcpy(data, &pointer, sizeof(pointer));
+	(*env)->ReleaseByteArrayElements(env, array, data, 0);
+
+	//	printf("convertNativePointerToJava(): leaving method\n");
+
+	return array;
 }
 
-jlong convertPointerToJavaLong(void* pointer) {
-	return (long) pointer;
-
-}
--- a/src/native/jni-common.h	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/native/jni-common.h	Mon Sep 08 11:09:02 2008 -0400
@@ -1,40 +1,39 @@
 /* jni-common.h
-   Copyright (C) 2008 Red Hat, Inc.
+ Copyright (C) 2008 Red Hat, Inc.
 
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
+ This file is part of IcedTea.
 
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
+ IcedTea is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 2.
 
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
+ IcedTea is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
 
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
+ You should have received a copy of the GNU General Public License
+ along with IcedTea; see the file COPYING.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library.  Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
 
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module.  An independent module is a module which is not derived from
+ or based on this library.  If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version.
+ */
 
 #ifndef _JNI_COMMON_H
 #define _JNI_COMMON_H
@@ -45,26 +44,21 @@
  * 
  */
 
-#ifdef WITH_32BIT_PLATFORM
-#define jPointer jint 
-#elif WITH_64BIT_PLATFORM
-#define jPointer jlong
-#else
-# 	error Unsupported Platform
-#endif
-
 typedef struct java_context_t {
 	JNIEnv* env;
 	jobject obj;
 } java_context_t;
 
-
 jint getJavaIntField(JNIEnv* env, jobject obj, char* fieldName);
 void setJavaIntField(JNIEnv* env, jobject obj, char* fieldName, jint value);
 
 jlong getJavaLongField(JNIEnv* env, jobject obj, char* name);
 void setJavaLongField(JNIEnv* env, jobject, char* name, jlong value);
 
+jbyteArray getJavaByteArrayField(JNIEnv* env, jobject obj, char* name);
+void setJavaByteArrayField(JNIEnv* env, jobject obj, char* name,
+		jbyteArray array);
+
 void callJavaVoidMethod(JNIEnv* env, jobject obj, const char* method_name);
 
 void throwByName(JNIEnv* const env, const char* const name,
@@ -76,8 +70,8 @@
 void* getJavaPointer(JNIEnv* env, jobject obj, char* name);
 void setJavaPointer(JNIEnv* env, jobject obj, char*name, void* pointer_value);
 
-void* convertJavaLongToPointer(jlong pointer);
-jlong convertPointerToJavaLong(void* pointer);
+void* convertJavaPointerToNative(JNIEnv* env, jbyteArray pointer);
+jbyteArray convertNativePointerToJava(JNIEnv* env, void* pointer);
 
 #endif
 
--- a/src/native/org_classpath_icedtea_pulseaudio_EventLoop.c	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/native/org_classpath_icedtea_pulseaudio_EventLoop.c	Mon Sep 08 11:09:02 2008 -0400
@@ -223,20 +223,34 @@
 
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_EventLoop_nativeUpdateTargetPortNameList(JNIEnv *env, jobject obj) {
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_EventLoop
+ * Method:    nativeUpdateTargetPortNameList
+ * Signature: ()[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_EventLoop_nativeUpdateTargetPortNameList
+(JNIEnv* env, jobject obj) {
+
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
 	assert(context);
 	pa_operation *o = pa_context_get_sink_info_list(context, sink_list_success_cb, NULL);
 	assert(o);
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_EventLoop_nativeUpdateSourcePortNameList(JNIEnv *env, jobject obj) {
+
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_EventLoop
+ * Method:    nativeUpdateSourcePortNameList
+ * Signature: ()[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_EventLoop_nativeUpdateSourcePortNameList
+(JNIEnv * env, jobject obj) {
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
 	assert(context);
 	pa_operation *o = pa_context_get_source_info_list(context, source_list_success_cb, NULL);
 	assert(o);
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 }
 
 static void context_drain_complete_callback(pa_context* context, void* userdata) {
@@ -323,15 +337,16 @@
 	//	printf("done setup for changing volume\n");
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_EventLoop
  * Method:    native_set_sink_volume
- * Signature: (JI)V
+ * Signature: ([BI)V
  */
 JNIEXPORT void JNICALL Java_org_classpath_icedtea_pulseaudio_EventLoop_native_1set_1sink_1volume
-(JNIEnv* env, jobject obj, jlong streamPointer, jint volume) {
+(JNIEnv* env, jobject obj, jbyteArray streamPointer, jint volume) {
 
-	pa_stream* stream = (pa_stream*) convertJavaLongToPointer(streamPointer);
+	pa_stream* stream = (pa_stream*) convertJavaPointerToNative(env, streamPointer);
 	assert(stream);
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
 	assert(context);
--- a/src/native/org_classpath_icedtea_pulseaudio_PulseAudioSourcePort.c	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/native/org_classpath_icedtea_pulseaudio_PulseAudioSourcePort.c	Mon Sep 08 11:09:02 2008 -0400
@@ -37,7 +37,13 @@
 	}
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioSourcePort_native_1updateVolumeInfo(JNIEnv *env, jobject obj) {
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_PulseAudioSourcePort
+ * Method:    native_updateVolumeInfo
+ * Signature: ()[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioSourcePort_native_1updateVolumeInfo
+(JNIEnv *env, jobject obj) {
 	jclass cls = (*env)->GetObjectClass(env, obj);
 	assert(cls);
 	jfieldID fid = (*env)->GetFieldID(env, cls, "name", "Ljava/lang/String;");
@@ -46,7 +52,7 @@
 	assert(jstr);
 	const char *name = (*env)->GetStringUTFChars(env, jstr, NULL);
 	if (name == NULL) {
-		return convertPointerToJavaLong(NULL);	// oome
+		return NULL;    // oome
 	}
 	
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
@@ -54,10 +60,16 @@
 	obj = (*env)->NewGlobalRef(env, obj);
 	pa_operation *o = pa_context_get_source_info_by_name (context, (char*) name, get_source_volume_callback, obj);
 	assert(o);
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioSourcePort_native_1setVolume(JNIEnv *env, jobject obj, jfloat value) {
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_PulseAudioSourcePort
+ * Method:    native_setVolume
+ * Signature: (F)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioSourcePort_native_1setVolume
+(JNIEnv *env, jobject obj, jfloat value) {
 	jclass cls = (*env)->GetObjectClass(env, obj);
 	assert(cls);
 	
@@ -69,7 +81,7 @@
 	
 	const char *name = (*env)->GetStringUTFChars(env, jstr, NULL);
 	if (name == NULL) {
-		return convertPointerToJavaLong(NULL); 	// oome
+		return NULL; 	// oome
 	}
 	
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
@@ -85,6 +97,6 @@
 	pa_operation *o = pa_context_set_source_volume_by_name (context, (char*) name,pa_cvolume_set(&cv, channels, value), source_callback, obj);
 	assert(o);
 	
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 }
 
--- a/src/native/org_classpath_icedtea_pulseaudio_PulseAudioTargetPort.c	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/native/org_classpath_icedtea_pulseaudio_PulseAudioTargetPort.c	Mon Sep 08 11:09:02 2008 -0400
@@ -37,7 +37,14 @@
 
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioTargetPort_native_1updateVolumeInfo(JNIEnv *env, jobject obj) {
+
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_PulseAudioTargetPort
+ * Method:    native_updateVolumeInfo
+ * Signature: ()[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioTargetPort_native_1updateVolumeInfo
+(JNIEnv *env, jobject obj) {
 	jclass cls = (*env)->GetObjectClass(env, obj);
 	assert(cls);
 	
@@ -49,7 +56,7 @@
 	
 	const char *name = (*env)->GetStringUTFChars(env, jstr, NULL);
 	if (name == NULL) {
-		return convertPointerToJavaLong(NULL);	// oome
+		return NULL;	// oome
 	}
 	
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
@@ -60,10 +67,16 @@
 	pa_operation *o = pa_context_get_sink_info_by_name (context, (char*) name, get_sink_volume_callback, obj);
 	assert(o);
 	
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioTargetPort_native_1setVolume(JNIEnv *env, jobject obj, jfloat value) {
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_PulseAudioTargetPort
+ * Method:    native_setVolume
+ * Signature: (F)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioTargetPort_native_1setVolume
+(JNIEnv *env, jobject obj, jfloat value) {
 	jclass cls = (*env)->GetObjectClass(env, obj);
 	assert(cls);
 	
@@ -75,7 +88,7 @@
 	
 	const char *name = (*env)->GetStringUTFChars(env, jstr, NULL);
 	if (name == NULL) {
-		return convertPointerToJavaLong(NULL);	// return oome
+		return NULL;	// return oome
 	}
 	
 	pa_context* context = (pa_context*) getJavaPointer(env, obj, "contextPointer");
@@ -90,5 +103,5 @@
 	pa_operation *o = pa_context_set_sink_volume_by_name (context, (char*) name,pa_cvolume_set(&cv, channels, value), sink_callback, obj);
 	assert(o);
 	
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 }
--- a/src/native/org_classpath_icedtea_pulseaudio_Stream.c	Thu Sep 04 14:23:50 2008 -0400
+++ b/src/native/org_classpath_icedtea_pulseaudio_Stream.c	Mon Sep 08 11:09:02 2008 -0400
@@ -221,14 +221,15 @@
 
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_new
- * Signature: (JLjava/lang/String;Ljava/lang/String;IIIIIII)V
+ * Signature: ([BLjava/lang/String;Ljava/lang/String;II)V
  */
 JNIEXPORT void JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1new
-(JNIEnv* env, jobject obj, jlong contextPointer, jstring nameString,
-		jstring encodingString, jint sampleRate, jint channels) {
+(JNIEnv* env, jobject obj, jbyteArray contextPointer, jstring nameString,
+jstring encodingString, jint sampleRate, jint channels) {
 
 	//	printf("creating a new PulseAudio stream\n");
 
@@ -237,7 +238,7 @@
 	j_context->env = env;
 	j_context->obj = (*env)->NewGlobalRef(env, obj);
 
-	pa_context* context = convertJavaLongToPointer(contextPointer);
+	pa_context* context = convertJavaPointerToNative(env, contextPointer);
 	assert(context);
 
 	const char* name = NULL;
@@ -309,18 +310,20 @@
 	return pa_stream_get_state(stream);
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_get_context
- * Signature: ()J
+ * Signature: ()[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1get_1context
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1get_1context
 (JNIEnv* env, jobject obj) {
+
 	pa_stream* stream = (pa_stream*) getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
 	pa_context* context = pa_stream_get_context(stream);
 	assert(context);
-	return convertPointerToJavaLong(context);
+	return convertNativePointerToJava(env, context);
 }
 
 /*
@@ -373,16 +376,18 @@
 	return pa_stream_is_suspended(stream);
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_connect_playback
- * Signature: (Ljava/lang/String;JIJJ)I
+ * Signature: (Ljava/lang/String;IIIIII[B[B)I
  */
 JNIEXPORT jint JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1connect_1playback
-(JNIEnv* env, jobject obj, jstring device, jint bufferMaxLength,
-		jint bufferTargetLength, jint bufferPreBuffering,
-		jint bufferMinimumRequest, jint bufferFragmentSize, jint flags,
-		jlong volumePointer, jlong sync_streamPointer) {
+(JNIEnv* env, jobject obj, jstring device, jint bufferMaxLength, 
+        jint bufferTargetLength, jint bufferPreBuffering,
+        jint bufferMinimumRequest, jint bufferFragmentSize, jint flags, 
+        jbyteArray volumePointer, jbyteArray sync_streamPointer) {
+
 	pa_stream* stream = (pa_stream*) getJavaPointer(env, obj, "streamPointer");
 
 	pa_buffer_attr buffer_attr;
@@ -421,13 +426,13 @@
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_connect_record
- * Signature: (Ljava/lang/String;IIIIIIJJ)I
+ * Signature: (Ljava/lang/String;IIIIII[B[B)I
  */
 JNIEXPORT jint JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1connect_1record
 (JNIEnv* env, jobject obj, jstring device, jint bufferMaxLength,
-		jint bufferTargetLength, jint bufferPreBuffering,
-		jint bufferMinimumRequest, jint bufferFragmentSize, jint flags,
-		jlong volumePointer, jlong sync_streamPointer) {
+        jint bufferTargetLength, jint bufferPreBuffereing,
+        jint bufferMinimumRequest, jint bufferFragmentSize, jint flags, 
+        jbyteArray volumePointer, jbyteArray sync_streamPointer) {
 
 	pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
@@ -589,15 +594,15 @@
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_drain
- * Signature: ()J
+ * Signature: ()[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1drain
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1drain
 (JNIEnv* env, jobject obj) {
 	pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
 	pa_operation* operation = pa_stream_drain(stream, drain_callback, NULL);
 	assert(operation);
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env, operation);
 }
 
 static void cork_callback(pa_stream* stream, int success, void* userdata) {
@@ -611,15 +616,15 @@
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_cork
- * Signature: (I)J
+ * Signature: (I)[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1cork
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1cork
 (JNIEnv* env, jobject obj, jint yes) {
 	pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
 	pa_operation* operation = pa_stream_cork(stream, yes, cork_callback, NULL);
 	assert(operation);
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env, operation);
 }
 
 static void flush_callback(pa_stream* stream, int success, void* userdata) {
@@ -633,15 +638,15 @@
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_flush
- * Signature: ()J
+ * Signature: ()[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1flush
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1flush
 (JNIEnv* env, jobject obj) {
 	pa_stream* stream = (pa_stream*) getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
 	pa_operation* operation = pa_stream_flush(stream, flush_callback, NULL);
 	assert(operation);
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env, operation);
 }
 
 static void trigger_callback(pa_stream* stream, int success, void* userdata) {
@@ -652,18 +657,19 @@
 
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_trigger
- * Signature: ()J
+ * Signature: ()[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1trigger
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1trigger
 (JNIEnv* env, jobject obj) {
 	pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
 	pa_operation* operation = pa_stream_trigger(stream, trigger_callback, NULL);
 	assert(operation);
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env, operation);
 }
 
 static void set_name_callback(pa_stream* stream, int success, void* userdata) {
@@ -673,12 +679,13 @@
 
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_set_name
- * Signature: (Ljava/lang/String;)J
+ * Signature: (Ljava/lang/String;)[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1set_1name
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1set_1name
 (JNIEnv* env, jobject obj, jstring newName) {
 	pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
@@ -693,7 +700,7 @@
 	assert(operation);
 	(*env)->ReleaseStringUTFChars(env, newName, name);
 
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env, operation);
 }
 
 /*
@@ -809,12 +816,13 @@
 
 }
 
+
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_set_buffer_attr
- * Signature: (Lorg/classpath/icedtea/pulseaudio/Stream/BufferAttributes;)J
+ * Signature: (Lorg/classpath/icedtea/pulseaudio/StreamBufferAttributes;)[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1set_1buffer_1attr
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1set_1buffer_1attr
 (JNIEnv* env, jobject obj, jobject bufferAttributeObject) {
 
 	pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer");
@@ -856,7 +864,7 @@
 	pa_operation* operation = pa_stream_set_buffer_attr(stream, &buffer, set_buffer_attr_callback, NULL);
 
 	assert(operation);
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env,operation);
 }
 
 static void update_sample_rate_callback(pa_stream* stream, int success,
@@ -867,13 +875,12 @@
 	notifyWaitingOperations(env);
 
 }
-
 /*
  * Class:     org_classpath_icedtea_pulseaudio_Stream
  * Method:    native_pa_stream_update_sample_rate
- * Signature: (I)J
+ * Signature: (I)[B
  */
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1update_1sample_1rate
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1update_1sample_1rate
 (JNIEnv* env, jobject obj, jint newRate) {
 
 	uint32_t rate = (uint32_t) newRate;
@@ -882,11 +889,17 @@
 	assert(stream);
 	pa_operation* operation = pa_stream_update_sample_rate(stream,rate, update_sample_rate_callback, NULL);
 	assert(operation);
-	return convertPointerToJavaLong(operation);
+	return convertNativePointerToJava(env, operation);
 
 }
 
-JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1setVolume(JNIEnv *env, jobject obj, jfloat new_volume) {
+/*
+ * Class:     org_classpath_icedtea_pulseaudio_Stream
+ * Method:    native_setVolume
+ * Signature: (F)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1setVolume
+(JNIEnv *env, jobject obj, jfloat new_volume) {
 	pa_stream *stream = getJavaPointer(env, obj, "streamPointer");
 	assert(stream);
 
@@ -900,7 +913,7 @@
 	pa_operation* o = pa_context_set_sink_input_volume(context, stream_id, pa_cvolume_set(&cv, channels, new_volume), set_sink_input_volume_callback, NULL);
 	assert(o);
 
-	return convertPointerToJavaLong(o);
+	return convertNativePointerToJava(env, o);
 
 }