|
From: <sp...@us...> - 2011-05-11 14:22:05
|
Revision: 3530
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3530&view=rev
Author: spasi
Date: 2011-05-11 14:21:59 +0000 (Wed, 11 May 2011)
Log Message:
-----------
Added missing include.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/native/common/org_lwjgl_BufferUtils.c
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2011-05-11 09:50:50 UTC (rev 3529)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2011-05-11 14:21:59 UTC (rev 3530)
@@ -80,13 +80,9 @@
* @param source the source buffer
*/
public PointerBuffer(final ByteBuffer source) {
- if ( !source.isDirect() )
- throw new IllegalArgumentException("ByteBuffer is not direct");
+ if ( LWJGLUtil.CHECKS )
+ checkSource(source);
- final int alignment = is64Bit ? 8 : 4;
- if ( (BufferUtils.getBufferAddress(source) + source.position()) % alignment != 0 || source.remaining() % alignment != 0 )
- throw new IllegalArgumentException("The source buffer is not aligned to " + alignment + " bytes.");
-
pointers = source.slice().order(source.order());
if ( is64Bit ) {
@@ -98,6 +94,15 @@
}
}
+ private static void checkSource(final ByteBuffer source) {
+ if ( !source.isDirect() )
+ throw new IllegalArgumentException("The source buffer is not direct.");
+
+ final int alignment = is64Bit ? 8 : 4;
+ if ( (BufferUtils.getBufferAddress(source) + source.position()) % alignment != 0 || source.remaining() % alignment != 0 )
+ throw new IllegalArgumentException("The source buffer is not aligned to " + alignment + " bytes.");
+ }
+
/**
* Returns the ByteBuffer that backs this PointerBuffer.
*
Modified: trunk/LWJGL/src/native/common/org_lwjgl_BufferUtils.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_BufferUtils.c 2011-05-11 09:50:50 UTC (rev 3529)
+++ trunk/LWJGL/src/native/common/org_lwjgl_BufferUtils.c 2011-05-11 14:21:59 UTC (rev 3530)
@@ -1,4 +1,5 @@
#include "org_lwjgl_BufferUtils.h"
+#include "common_tools.h"
JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) {
memset((char*)(*env)->GetDirectBufferAddress(env, buffer) + (size_t)offset, 0, (size_t)size);
@@ -6,4 +7,4 @@
JNIEXPORT jlong JNICALL Java_org_lwjgl_BufferUtils_getBufferAddress(JNIEnv *env, jclass clazz, jobject buffer) {
return (intptr_t)(*env)->GetDirectBufferAddress(env, buffer);
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|