summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c2
-rw-r--r--src/jvm/jvm.c20
2 files changed, 8 insertions, 14 deletions
diff --git a/src/app.c b/src/app.c
index 7dbe37d..8f422d4 100644
--- a/src/app.c
+++ b/src/app.c
@@ -39,7 +39,7 @@ main(int argc, const char *argv[])
JNI_OnLoad(&jvm.vm, NULL);
- static const char *unity_player_class = "com/unity3d/player/UnityPlayer";
+ static const char *unity_player_class = "com.unity3d.player.UnityPlayer";
void (*native_init_jni)(JNIEnv*, jobject, jobject) = jvm_get_native_method(&jvm, unity_player_class, "initJni");
void (*native_done)(JNIEnv*, jobject) = jvm_get_native_method(&jvm, unity_player_class, "nativeDone");
void (*native_file)(JNIEnv*, jobject, jstring) = jvm_get_native_method(&jvm, unity_player_class, "nativeFile");
diff --git a/src/jvm/jvm.c b/src/jvm/jvm.c
index a15f2b1..f54aad5 100644
--- a/src/jvm/jvm.c
+++ b/src/jvm/jvm.c
@@ -320,18 +320,13 @@ JNIEnv_DefineClass(JNIEnv* p0, const char* p1, jobject p2, const jbyte* p3, jsiz
return NULL;
}
-static char*
-cstr_replace(char *cstr, const char replace, const char with)
+static void
+cstr_replace(char *cstr, const char *replace, const char with)
{
- assert(cstr && replace != with);
-
- if (replace == with)
- return cstr;
-
+ assert(cstr && replace);
char *s = cstr;
- while ((s = strchr(s, replace)))
- *s = with;
- return cstr;
+ for (size_t i; *s && (i = strcspn(s, replace)) && s[i]; s += (i + 1))
+ s[i] = with;
}
static jclass
@@ -340,7 +335,7 @@ jvm_make_class(struct jvm *jvm, const char *name)
assert(jvm && name);
struct jvm_object o = { .this_klass = (jclass)1, .type = JVM_OBJECT_CLASS };
jvm_string_set_cstr(&o.klass.name, name, true);
- cstr_replace((char*)o.klass.name.data, '.', '/');
+ cstr_replace((char*)o.klass.name.data, "/", '.');
return jvm_add_object_if_not_there(jvm, &o);
}
@@ -558,8 +553,7 @@ jvm_form_symbol(struct jvm *jvm, const struct jvm_method *method, char *symbol,
assert(jvm && method);
verbose("%s::%s::%s", jvm_get_object_of_type(jvm, method->klass, JVM_OBJECT_CLASS)->klass.name.data, method->name.data, method->signature.data);
snprintf(symbol, symbol_sz, "%s_%s", jvm_get_object_of_type(jvm, method->klass, JVM_OBJECT_CLASS)->klass.name.data, method->name.data);
- cstr_replace(symbol, '/', '_');
- cstr_replace(symbol, '$', '_');
+ cstr_replace(symbol, "./$", '_');
}
static void*