зеркало из https://github.com/mozilla/pjs.git
Родитель
add36de033
Коммит
ff69fd44d3
|
@ -44,11 +44,8 @@ bcXPCOMMarshalToolkit::bcXPCOMMarshalToolkit(PRUint16 _methodIndex, nsIInterface
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < paramCount; i++) {
|
for (unsigned int i = 0; i < paramCount; i++) {
|
||||||
(params)[i].Init(_params[i], info->GetParam(i).GetType(),0);
|
uint8 flags = info->GetParam(i).IsOut() ? nsXPTCVariant::PTR_IS_DATA : 0;
|
||||||
if (info->GetParam(i).IsOut()) {
|
(params)[i].Init(_params[i], info->GetParam(i).GetType(),flags);
|
||||||
params[i].flags |= nsXPTCVariant::PTR_IS_DATA;
|
|
||||||
params[i].ptr = params[i].val.p = _params[i].val.p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +98,7 @@ nsresult bcXPCOMMarshalToolkit::Marshal(bcIMarshaler *m) {
|
||||||
}
|
}
|
||||||
nsXPTCVariant *value = & params[i];
|
nsXPTCVariant *value = & params[i];
|
||||||
void *data;
|
void *data;
|
||||||
data = (isOut) ? value->val.p : value;
|
data = (isOut) ? value->ptr : value;
|
||||||
r = MarshalElement(m,data,¶m,param.GetType().TagPart(),i);
|
r = MarshalElement(m,data,¶m,param.GetType().TagPart(),i);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -113,34 +110,23 @@ nsresult bcXPCOMMarshalToolkit::UnMarshal(bcIUnMarshaler *um) {
|
||||||
for (unsigned int i = 0; i < paramCount; i++) {
|
for (unsigned int i = 0; i < paramCount; i++) {
|
||||||
nsXPTParamInfo param = info->GetParam(i);
|
nsXPTParamInfo param = info->GetParam(i);
|
||||||
PRBool isOut = param.IsOut();
|
PRBool isOut = param.IsOut();
|
||||||
nsXPTCMiniVariant tmpValue = params[i]; //we need to set value for client side
|
|
||||||
nsXPTCMiniVariant * value;
|
nsXPTCMiniVariant * value;
|
||||||
value = &tmpValue;
|
value = ¶ms[i]; //we need to set value for client side
|
||||||
nsXPTType type = param.GetType();
|
nsXPTType type = param.GetType();
|
||||||
|
uint8 flags = isOut ? nsXPTCVariant::PTR_IS_DATA : 0;
|
||||||
if (callSide == onServer
|
if (callSide == onServer
|
||||||
&& param.IsOut()) { //we need to allocate memory for out parametr
|
&& param.IsOut()) { //we need to allocate memory for out parametr
|
||||||
value->val.p = allocator->Alloc(sizeof(nsXPTCMiniVariant)); // sizeof(nsXPTCMiniVariant) is good
|
value->val.p = allocator->Alloc(sizeof(nsXPTCMiniVariant)); // sizeof(nsXPTCMiniVariant) is good
|
||||||
params[i].Init(*value,type,0);
|
params[i].Init(*value,type,flags);
|
||||||
params[i].ptr = params[i].val.p = value->val.p;
|
|
||||||
params[i].flags |= nsXPTCVariant::PTR_IS_DATA;
|
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (callSide == onClient
|
|
||||||
&& param.GetType().IsPointer()
|
|
||||||
&& ! param.GetType().IsReference()
|
|
||||||
) {
|
|
||||||
allocator->Free(params[i].val.p);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if ( (callSide == onServer && !param.IsIn()
|
if ( (callSide == onServer && !param.IsIn()
|
||||||
|| (callSide == onClient && !param.IsOut()))){
|
|| (callSide == onClient && !param.IsOut()))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
void *data = (isOut) ? value->val.p : value;
|
void *data = (isOut) ? params[i].ptr : value;
|
||||||
UnMarshalElement(data, um, ¶m, param.GetType().TagPart(),allocator);
|
UnMarshalElement(data, um, ¶m, param.GetType().TagPart(),allocator);
|
||||||
params[i].Init(*value,type,0);
|
value = (nsXPTCMiniVariant*)((isOut) ? &data : data);
|
||||||
|
params[i].Init(*value,type, flags);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +158,7 @@ nsresult bcXPCOMMarshalToolkit::GetArraySizeFromParam( nsIInterfaceInfo *_interf
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
if(arg_param.IsOut())
|
if(arg_param.IsOut())
|
||||||
*result = *(PRUint32*)nativeParams[argnum].val.p;
|
*result = *(PRUint32*)nativeParams[argnum].ptr;
|
||||||
else
|
else
|
||||||
*result = nativeParams[argnum].val.u32;
|
*result = nativeParams[argnum].val.u32;
|
||||||
|
|
||||||
|
@ -298,7 +284,7 @@ nsresult bcXPCOMMarshalToolkit::MarshalElement(bcIMarshaler *m, void *data, nsXP
|
||||||
if(arg_type.IsPointer() &&
|
if(arg_type.IsPointer() &&
|
||||||
arg_type.TagPart() == nsXPTType::T_IID) {
|
arg_type.TagPart() == nsXPTType::T_IID) {
|
||||||
if(arg_param.IsOut())
|
if(arg_param.IsOut())
|
||||||
iid =*((nsID**)params[argnum].val.p);
|
iid =*((nsID**)params[argnum].ptr);
|
||||||
else
|
else
|
||||||
iid = (nsID*)params[argnum].val.p;
|
iid = (nsID*)params[argnum].val.p;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче