To compile on Linux, renamed 'jarray' to 'theJarray' (jarray is a JNI type), and made sure all paths in xpjd_GetInterfaceInfoNative() return a jboolean (bug 15279).

Updated genproxy usage message, and moved printf within cmdline parsing code (bug 15386).
r=edburns@acm.org,akhil.arora@sun.com perm=scc
This commit is contained in:
frankm%eng.sun.com 1999-10-02 00:18:02 +00:00
parent 12272aee6f
commit ff41abd7f6
4 changed files with 24 additions and 19 deletions

View File

@ -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 <mozilla-source-dir>/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

View File

@ -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,

View File

@ -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_;

View File

@ -28,6 +28,9 @@
#include <sys/stat.h>
#endif
#include <stdlib.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#include <string.h>
#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] <filename.xpt>\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] <filename.xpt>\n"
" -b generate bytecodes, not Java source\n"
" -d write output to <dirname>\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);