Bug 692342 - Introduce deprecated_IsPointer() to handle the cases that are too mucky to figure out right now. r=mrbkap

This commit is contained in:
Bobby Holley 2011-11-25 17:09:06 -08:00
parent 17bfc88fbe
commit 33085d10a1
2 changed files with 20 additions and 5 deletions

View File

@ -1471,7 +1471,7 @@ pre_call_clean_up:
continue;
const nsXPTType& type = param.GetType();
if (!type.IsPointer())
if (!type.deprecated_IsPointer())
continue;
void* p;
if (!(p = nativeParams[i].val.p))
@ -1488,7 +1488,7 @@ pre_call_clean_up:
if (NS_SUCCEEDED(mInfo->GetTypeForParam(methodIndex, &param,
1, &datum_type)) &&
datum_type.IsPointer() &&
datum_type.deprecated_IsPointer() &&
GetArraySizeFromParam(cx, info, param, methodIndex,
i, nativeParams, &array_count) &&
array_count) {
@ -1700,7 +1700,7 @@ pre_call_clean_up:
if (!param.IsOut())
continue;
const nsXPTType& type = param.GetType();
if (!type.IsPointer())
if (!type.deprecated_IsPointer())
continue;
void* p;
if (!(p = nativeParams[k].val.p))
@ -1715,7 +1715,7 @@ pre_call_clean_up:
if (NS_SUCCEEDED(mInfo->GetTypeForParam(methodIndex, &param,
1, &datum_type)) &&
datum_type.IsPointer() &&
datum_type.deprecated_IsPointer() &&
GetArraySizeFromParam(cx, info, param, methodIndex,
k, nativeParams, &array_count) &&
array_count) {

View File

@ -77,9 +77,24 @@ public:
bool IsReference() const
{return 0 != (XPT_TDP_IS_REFERENCE(flags));}
bool IsArithmetic() const // terminology from Harbison/Steele
// 'Arithmetic' here roughly means that the value is self-contained and
// doesn't depend on anything else in memory (ie: not a pointer, not an
// XPCOM object, not a jsval, etc).
//
// Supposedly this terminology comes from Harbison/Steele, but it's still
// a rather crappy name. We'd change it if it wasn't used all over the
// place in xptcall. :-(
bool IsArithmetic() const
{return flags <= T_WCHAR;}
// We used to abuse 'pointer' flag bit in typelib format quite extensively.
// We've gotten rid of most of the cases, but there's still a fair amount
// of refactoring to be done in XPCWrappedJSClass before we can safely stop
// asking about this. In the mean time, we've got a temporary version of
// IsPointer() that should be equivalent to what's in the typelib.
bool deprecated_IsPointer() const
{return !IsArithmetic() && TagPart() != T_JSVAL;}
bool IsInterfacePointer() const
{ switch (TagPart()) {
default: