summaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-01 05:23:42 +0100
committerSven Gothel <[email protected]>2015-02-01 05:23:42 +0100
commit234819d531cdf20842cd0b3302935b187b2012d6 (patch)
tree73ccbf5777952bbd25114045f8cacaed54a6409f /src/java/com
parenta3f2d08801c5a54048faca52f422bcededf81b2a (diff)
Minor Cleanup: Buffers: Remove !JAVA_6 branch; NativeLibrary: Reuse isOSX detection
Diffstat (limited to 'src/java/com')
-rw-r--r--src/java/com/jogamp/common/nio/Buffers.java40
-rw-r--r--src/java/com/jogamp/common/os/NativeLibrary.java24
2 files changed, 21 insertions, 43 deletions
diff --git a/src/java/com/jogamp/common/nio/Buffers.java b/src/java/com/jogamp/common/nio/Buffers.java
index 8fff30e..aae2be8 100644
--- a/src/java/com/jogamp/common/nio/Buffers.java
+++ b/src/java/com/jogamp/common/nio/Buffers.java
@@ -39,9 +39,15 @@
*/
package com.jogamp.common.nio;
-import java.nio.*;
-
-import jogamp.common.os.PlatformPropsImpl;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
import com.jogamp.common.util.ValueConv;
@@ -445,30 +451,10 @@ public class Buffers {
if (buf == null) {
return true;
}
- if ( PlatformPropsImpl.JAVA_6 ) {
- if (buf instanceof Buffer) {
- return ((Buffer) buf).isDirect();
- } else if (buf instanceof PointerBuffer) {
- return ((PointerBuffer) buf).isDirect();
- }
- } else {
- if (buf instanceof ByteBuffer) {
- return ((ByteBuffer) buf).isDirect();
- } else if (buf instanceof IntBuffer) {
- return ((IntBuffer) buf).isDirect();
- } else if (buf instanceof ShortBuffer) {
- return ((ShortBuffer) buf).isDirect();
- } else if (buf instanceof FloatBuffer) {
- return ((FloatBuffer) buf).isDirect();
- } else if (buf instanceof DoubleBuffer) {
- return ((DoubleBuffer) buf).isDirect();
- } else if (buf instanceof LongBuffer) {
- return ((LongBuffer) buf).isDirect();
- } else if (buf instanceof CharBuffer) {
- return ((CharBuffer) buf).isDirect();
- } else if (buf instanceof PointerBuffer) {
- return ((PointerBuffer) buf).isDirect();
- }
+ if (buf instanceof Buffer) {
+ return ((Buffer) buf).isDirect();
+ } else if (buf instanceof PointerBuffer) {
+ return ((PointerBuffer) buf).isDirect();
}
throw new IllegalArgumentException("Unexpected buffer type " + buf.getClass().getName());
}
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index fc2c1d4..747f92d 100644
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -77,6 +77,7 @@ import com.jogamp.common.util.cache.TempJarCache;
public final class NativeLibrary implements DynamicLookupHelper {
private static final String[] prefixes;
private static final String[] suffixes;
+ private static final boolean isOSX;
static {
// Instantiate dynamic linker implementation
@@ -84,19 +85,17 @@ public final class NativeLibrary implements DynamicLookupHelper {
case WINDOWS:
prefixes = new String[] { "" };
suffixes = new String[] { ".dll" };
+ isOSX = false;
break;
case MACOS:
prefixes = new String[] { "lib" };
suffixes = new String[] { ".dylib", ".jnilib" };
- break;
-
- case ANDROID:
- prefixes = new String[] { "lib" };
- suffixes = new String[] { ".so" };
+ isOSX = true;
break;
/*
+ case ANDROID:
case FREEBSD:
case SUNOS:
case HPUX:
@@ -105,6 +104,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
default:
prefixes = new String[] { "lib" };
suffixes = new String[] { ".so" };
+ isOSX = false;
break;
}
}
@@ -461,7 +461,7 @@ public final class NativeLibrary implements DynamicLookupHelper {
}
// Add probable Mac OS X-specific paths
- if (PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS) {
+ if ( isOSX ) {
// Add historical location
addPaths("/Library/Frameworks/" + libName + ".Framework", baseNames, paths);
// Add current location
@@ -482,13 +482,6 @@ public final class NativeLibrary implements DynamicLookupHelper {
case MACOS:
return macOSXLibName;
- /*
- case FREEBSD:
- case DALVIK:
- case SUNOS:
- case HPUX:
- case OPENKODE:
- case LINUX: */
default:
return unixLibName;
}
@@ -539,15 +532,14 @@ public final class NativeLibrary implements DynamicLookupHelper {
}
}
- final String[] res = new String[prefixes.length * suffixes.length +
- ( PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS ? 1 : 0 )];
+ final String[] res = new String[prefixes.length * suffixes.length + ( isOSX ? 1 : 0 )];
int idx = 0;
for (int i = 0; i < prefixes.length; i++) {
for (int j = 0; j < suffixes.length; j++) {
res[idx++] = prefixes[i] + libName + suffixes[j];
}
}
- if (PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS) {
+ if ( isOSX ) {
// Plain library-base-name in Framework folder
res[idx++] = libName;
}