Bug 1175513 - Improve code style in nsXPCWrappedJSClass::CleanupOutparams; r=bholley

This commit is contained in:
Ms2ger 2015-06-20 09:16:51 +02:00
parent 9343b89dde
commit d287437ca1

View File

@ -724,8 +724,8 @@ nsXPCWrappedJSClass::CleanupOutparams(JSContext* cx, uint16_t methodIndex,
const nsXPTType& type = param.GetType();
if (!type.deprecated_IsPointer())
continue;
void* p;
if (!(p = nativeParams[i].val.p))
void* p = nativeParams[i].val.p;
if (!p)
continue;
// The inOutOnly flag was introduced when consolidating two very
@ -733,9 +733,8 @@ nsXPCWrappedJSClass::CleanupOutparams(JSContext* cx, uint16_t methodIndex,
// if and why the difference is necessary.
if (!inOutOnly || param.IsIn()) {
if (type.IsArray()) {
void** pp;
if (nullptr != (pp = *((void***)p))) {
void** pp = *static_cast<void***>(p);
if (pp) {
// we need to get the array length and iterate the items
uint32_t array_count;
nsXPTType datum_type;
@ -753,10 +752,11 @@ nsXPCWrappedJSClass::CleanupOutparams(JSContext* cx, uint16_t methodIndex,
// always release the array if it is inout
free(pp);
}
} else
CleanupPointerTypeObject(type, (void**)p);
} else {
CleanupPointerTypeObject(type, static_cast<void**>(p));
}
}
*((void**)p) = nullptr;
*static_cast<void**>(p) = nullptr;
}
}