mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Merge branch 'master' of oss:/var/local/git/avian into dynamic
This commit is contained in:
commit
0aebe334b3
@ -87,6 +87,35 @@ GetEnv(Machine* m, Thread** t, jint version)
|
||||
}
|
||||
}
|
||||
|
||||
jsize JNICALL
|
||||
GetStringLength(Thread* t, jstring s)
|
||||
{
|
||||
ENTER(t, Thread::ActiveState);
|
||||
|
||||
return stringLength(t, *s);
|
||||
}
|
||||
|
||||
const jchar* JNICALL
|
||||
GetStringChars(Thread* t, jstring s, jboolean* isCopy)
|
||||
{
|
||||
ENTER(t, Thread::ActiveState);
|
||||
|
||||
jchar* chars = static_cast<jchar*>
|
||||
(t->m->heap->allocate((stringLength(t, *s) + 1) * sizeof(jchar), false));
|
||||
stringChars(t, *s, reinterpret_cast<wchar_t*>(chars));
|
||||
|
||||
if (isCopy) *isCopy = true;
|
||||
return chars;
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
ReleaseStringChars(Thread* t, jstring s, const jchar* chars)
|
||||
{
|
||||
ENTER(t, Thread::ActiveState);
|
||||
|
||||
t->m->heap->free(chars, (stringLength(t, *s) + 1) * sizeof(jchar), false);
|
||||
}
|
||||
|
||||
jsize JNICALL
|
||||
GetStringUTFLength(Thread* t, jstring s)
|
||||
{
|
||||
@ -111,6 +140,8 @@ GetStringUTFChars(Thread* t, jstring s, jboolean* isCopy)
|
||||
void JNICALL
|
||||
ReleaseStringUTFChars(Thread* t, jstring s, const char* chars)
|
||||
{
|
||||
ENTER(t, Thread::ActiveState);
|
||||
|
||||
t->m->heap->free(chars, stringLength(t, *s) + 1, false);
|
||||
}
|
||||
|
||||
@ -1854,6 +1885,9 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
|
||||
|
||||
memset(envTable, 0, sizeof(JNIEnvVTable));
|
||||
|
||||
envTable->GetStringLength = ::GetStringLength;
|
||||
envTable->GetStringChars = ::GetStringChars;
|
||||
envTable->ReleaseStringChars = ::ReleaseStringChars;
|
||||
envTable->GetStringUTFLength = ::GetStringUTFLength;
|
||||
envTable->GetStringUTFChars = ::GetStringUTFChars;
|
||||
envTable->ReleaseStringUTFChars = ::ReleaseStringUTFChars;
|
||||
|
@ -2153,6 +2153,24 @@ stringChars(Thread* t, object string, char* chars)
|
||||
chars[stringLength(t, string)] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
stringChars(Thread* t, object string, wchar_t* chars)
|
||||
{
|
||||
object data = stringData(t, string);
|
||||
if (objectClass(t, data)
|
||||
== arrayBody(t, t->m->types, Machine::ByteArrayType))
|
||||
{
|
||||
for (unsigned i = 0; i < stringLength(t, string); ++i) {
|
||||
chars[i] = byteArrayBody(t, data, stringOffset(t, string) + i);
|
||||
}
|
||||
} else {
|
||||
memcpy(chars,
|
||||
&charArrayBody(t, data, stringOffset(t, string)),
|
||||
stringLength(t, string) * sizeof(wchar_t));
|
||||
}
|
||||
chars[stringLength(t, string)] = 0;
|
||||
}
|
||||
|
||||
bool
|
||||
isAssignableFrom(Thread* t, object a, object b)
|
||||
{
|
||||
|
@ -1703,6 +1703,9 @@ makeString(Thread* t, const char* format, ...);
|
||||
void
|
||||
stringChars(Thread* t, object string, char* chars);
|
||||
|
||||
void
|
||||
stringChars(Thread* t, object string, wchar_t* chars);
|
||||
|
||||
bool
|
||||
isAssignableFrom(Thread* t, object a, object b);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user