From 74ea7262abdf292f7cc1b91dbd62e88809a8afe4 Mon Sep 17 00:00:00 2001 From: "hpradhan%hotpop.com" Date: Wed, 23 Jun 2004 06:55:47 +0000 Subject: [PATCH] bug 246783 : Support base64binary type in webservices r+sr=jst --- .../webservices/proxy/src/wspinfoservice.cpp | 2 +- extensions/webservices/proxy/src/wspprivate.h | 3 +- extensions/webservices/proxy/src/wspproxy.cpp | 29 ++++++++++++------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/extensions/webservices/proxy/src/wspinfoservice.cpp b/extensions/webservices/proxy/src/wspinfoservice.cpp index e90d9e5d1c6c..9ab30631fc38 100644 --- a/extensions/webservices/proxy/src/wspinfoservice.cpp +++ b/extensions/webservices/proxy/src/wspinfoservice.cpp @@ -1247,7 +1247,7 @@ nsWSPInterfaceInfoService::InfoForPort(nsIWSDLPort *aPort, // handle array size_of/length_of. if (XPT_TDP_TAG(pparamDesc->type.prefix) == TD_ARRAY) { pparamDesc->type.argnum = - pparamDesc->type.argnum2 = k; // not '-1' because of leading arg + pparamDesc->type.argnum2 = k - 1; } } diff --git a/extensions/webservices/proxy/src/wspprivate.h b/extensions/webservices/proxy/src/wspprivate.h index c6cb58587e62..b9749fb470c3 100644 --- a/extensions/webservices/proxy/src/wspprivate.h +++ b/extensions/webservices/proxy/src/wspprivate.h @@ -130,7 +130,8 @@ public: nsIInterfaceInfo* aInterfaceInfo, nsIVariant* aProperty); static nsresult VariantToArrayValue(uint8 aTypeTag, - nsXPTCMiniVariant* aResult, + nsXPTCMiniVariant* aResultSize, + nsXPTCMiniVariant* aResultArray, nsIInterfaceInfo* aInterfaceInfo, nsIVariant* aProperty); diff --git a/extensions/webservices/proxy/src/wspproxy.cpp b/extensions/webservices/proxy/src/wspproxy.cpp index 9d5d2f84a6ca..46910962b87a 100644 --- a/extensions/webservices/proxy/src/wspproxy.cpp +++ b/extensions/webservices/proxy/src/wspproxy.cpp @@ -666,6 +666,7 @@ WSPProxy::XPTCMiniVariantToVariant(uint8 aTypeTag, nsXPTCMiniVariant aResult, var->SetAsWString(NS_STATIC_CAST(PRUnichar*, aResult.val.p)); break; case nsXPTType::T_DOMSTRING: + case nsXPTType::T_ASTRING: var->SetAsAString(*((nsAString*)aResult.val.p)); break; case nsXPTType::T_INTERFACE: @@ -816,9 +817,6 @@ WSPProxy::VariantToInParameter(nsIInterfaceInfo* aInterfaceInfo, return rv; } - // Set the param's type on the XPTCVariant because xptcinvoke's - // invoke_copy_to_stack depends on it. This fixes bug 203434. - aXPTCVariant->type = type; uint8 type_tag = type.TagPart(); nsCOMPtr iinfo; @@ -838,9 +836,15 @@ WSPProxy::VariantToInParameter(nsIInterfaceInfo* aInterfaceInfo, } } - return VariantToArrayValue(arrayType.TagPart(), aXPTCVariant, + aXPTCVariant[0].type = nsXPTType::T_U32; + aXPTCVariant[1].type = nsXPTType::T_ARRAY; + aXPTCVariant[1].SetValIsArray(); + return VariantToArrayValue(arrayType.TagPart(), aXPTCVariant, aXPTCVariant+1, iinfo, aVariant); } + // Set the param's type on the XPTCVariant because xptcinvoke's + // invoke_copy_to_stack depends on it. This fixes bug 203434. + aXPTCVariant->type = type; // else if (type.IsInterfacePointer()) { rv = aInterfaceInfo->GetInfoForParam(aMethodIndex, aParamInfo, @@ -892,7 +896,8 @@ WSPProxy::VariantToOutParameter(nsIInterfaceInfo* aInterfaceInfo, return rv; } } - return VariantToArrayValue(arrayType.TagPart(), aMiniVariant, + return VariantToArrayValue(arrayType.TagPart(), + aMiniVariant, aMiniVariant + 1, iinfo, aVariant); } // else @@ -978,6 +983,7 @@ WSPProxy::VariantToValue(uint8 aTypeTag, void* aValue, rv = aProperty->GetAsWString((PRUnichar**)aValue); break; case nsXPTType::T_DOMSTRING: + case nsXPTType::T_ASTRING: rv = aProperty->GetAsAString(*(nsAString*)aValue); break; case nsXPTType::T_INTERFACE: @@ -1023,7 +1029,9 @@ WSPProxy::VariantToValue(uint8 aTypeTag, void* aValue, } nsresult -WSPProxy::VariantToArrayValue(uint8 aTypeTag, nsXPTCMiniVariant* aResult, +WSPProxy::VariantToArrayValue(uint8 aTypeTag, + nsXPTCMiniVariant* aResultSize, + nsXPTCMiniVariant* aResultArray, nsIInterfaceInfo* aInterfaceInfo, nsIVariant* aProperty) { @@ -1037,7 +1045,8 @@ WSPProxy::VariantToArrayValue(uint8 aTypeTag, nsXPTCMiniVariant* aResult, return rv; } - *((PRUint32*)aResult[0].val.p) = count; + aResultSize->val.u32 = count; + switch (aTypeTag) { case nsXPTType::T_I8: case nsXPTType::T_U8: @@ -1054,13 +1063,13 @@ WSPProxy::VariantToArrayValue(uint8 aTypeTag, nsXPTCMiniVariant* aResult, case nsXPTType::T_WCHAR: case nsXPTType::T_CHAR_STR: case nsXPTType::T_WCHAR_STR: - *((void**)aResult[1].val.p) = array; + aResultArray->val.p = array; break; case nsXPTType::T_INTERFACE: case nsXPTType::T_INTERFACE_IS: { if (arrayIID.Equals(NS_GET_IID(nsIVariant))) { - *((void**)aResult[1].val.p) = array; + aResultArray->val.p = array; } else if (!arrayIID.Equals(NS_GET_IID(nsIPropertyBag))) { NS_ERROR("Array of complex types should be represented by property " @@ -1097,7 +1106,7 @@ WSPProxy::VariantToArrayValue(uint8 aTypeTag, nsXPTCMiniVariant* aResult, } } } - *((void**)aResult[1].val.p) = outptr; + aResultArray->val.p = outptr; } break; }