From e9826b2d7f4ca2033f36620814b3dcadae2455f5 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sat, 19 Jan 2008 13:30:11 -0700 Subject: [PATCH] accept foo.bar.Baz as well as foo/bar/Baz in FindClass --- src/jnienv.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 72c53bb642..00f6342e69 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -143,13 +143,24 @@ NewStringUTF(Thread* t, const char* chars) return makeLocalReference(t, s); } +void +replace(int a, int b, const char* in, int8_t* out) +{ + while (*in) { + *out = (*in == a ? b : *in); + ++ in; + ++ out; + } + *out = 0; +} + jclass JNICALL FindClass(Thread* t, const char* name) { ENTER(t, Thread::ActiveState); object n = makeByteArray(t, strlen(name) + 1, false); - memcpy(&byteArrayBody(t, n, 0), name, byteArrayLength(t, n)); + replace('.', '/', name, &byteArrayBody(t, n, 0)); return makeLocalReference(t, resolveClass(t, n)); }