fix recent regression in native method lookup on Windows

This commit is contained in:
Joel Dice 2008-01-30 17:09:21 -07:00
parent eeac584474
commit 491955af05

View File

@ -144,14 +144,14 @@ void*
resolveNativeMethod2(Thread* t, object method) resolveNativeMethod2(Thread* t, object method)
{ {
unsigned undecoratedSize = jniNameLength(t, method, false); unsigned undecoratedSize = jniNameLength(t, method, false);
char undecorated[undecoratedSize + 5]; // extra 5 is for code below char undecorated[undecoratedSize + 1 + 6]; // extra 6 is for code below
makeJNIName(t, undecorated, method, false); makeJNIName(t, undecorated + 1, method, false);
unsigned decoratedSize = jniNameLength(t, method, true); unsigned decoratedSize = jniNameLength(t, method, true);
char decorated[decoratedSize + 5]; // extra 5 is for code below char decorated[decoratedSize + 1 + 6]; // extra 6 is for code below
makeJNIName(t, decorated, method, true); makeJNIName(t, decorated + 1, method, true);
void* p = ::resolveNativeMethod(t, undecorated, decorated); void* p = ::resolveNativeMethod(t, undecorated + 1, decorated + 1);
if (p) { if (p) {
return p; return p;
} }
@ -164,10 +164,12 @@ resolveNativeMethod2(Thread* t, object method)
++ footprint; ++ footprint;
} }
snprintf(undecorated + undecoratedSize - 1, 5, "@%d", *undecorated = '_';
snprintf(undecorated + undecoratedSize + 1, 5, "@%d",
footprint * BytesPerWord); footprint * BytesPerWord);
snprintf(decorated + decoratedSize - 1, 5, "@%d", *decorated = '_';
snprintf(decorated + decoratedSize + 1, 5, "@%d",
footprint * BytesPerWord); footprint * BytesPerWord);
p = ::resolveNativeMethod(t, undecorated, decorated); p = ::resolveNativeMethod(t, undecorated, decorated);