mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Fix logging to not use variable arguments (not supported by win32 compiler).
This commit is contained in:
parent
24f3a13d99
commit
fd060f4ede
@ -405,7 +405,7 @@ XPCOM_NATIVE(FinalizeStub) (JNIEnv *env, jclass that, jobject aJavaObject)
|
||||
jclass clazz = env->GetObjectClass(aJavaObject);
|
||||
jstring name = (jstring) env->CallObjectMethod(clazz, getNameMID);
|
||||
const char* javaObjectName = env->GetStringUTFChars(name, &isCopy);
|
||||
LOG("*** Finalize(java_obj=%s)\n", javaObjectName);
|
||||
LOG(("*** Finalize(java_obj=%s)\n", javaObjectName));
|
||||
if (isCopy)
|
||||
env->ReleaseStringUTFChars(name, javaObjectName);
|
||||
#endif
|
||||
|
@ -69,7 +69,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_I8:
|
||||
case nsXPTType::T_U8:
|
||||
{
|
||||
LOG("byte\n");
|
||||
LOG(("byte\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.u8 = env->CallByteMethod(aParam, byteValueMID);
|
||||
} else {
|
||||
@ -91,7 +91,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_I16:
|
||||
case nsXPTType::T_U16:
|
||||
{
|
||||
LOG("short\n");
|
||||
LOG(("short\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.u16 = env->CallShortMethod(aParam, shortValueMID);
|
||||
} else {
|
||||
@ -113,7 +113,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_I32:
|
||||
case nsXPTType::T_U32:
|
||||
{
|
||||
LOG("int\n");
|
||||
LOG(("int\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.u32 = env->CallIntMethod(aParam, intValueMID);
|
||||
} else {
|
||||
@ -135,7 +135,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_I64:
|
||||
case nsXPTType::T_U64:
|
||||
{
|
||||
LOG("long\n");
|
||||
LOG(("long\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.u64 = env->CallLongMethod(aParam, longValueMID);
|
||||
} else {
|
||||
@ -156,7 +156,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
|
||||
case nsXPTType::T_FLOAT:
|
||||
{
|
||||
LOG("float\n");
|
||||
LOG(("float\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.f = env->CallFloatMethod(aParam, floatValueMID);
|
||||
} else {
|
||||
@ -177,7 +177,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
|
||||
case nsXPTType::T_DOUBLE:
|
||||
{
|
||||
LOG("double\n");
|
||||
LOG(("double\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.d = env->CallDoubleMethod(aParam, doubleValueMID);
|
||||
} else {
|
||||
@ -198,7 +198,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
|
||||
case nsXPTType::T_BOOL:
|
||||
{
|
||||
LOG("boolean\n");
|
||||
LOG(("boolean\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
aVariant.val.b = env->CallBooleanMethod(aParam, booleanValueMID);
|
||||
} else {
|
||||
@ -220,7 +220,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_CHAR:
|
||||
case nsXPTType::T_WCHAR:
|
||||
{
|
||||
LOG("char\n");
|
||||
LOG(("char\n"));
|
||||
if (!aParamInfo.IsOut()) {
|
||||
if (tag == nsXPTType::T_CHAR)
|
||||
aVariant.val.c = env->CallCharMethod(aParam, charValueMID);
|
||||
@ -245,7 +245,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_CHAR_STR:
|
||||
case nsXPTType::T_WCHAR_STR:
|
||||
{
|
||||
LOG("String\n");
|
||||
LOG(("String\n"));
|
||||
jstring data = nsnull;
|
||||
if (!aParamInfo.IsOut()) {
|
||||
data = (jstring) aParam;
|
||||
@ -274,7 +274,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
|
||||
case nsXPTType::T_IID:
|
||||
{
|
||||
LOG("String(IID)\n");
|
||||
LOG(("String(IID)\n"));
|
||||
jstring data = nsnull;
|
||||
if (!aParamInfo.IsOut()) {
|
||||
data = (jstring) aParam;
|
||||
@ -304,7 +304,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_INTERFACE:
|
||||
case nsXPTType::T_INTERFACE_IS:
|
||||
{
|
||||
LOG("nsISupports\n");
|
||||
LOG(("nsISupports\n"));
|
||||
jobject java_obj = nsnull;
|
||||
if (!aParamInfo.IsOut()) {
|
||||
java_obj = (jobject) aParam;
|
||||
@ -373,7 +373,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_ASTRING:
|
||||
case nsXPTType::T_DOMSTRING:
|
||||
{
|
||||
LOG("String\n");
|
||||
LOG(("String\n"));
|
||||
jstring data = nsnull;
|
||||
if (!aParamInfo.IsOut()) {
|
||||
data = (jstring) aParam;
|
||||
@ -401,7 +401,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
case nsXPTType::T_UTF8STRING:
|
||||
case nsXPTType::T_CSTRING:
|
||||
{
|
||||
LOG("StringUTF\n");
|
||||
LOG(("StringUTF\n"));
|
||||
jstring data = nsnull;
|
||||
if (!aParamInfo.IsOut()) {
|
||||
data = (jstring) aParam;
|
||||
@ -438,7 +438,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
{
|
||||
if (env->IsInstanceOf(aParam, intArrayClass))
|
||||
{
|
||||
LOG("int[] (void*)\n");
|
||||
LOG(("int[] (void*)\n"));
|
||||
jboolean isCopy = JNI_FALSE;
|
||||
jint* buf = nsnull;
|
||||
if (aParam) {
|
||||
@ -451,7 +451,7 @@ SetupParams(JNIEnv *env, const jobject aParam, const nsXPTParamInfo &aParamInfo,
|
||||
aVariant.flags |= nsXPTCVariant::VAL_IS_ALLOCD;
|
||||
}
|
||||
} else {
|
||||
LOG("int (void*)\n");
|
||||
LOG(("int (void*)\n"));
|
||||
NS_ASSERTION(type.IsPointer(), "T_VOID 'int' handler received non-pointer type");
|
||||
aVariant.val.p = (void*) env->CallIntMethod(aParam, intValueMID);
|
||||
}
|
||||
@ -878,7 +878,7 @@ SetRetval(JNIEnv *env, const nsXPTParamInfo &aParamInfo,
|
||||
|
||||
case nsXPTType::T_VOID:
|
||||
// handle "void *" as an "int" in Java
|
||||
LOG(" returns int (void*)");
|
||||
LOG((" returns int (void*)"));
|
||||
aResult.i = (jint) aVariant.val.p;
|
||||
break;
|
||||
|
||||
@ -918,7 +918,7 @@ CallXPCOMMethod(JNIEnv *env, jclass that, jobject aJavaObject,
|
||||
#ifdef DEBUG
|
||||
const char* ifaceName;
|
||||
iinfo->GetNameShared(&ifaceName);
|
||||
LOG("=> Calling %s::%s()\n", ifaceName, methodInfo->GetName());
|
||||
LOG(("=> Calling %s::%s()\n", ifaceName, methodInfo->GetName()));
|
||||
#endif
|
||||
|
||||
PRUint8 paramCount = methodInfo->GetParamCount();
|
||||
@ -929,14 +929,14 @@ CallXPCOMMethod(JNIEnv *env, jclass that, jobject aJavaObject,
|
||||
|
||||
for (PRUint8 i = 0; i < paramCount && NS_SUCCEEDED(rv); i++)
|
||||
{
|
||||
LOG("\t Param %d: ", i);
|
||||
LOG(("\t Param %d: ", i));
|
||||
const nsXPTParamInfo ¶mInfo = methodInfo->GetParam(i);
|
||||
|
||||
if (!paramInfo.IsRetval() && !paramInfo.IsDipper()) {
|
||||
rv = SetupParams(env, env->GetObjectArrayElement(aParams, i), paramInfo,
|
||||
methodInfo, iinfo, aMethodIndex, params, params[i]);
|
||||
} else if (paramInfo.IsDipper()) {
|
||||
LOG("dipper");
|
||||
LOG(("dipper"));
|
||||
const nsXPTType &type = paramInfo.GetType();
|
||||
switch (type.TagPart())
|
||||
{
|
||||
@ -957,11 +957,11 @@ CallXPCOMMethod(JNIEnv *env, jclass that, jobject aJavaObject,
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG("unhandled dipper type\n");
|
||||
LOG(("unhandled dipper type\n"));
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
} else {
|
||||
LOG("retval\n");
|
||||
LOG(("retval\n"));
|
||||
params[i].ptr = &(params[i].val);
|
||||
params[i].type = paramInfo.GetType();
|
||||
params[i].flags = nsXPTCVariant::PTR_IS_DATA;
|
||||
@ -1001,12 +1001,12 @@ CallXPCOMMethod(JNIEnv *env, jclass that, jobject aJavaObject,
|
||||
// However, GetIIDForMethodParam may need some of the nsID params when it's
|
||||
// looking for the IID of an INTERFACE_IS. Therefore, we can't delete it
|
||||
// until we've gone through the 'Finalize' loop once and created the result.
|
||||
for (PRUint8 i = 0; i < paramCount && NS_SUCCEEDED(rv); i++)
|
||||
for (PRUint8 j = 0; j < paramCount && NS_SUCCEEDED(rv); j++)
|
||||
{
|
||||
const nsXPTParamInfo ¶mInfo = methodInfo->GetParam(i);
|
||||
const nsXPTParamInfo ¶mInfo = methodInfo->GetParam(j);
|
||||
const nsXPTType &type = paramInfo.GetType();
|
||||
if (type.TagPart() == nsXPTType::T_IID) {
|
||||
nsID* iid = (nsID*) params[i].ptr;
|
||||
nsID* iid = (nsID*) params[j].ptr;
|
||||
delete iid;
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +164,8 @@ AddJavaXPCOMBinding(JNIEnv* env, jobject aJavaObject, void* aXPCOMObject)
|
||||
entry->mJavaObject = java_ref;
|
||||
entry->mXPCOMInstance = aXPCOMObject;
|
||||
|
||||
LOG("+ Adding Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x) weakref=0x%08x\n",
|
||||
hash, (int) xpcomObjKey, (PRUint32) java_ref);
|
||||
LOG(("+ Adding Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x) weakref=0x%08x\n",
|
||||
hash, (int) xpcomObjKey, (PRUint32) java_ref));
|
||||
}
|
||||
|
||||
void
|
||||
@ -222,8 +222,8 @@ RemoveJavaXPCOMBinding(JNIEnv* env, jobject aJavaObject, void* aXPCOMObject)
|
||||
PL_DHashTableOperate(gJAVAtoXPCOMBindings, NS_INT32_TO_PTR(hash),
|
||||
PL_DHASH_REMOVE);
|
||||
PL_DHashTableOperate(gXPCOMtoJAVABindings, xpcomObjKey, PL_DHASH_REMOVE);
|
||||
LOG("- Removing Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x) weakref=0x%08x\n",
|
||||
hash, (int) xpcomObjKey, (PRUint32) jweakref);
|
||||
LOG(("- Removing Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x) weakref=0x%08x\n",
|
||||
hash, (int) xpcomObjKey, (PRUint32) jweakref));
|
||||
|
||||
env->DeleteWeakGlobalRef(NS_STATIC_CAST(jweak, jweakref));
|
||||
}
|
||||
@ -247,8 +247,8 @@ GetMatchingXPCOMObject(JNIEnv* env, jobject aJavaObject)
|
||||
xpcomObjKey = GetXPTCStubAddr(entry->mXPCOMInstance);
|
||||
else
|
||||
xpcomObjKey = ((JavaXPCOMInstance*) entry->mXPCOMInstance)->GetInstance();
|
||||
LOG("< Get Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n",
|
||||
hash, (int) xpcomObjKey);
|
||||
LOG(("< Get Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n",
|
||||
hash, (int) xpcomObjKey));
|
||||
#endif
|
||||
return entry->mXPCOMInstance;
|
||||
}
|
||||
@ -282,8 +282,8 @@ GetMatchingJavaObject(JNIEnv* env, void* aXPCOMObject)
|
||||
}
|
||||
|
||||
if (java_obj) {
|
||||
LOG("< Get Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n",
|
||||
env->CallIntMethod(java_obj, hashCodeMID), (int) aXPCOMObject);
|
||||
LOG(("< Get Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n",
|
||||
env->CallIntMethod(java_obj, hashCodeMID), (int) aXPCOMObject));
|
||||
}
|
||||
|
||||
return java_obj;
|
||||
|
@ -43,9 +43,9 @@
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#ifdef DEBUG_pedemonte
|
||||
#define LOG(...) printf(__VA_ARGS__)
|
||||
#define LOG(x) printf x
|
||||
#else
|
||||
#define LOG(...) /* nothing */
|
||||
#define LOG(x) /* nothing */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -67,9 +67,9 @@ nsJavaXPTCStub::nsJavaXPTCStub(JNIEnv* aJavaEnv, jobject aJavaObject,
|
||||
nsMemory::Free(iid);
|
||||
}
|
||||
}
|
||||
LOG("+++ nsJavaXPTCStub(this=0x%08x java_obj=0x%08x %s iid=%s)\n", (int) this,
|
||||
LOG(("+++ nsJavaXPTCStub(this=0x%08x java_obj=0x%08x %s iid=%s)\n", (int) this,
|
||||
mJavaEnv->CallIntMethod(mJavaObject, hashCodeMID), javaObjectName,
|
||||
iid_str ? iid_str : "NULL");
|
||||
iid_str ? iid_str : "NULL"));
|
||||
if (isCopy)
|
||||
mJavaEnv->ReleaseStringUTFChars(name, javaObjectName);
|
||||
if (iid_str)
|
||||
@ -84,8 +84,8 @@ nsJavaXPTCStub::~nsJavaXPTCStub()
|
||||
jclass clazz = mJavaEnv->GetObjectClass(mJavaObject);
|
||||
jstring name = (jstring) mJavaEnv->CallObjectMethod(clazz, getNameMID);
|
||||
const char* javaObjectName = mJavaEnv->GetStringUTFChars(name, &isCopy);
|
||||
LOG("--- ~nsJavaXPTCStub(this=0x%08x java_obj=0x%08x %s)\n", (int) this,
|
||||
mJavaEnv->CallIntMethod(mJavaObject, hashCodeMID), javaObjectName);
|
||||
LOG(("--- ~nsJavaXPTCStub(this=0x%08x java_obj=0x%08x %s)\n", (int) this,
|
||||
mJavaEnv->CallIntMethod(mJavaObject, hashCodeMID), javaObjectName));
|
||||
if (isCopy)
|
||||
mJavaEnv->ReleaseStringUTFChars(name, javaObjectName);
|
||||
#endif
|
||||
@ -139,7 +139,7 @@ nsJavaXPTCStub::Release()
|
||||
NS_IMETHODIMP
|
||||
nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr)
|
||||
{
|
||||
LOG("JavaStub::QueryInterface()\n");
|
||||
LOG(("JavaStub::QueryInterface()\n"));
|
||||
nsJavaXPTCStub *master = mMaster ? mMaster : this;
|
||||
|
||||
// This helps us differentiate between the help classes.
|
||||
@ -177,7 +177,7 @@ nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr)
|
||||
}
|
||||
|
||||
// Query Java object
|
||||
LOG("\tCalling Java object queryInterface\n");
|
||||
LOG(("\tCalling Java object queryInterface\n"));
|
||||
jclass clazz = mJavaEnv->GetObjectClass(mJavaObject);
|
||||
char* sig = "(Ljava/lang/String;)Lorg/mozilla/xpcom/nsISupports;";
|
||||
jmethodID qiMID = mJavaEnv->GetMethodID(clazz, "queryInterface", sig);
|
||||
@ -280,7 +280,7 @@ nsJavaXPTCStub::CallMethod(PRUint16 aMethodIndex,
|
||||
#ifdef DEBUG
|
||||
const char* ifaceName;
|
||||
mIInfo->GetNameShared(&ifaceName);
|
||||
LOG("nsJavaXPTCStub::CallMethod [%s::%s]\n", ifaceName, aMethodInfo->GetName());
|
||||
LOG(("nsJavaXPTCStub::CallMethod [%s::%s]\n", ifaceName, aMethodInfo->GetName()));
|
||||
#endif
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
@ -1271,7 +1271,7 @@ nsJavaXPTCStub::GetWeakReference(nsIWeakReference** aInstancePtr)
|
||||
if (mMaster)
|
||||
return mMaster->GetWeakReference(aInstancePtr);
|
||||
|
||||
LOG("==> nsJavaXPTCStub::GetWeakReference()\n");
|
||||
LOG(("==> nsJavaXPTCStub::GetWeakReference()\n"));
|
||||
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
Loading…
Reference in New Issue
Block a user