diff --git a/java/xpcom/README b/java/xpcom/README index 43157b3856fe..7d99d259becc 100644 --- a/java/xpcom/README +++ b/java/xpcom/README @@ -30,8 +30,8 @@ Currently only UNIX/Linux builds are supported (mainly because it's my platform of choice). Windows builds should not be too much more difficult, and -1. Make sure MOZILLA_FIVE_HOME is set correctly, and that JDKHOME indicates - a valid JDK 1.2 installation. +1. Make sure MOZILLA_FIVE_HOME is set to /dist/bin, + and that JDKHOME indicates a valid JDK 1.2 installation. *IMPORTANT*: remove the jni.h, jni_md.h, and jri.h in mozilla/dist/bin, before compiling native code. Otherwise, the header diff --git a/java/xpcom/src/xpjava.cpp b/java/xpcom/src/xpjava.cpp index 7458cbb9ed87..4a37c247742f 100644 --- a/java/xpcom/src/xpjava.cpp +++ b/java/xpcom/src/xpjava.cpp @@ -380,11 +380,11 @@ static jboolean JObjectToVariant(JNIEnv *env, static nsresult JArrayToVariant(JNIEnv *env, int paramcount, nsXPTCVariant *params, - const jobjectArray jarray) { + const jobjectArray theJarray) { nsXPTCVariant *current = params; for (jsize i = 0; i < paramcount; i++, current++) { - jobject elem = env->GetObjectArrayElement(jarray, i); + jobject elem = env->GetObjectArrayElement(theJarray, i); nsIID iid = NS_GET_IID(nsISupports); // PENDING: get the iid of the object @@ -503,13 +503,13 @@ static jobject VariantToJObject(JNIEnv *env, const nsXPTCVariant *current) { static nsresult VariantToJArray(JNIEnv *env, - jobjectArray jarray, + jobjectArray theJarray, int paramcount, nsXPTCVariant *params) { nsXPTCVariant *current = params; for (jsize i = 0; i < paramcount; i++, current++) { - jobject elem = NULL; // env->GetObjectArrayElement(jarray, i); + jobject elem = NULL; // env->GetObjectArrayElement(theJarray, i); jboolean isequal = JNI_FALSE; nsXPTCVariant currValue; @@ -535,7 +535,7 @@ static nsresult VariantToJArray(JNIEnv *env, elem = VariantToJObject(env, current); - env->SetObjectArrayElement(jarray, i, elem); + env->SetObjectArrayElement(theJarray, i, elem); if (current->flags & nsXPTCVariant::VAL_IS_IFACE) { xpjp_SafeRelease((nsISupports*)current->val.p); @@ -745,8 +745,9 @@ jboolean xpjd_GetInterfaceInfoNative(REFNSIID iid, if (NS_FAILED(res)) { cerr << "Failed to find info for " << iid.ToString() << endl; - return res; + return JNI_FALSE; } + return JNI_TRUE; } void xpjd_InvokeMethod(JNIEnv *env, diff --git a/java/xpcom/test/JSSample.cpp b/java/xpcom/test/JSSample.cpp index 073dea09c475..06ae1dfc9bf6 100644 --- a/java/xpcom/test/JSSample.cpp +++ b/java/xpcom/test/JSSample.cpp @@ -190,7 +190,7 @@ NS_IMETHODIMP JSSample::GetSomeName(char * *aSomeName) { return NS_OK; } -NS_IMETHODIMP JSSample::SetSomeName(char * aSomeName) { +NS_IMETHODIMP JSSample::SetSomeName(const char * aSomeName) { cout << "--> JSSample::SetSomeName('" << aSomeName << "')" << endl; if (aSomeName != someName_) { delete someName_; diff --git a/java/xpcom/tools/genproxy.c b/java/xpcom/tools/genproxy.c index 156e18d4941a..6dea2b019032 100644 --- a/java/xpcom/tools/genproxy.c +++ b/java/xpcom/tools/genproxy.c @@ -28,6 +28,9 @@ #include #endif #include +#ifdef HAVE_GETOPT_H +# include +#endif #include #include "prprf.h" @@ -72,12 +75,6 @@ PRBool GenproxyGetStringForRefType(XPTHeader *header, XPTTypeDescriptor *td, char **type_string); -static void -genproxy_usage(char *argv[]) { - fprintf(stdout, "Usage: %s [-v] [-i] \n" - " -v verbose mode\n", argv[0]); -} - #ifdef XP_MAC static int mac_get_args(char*** argv) @@ -106,8 +103,8 @@ static int mac_get_args(char*** argv) } #ifdef XPIDL_PLUGIN -#define main xptdump_main -int xptdump_main(int argc, char *argv[]); +#define main genproxy_main +int genproxy_main(int argc, char *argv[]); #endif #endif @@ -132,6 +129,7 @@ static size_t get_file_length(const char* filename) #endif /* !(XP_MAC && XPIDL_PLUGIN) */ + int main(int argc, char **argv) { @@ -170,7 +168,13 @@ main(int argc, char **argv) dirname = optarg; break; case '?': - genproxy_usage(argv); + fprintf(stdout, + "Usage: %s [-biv] [-d dirname] \n" + " -b generate bytecodes, not Java source\n" + " -d write output to \n" + " -i generate interface, not proxy implementation\n" + " -v verbose mode\n", + argv[0]); return 1; } } @@ -349,7 +353,7 @@ GenproxyClass(FILE *out, if (parent_ide) { fprintf(out, " extends %s", parent_ide->name); } - fprintf(out, " {\n", ide->name); + fprintf(out, " {\n"); fprintf(out, "\n public static final String %s_STRING = \"", iidName);