Author: mturk
Date: Mon Dec 7 12:28:31 2009
New Revision: 887902
URL: http://svn.apache.org/viewvc?rev=887902&view=rev
Log:
Rename basic to generic so it matches the Java class
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java
commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h
commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/memalign.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/secmem.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/memalign.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/secmem.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp
commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c
commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
commons/sandbox/runtime/trunk/src/main/native/shared/shm.c
commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
---
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java
(original)
+++
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java
Mon Dec 7 12:28:31 2009
@@ -61,7 +61,7 @@
private static native ByteBuffer alloc5(long ptr, long len)
throws NullPointerException;
- private static native ByteBuffer[] alloc6(long ptr, long siz, long[]
sizes,
+ private static native ByteBuffer[] alloc6(Pointer ptr, long[] sizes,
int off, int len)
throws OutOfMemoryError, IllegalArgumentException,
IndexOutOfBoundsException;
@@ -167,11 +167,11 @@
throws NullPointerException, IllegalArgumentException,
IndexOutOfBoundsException
{
- if (ptr == null || ptr.POINTER == 0L || sizes == null)
+ if (ptr == null || sizes == null)
throw new NullPointerException();
if (off < 0 || len < 1)
throw new IllegalArgumentException();
- return alloc6(ptr.POINTER, ptr.PLENGTH, sizes, off, len);
+ return alloc6(ptr, sizes, off, len);
}
/**
@@ -204,11 +204,11 @@
throws NullPointerException, IllegalArgumentException,
IndexOutOfBoundsException
{
- if (ptr == null || ptr.POINTER == 0L || sizes == null)
+ if (ptr == null || sizes == null)
throw new NullPointerException();
if (sizes.length < 1)
throw new IllegalArgumentException();
- return alloc6(ptr.POINTER, ptr.PLENGTH, sizes, 0, sizes.length);
+ return alloc6(ptr, sizes, 0, sizes.length);
}
/**
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_pointer.h Mon Dec
7 12:28:31 2009
@@ -45,8 +45,8 @@
* @param len Length of the pointer.
* @param cb callback function to use on Pointer.finalize()
*/
-ACR_DECLARE(jobject) ACR_NewBasicPointer(JNIEnv *env, void *p, size_t len,
- acr_pointer_cleanup_fn_t *cb);
+ACR_DECLARE(jobject) ACR_NewGenericPointer(JNIEnv *env, void *p, size_t len,
+ acr_pointer_cleanup_fn_t *cb);
/**
* Create new Pointer array
Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/execmem.c Mon Dec 7
12:28:31 2009
@@ -146,7 +146,7 @@
EXEC_PAGE_OFF(mmw, ass) = (ptrdiff_t)mmx;
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mmw, ass, execmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mmw, ass, execmem_pointer_cleanup);
if (!ptr) {
munmap(mmw, ass);
if (mmx)
@@ -171,9 +171,9 @@
dp = (void *)(EXEC_PAGE_OFF(sp, sl));
if (dp)
- po = ACR_NewBasicPointer(_E, dp, sl, NULL);
+ po = ACR_NewGenericPointer(_E, dp, sl, NULL);
else
- po = ACR_NewBasicPointer(_E, sp, sl, NULL);
+ po = ACR_NewGenericPointer(_E, sp, sl, NULL);
return po;
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/execmem.c Mon Dec 7
12:28:31 2009
@@ -77,7 +77,7 @@
if (mem) {
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, execmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, execmem_pointer_cleanup);
if (!ptr) {
#ifdef ACR_USE_MMAP
munmap(mem, ass);
@@ -96,6 +96,6 @@
void *sp = ACR_PointerGet(_E, src, &sl);
UNREFERENCED_O;
- return ACR_NewBasicPointer(_E, sp, sl, NULL);
+ return ACR_NewGenericPointer(_E, sp, sl, NULL);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/memalign.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/memalign.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/memalign.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/memalign.c Mon Dec 7
12:28:31 2009
@@ -29,7 +29,7 @@
static int aligned_pointer_cleanup(void *mem, size_t len)
{
if (mem && len) {
- free(mem);
+ x_free(mem);
return 0;
}
else {
@@ -73,9 +73,9 @@
mem = ACR_Memalign(_E, THROW_FMARK, ass);
if (mem) {
- ptr = ACR_NewBasicPointer(_E, mem, ass, aligned_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, aligned_pointer_cleanup);
if (!ptr) {
- free(mem);
+ x_free(mem);
}
}
return ptr;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/mmap.c Mon Dec 7
12:28:31 2009
@@ -439,7 +439,7 @@
return NULL;
}
if (m->flags & PROT_WRITE)
- mptr = ACR_NewBasicPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
+ mptr = ACR_NewGenericPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
else
mptr = ACR_NewConstPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
@@ -483,7 +483,7 @@
return NULL;
}
if (m->flags & PROT_WRITE)
- mptr = ACR_NewBasicPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
+ mptr = ACR_NewGenericPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
else
mptr = ACR_NewConstPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/secmem.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/secmem.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/secmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/secmem.c Mon Dec 7
12:28:31 2009
@@ -96,7 +96,7 @@
{
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, secmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, secmem_pointer_cleanup);
}
if (!ptr) {
#ifdef ACR_USE_MMAP
@@ -155,7 +155,7 @@
{
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, secmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, secmem_pointer_cleanup);
}
if (!ptr) {
#ifdef ACR_USE_MMAP
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c Mon Dec 7
12:28:31 2009
@@ -51,7 +51,7 @@
if (mem) {
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, execmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, execmem_pointer_cleanup);
if (!ptr) {
VirtualFree(mem, 0, MEM_RELEASE);
}
@@ -68,6 +68,6 @@
void *sp = ACR_PointerGet(_E, src, &sl);
UNREFERENCED_O;
- return ACR_NewBasicPointer(_E, sp, sl, NULL);
+ return ACR_NewGenericPointer(_E, sp, sl, NULL);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/memalign.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/memalign.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/memalign.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/memalign.c Mon Dec
7 12:28:31 2009
@@ -69,7 +69,7 @@
if (mem) {
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, aligned_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, aligned_pointer_cleanup);
if (!ptr) {
VirtualFree(mem, 0, MEM_RELEASE);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c Mon Dec 7
12:28:31 2009
@@ -438,7 +438,7 @@
return NULL;
}
if (m->flags & FILE_MAP_WRITE)
- mptr = ACR_NewBasicPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
+ mptr = ACR_NewGenericPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
else
mptr = ACR_NewConstPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
@@ -472,7 +472,7 @@
}
size = mbi.RegionSize;
if (m->flags & FILE_MAP_WRITE)
- mptr = ACR_NewBasicPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
+ mptr = ACR_NewGenericPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
else
mptr = ACR_NewConstPointer(_E, base, (size_t)size,
mmap_pointer_cleanup);
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/secmem.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/secmem.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/secmem.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/secmem.c Mon Dec 7
12:28:31 2009
@@ -57,7 +57,7 @@
}
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, secmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, secmem_pointer_cleanup);
if (!ptr) {
VirtualFree(mem, 0, MEM_RELEASE);
}
@@ -87,7 +87,7 @@
}
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, ass, secmem_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, ass, secmem_pointer_cleanup);
if (!ptr) {
VirtualFree(mem, 0, MEM_RELEASE);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/variant.cpp Mon Dec
7 12:28:31 2009
@@ -48,7 +48,7 @@
if (!v)
return 0;
VariantInit(v);
- return ACR_NewBasicPointer(_E, v, 0, variant_callback);
+ return ACR_NewGenericPointer(_E, v, 0, variant_callback);
}
extern "C"
@@ -64,7 +64,7 @@
VariantInit(v);
V_VT(v) = VT_BSTR;
V_BSTR(v) = SysAllocString(J2W(str));
- r = ACR_NewBasicPointer(_E, v, 0, variant_callback);
+ r = ACR_NewGenericPointer(_E, v, 0, variant_callback);
} END_WITH_WSTR(str);
return r;
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/memory.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/memory.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/memory.c Mon Dec 7
12:28:31 2009
@@ -323,7 +323,7 @@
ACR_JNI_EXPORT_DECLARE(jobject, Memory, nullp0)(ACR_JNISTDARGS)
{
UNREFERENCED_O;
- return ACR_NewBasicPointer(_E, NULL, 0, memory_pointer_cleanup);
+ return ACR_NewGenericPointer(_E, NULL, 0, memory_pointer_cleanup);
}
ACR_JNI_EXPORT_DECLARE(jobject, Memory, malloc)(ACR_JNISTDARGS, jlong siz)
@@ -341,7 +341,7 @@
if (mem) {
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, (size_t)siz,
memory_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, (size_t)siz,
memory_pointer_cleanup);
if (!ptr)
x_free(mem);
}
@@ -363,7 +363,7 @@
if (mem) {
/* Create the Pointer class with default cleanup.
*/
- ptr = ACR_NewBasicPointer(_E, mem, (size_t)siz,
memory_pointer_cleanup);
+ ptr = ACR_NewGenericPointer(_E, mem, (size_t)siz,
memory_pointer_cleanup);
if (!ptr)
x_free(mem);
}
@@ -441,7 +441,7 @@
/* Create the Pointer class without the cleanup.
* Original object will clean the entire allocated memory.
*/
- return ACR_NewBasicPointer(_E, sp, ss, NULL);
+ return ACR_NewGenericPointer(_E, sp, ss, NULL);
}
ACR_JNI_EXPORT_DECLARE(jobject, Memory, slice1)(ACR_JNISTDARGS,
@@ -478,7 +478,7 @@
__TRY
{
memcpy(dp, sp, ss);
- po = ACR_NewBasicPointer(_E, dp, ss, memory_pointer_cleanup);
+ po = ACR_NewGenericPointer(_E, dp, ss, memory_pointer_cleanup);
}
__EXCEPT
{
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c Mon Dec 7
12:28:31 2009
@@ -266,17 +266,17 @@
}
ACR_JNI_EXPORT_DECLARE(jobject, NioByteBuffer, alloc6)(ACR_JNISTDARGS,
- jlong ptr, jlong siz,
+ jobject ptr,
jlongArray sizes,
jint off, jint len)
{
jint i;
jlong *ia;
jsize is;
- size_t sl = (size_t)siz;
+ size_t sl;
size_t sz = 0;
jobjectArray rv = NULL;
- char *sp = J2P(ptr, char *);
+ char *sp = ACR_PointerGet(_E, ptr, &sl);
UNREFERENCED_O;
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/pointer.c Mon Dec 7
12:28:31 2009
@@ -106,7 +106,7 @@
if (!_clazzn.i) {
initp0(_E);
}
- return ACR_NewBasicPointer(_E, 0, 0, NULL);
+ return ACR_NewGenericPointer(_E, 0, 0, NULL);
}
ACR_JNI_EXPORT_DECLARE(void, Pointer, cleanup0)(ACR_JNISTDARGS)
@@ -172,8 +172,8 @@
return rv;
}
-ACR_DECLARE(jobject) ACR_NewBasicPointer(JNIEnv *_E, void *p, size_t len,
- acr_pointer_cleanup_fn_t *cb)
+ACR_DECLARE(jobject) ACR_NewGenericPointer(JNIEnv *_E, void *p, size_t len,
+ acr_pointer_cleanup_fn_t *cb)
{
if (_clazzn.i && J4MID(0000))
return (*_E)->NewObject(_E, _clazzn.i, J4MID(0000),
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/shm.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/shm.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/shm.c Mon Dec 7
12:28:31 2009
@@ -84,7 +84,7 @@
return NULL;
}
len = ACR_ShmGetSize(sd);
- mpo = ACR_NewBasicPointer(_E, mem, len, NULL);
+ mpo = ACR_NewGenericPointer(_E, mem, len, NULL);
}
return mpo;
}
@@ -94,6 +94,8 @@
jlong off, jlong siz)
{
jobject mpo = NULL;
+ size_t of = (size_t)off;
+ size_t sz = (size_t)siz;
int sd;
UNREFERENCED_O;
@@ -107,11 +109,11 @@
return NULL;
}
len = ACR_ShmGetSize(sd);
- if (len < (size_t)(off + siz)) {
+ if (len < (of + sz)) {
ACR_ThrowException(_E, THROW_NMARK, ACR_EX_EINDEX, 0);
return NULL;
}
- mpo = ACR_NewBasicPointer(_E, mem + off, (size_t)siz, NULL);
+ mpo = ACR_NewGenericPointer(_E, mem + of, sz, NULL);
}
return mpo;
}
Modified: commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testcase.c?rev=887902&r1=887901&r2=887902&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testcase.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testcase.c Mon Dec 7
12:28:31 2009
@@ -262,7 +262,7 @@
ACR_JNI_EXPORT_DECLARE(jobject, TestPrivate, test017)(ACR_JNISTDARGS, jint d)
{
- return ACR_NewBasicPointer(_E, I2P(d, void *), 0, callback);
+ return ACR_NewGenericPointer(_E, I2P(d, void *), 0, callback);
}
ACR_JNI_EXPORT_DECLARE(jobject, TestPrivate, test038)(ACR_JNISTDARGS, jint d)