示例#1
0
	JNIEXPORT void JNICALL Java_com_tangram_Variant_putVariantDoubleRef(JNIEnv *env, jobject _this, jdouble s)
	{
		VARIANT *v = extractVariant(env, _this);
		if (v) {
			double *ps = (double *)CoTaskMemAlloc(sizeof(double));
			*ps = s;
			V_VT(v) = VT_R8 | VT_BYREF;
			V_R8REF(v) = ps;
		}
	}
示例#2
0
	JNIEXPORT jdouble JNICALL Java_com_tangram_Variant_getVariantDoubleRef(JNIEnv *env, jobject _this)
	{
		VARIANT *v = extractVariant(env, _this);
		if (v) {
			if (V_VT(v) != (VT_R8 | VT_BYREF)) {
				return NULL;
			}
			return (jdouble)*V_R8REF(v);
		}
		return NULL;
	}
示例#3
0
SEXP
R_setDynamicVariantValue(SEXP ref, SEXP val)
{
  VARIANT *var;
  VARTYPE rtype;

  var = R_getVariantRef(ref);
  rtype = V_VT(var) & (~ VT_BYREF);
  switch(rtype) {
  case VT_BOOL:
    *V_BOOLREF(var) = LOGICAL(val)[0];
    break;
  case VT_I4:
    *V_I4REF(var) = INTEGER(val)[0];
    break;
  case VT_R8:
    *V_R8REF(var) = REAL(val)[0];
    break;
  default:
    return(R_NilValue);
  }

  return(R_NilValue);
}
示例#4
0
SEXP
R_getDynamicVariantValue(SEXP ref)
{
  VARIANT *var;
  VARTYPE rtype;

  var = R_getVariantRef(ref);
  rtype = V_VT(var) & (~ VT_BYREF);
  switch(rtype) {
  case VT_BOOL:
    return(ScalarLogical(*V_BOOLREF(var)));
    break;
  case VT_I4:
    return(ScalarInteger(*V_I4REF(var)));
    break;
  case VT_R8:
    return(ScalarReal(*V_R8REF(var)));
    break;
  default:
    return(R_NilValue);
  }

  return(R_NilValue);
}
示例#5
0
static void
ole_val2ptr_variant(VALUE val, VARIANT *var)
{
    switch (TYPE(val)) {
    case T_STRING:
        if (V_VT(var) == (VT_BSTR | VT_BYREF)) {
            *V_BSTRREF(var) = ole_vstr2wc(val);
        }
        break;
    case T_FIXNUM:
        switch(V_VT(var)) {
        case (VT_UI1 | VT_BYREF) :
            *V_UI1REF(var) = NUM2CHR(val);
            break;
        case (VT_I2 | VT_BYREF) :
            *V_I2REF(var) = (short)NUM2INT(val);
            break;
        case (VT_I4 | VT_BYREF) :
            *V_I4REF(var) = NUM2INT(val);
            break;
        case (VT_R4 | VT_BYREF) :
            *V_R4REF(var) = (float)NUM2INT(val);
            break;
        case (VT_R8 | VT_BYREF) :
            *V_R8REF(var) = NUM2INT(val);
            break;
        default:
            break;
        }
        break;
    case T_FLOAT:
        switch(V_VT(var)) {
        case (VT_I2 | VT_BYREF) :
            *V_I2REF(var) = (short)NUM2INT(val);
            break;
        case (VT_I4 | VT_BYREF) :
            *V_I4REF(var) = NUM2INT(val);
            break;
        case (VT_R4 | VT_BYREF) :
            *V_R4REF(var) = (float)NUM2DBL(val);
            break;
        case (VT_R8 | VT_BYREF) :
            *V_R8REF(var) = NUM2DBL(val);
            break;
        default:
            break;
        }
        break;
    case T_BIGNUM:
        if (V_VT(var) == (VT_R8 | VT_BYREF)) {
            *V_R8REF(var) = rb_big2dbl(val);
        }
        break;
    case T_TRUE:
        if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
            *V_BOOLREF(var) = VARIANT_TRUE;
        }
        break;
    case T_FALSE:
        if (V_VT(var) == (VT_BOOL | VT_BYREF)) {
            *V_BOOLREF(var) = VARIANT_FALSE;
        }
        break;
    default:
        break;
    }
}
示例#6
0
static void
putOutVariant (Tcl_Interp *interp,
               VARIANT *pDest,
               TclObject &tclObject,
               const Type &type)
{
    switch (type.vartype()) {
    case VT_BOOL:
        *V_BOOLREF(pDest) = tclObject.getBool() ? VARIANT_TRUE : VARIANT_FALSE;
        break;

    case VT_R4:
        *V_R4REF(pDest) = static_cast<float>(tclObject.getDouble());
        break;

    case VT_R8:
        *V_R8REF(pDest) = tclObject.getDouble();
        break;

    case VT_DISPATCH:
    case VT_UNKNOWN:
    case VT_USERDEFINED:
        {
            IUnknown *pUnknown;

            Tcl_Obj *pObj = tclObject;
            if (pObj->typePtr == &Extension::unknownPointerType) {
                pUnknown =
                    static_cast<IUnknown *>(pObj->internalRep.otherValuePtr);
            } else {
                Reference *pRef = Extension::referenceHandles.find(
                    interp, tclObject);
                pUnknown = (pRef == 0) ? 0 : pRef->unknown();
            }

            *V_UNKNOWNREF(pDest) = pUnknown;

            // The COM rules say we must increment the reference count of
            // interface pointers returned from methods.
            if (pUnknown != 0) {
                pUnknown->AddRef();
            }
        }
        break;

    case VT_BSTR:
        *V_BSTRREF(pDest) = tclObject.getBSTR();
        break;

    case VT_VARIANT:
        {
            // Must increment reference count of interface pointers returned
            // from methods.
            tclObject.toVariant(
                V_VARIANTREF(pDest), Type::variant(), interp, true);
        }
        break;

    case VT_SAFEARRAY:
        if (*V_ARRAYREF(pDest) != 0) {
            SafeArrayDestroy(*V_ARRAYREF(pDest));
        }
        *V_ARRAYREF(pDest) =
            tclObject.getSafeArray(type.elementType(), interp);
        break;

    default:
        *V_I4REF(pDest) = tclObject.getLong();
    }
}
示例#7
0
static void
ole_set_byref(VARIANT *realvar, VARIANT *var,  VARTYPE vt)
{
    V_VT(var) = vt;
    if (vt == (VT_VARIANT|VT_BYREF)) {
        V_VARIANTREF(var) = realvar;
    } else {
        if (V_VT(realvar) != (vt & ~VT_BYREF)) {
            rb_raise(eWIN32OLERuntimeError, "variant type mismatch");
        }
        switch(vt & ~VT_BYREF) {
        case VT_I1:
            V_I1REF(var) = &V_I1(realvar);
            break;
        case VT_UI1:
            V_UI1REF(var) = &V_UI1(realvar);
            break;
        case VT_I2:
            V_I2REF(var) = &V_I2(realvar);
            break;
        case VT_UI2:
            V_UI2REF(var) = &V_UI2(realvar);
            break;
        case VT_I4:
            V_I4REF(var) = &V_I4(realvar);
            break;
        case VT_UI4:
            V_UI4REF(var) = &V_UI4(realvar);
            break;
        case VT_R4:
            V_R4REF(var) = &V_R4(realvar);
            break;
        case VT_R8:
            V_R8REF(var) = &V_R8(realvar);
            break;

#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
#ifdef V_I8REF
        case VT_I8:
            V_I8REF(var) = &V_I8(realvar);
            break;
#endif
#ifdef V_UI8REF
        case VT_UI8:
            V_UI8REF(var) = &V_UI8(realvar);
            break;
#endif
#endif
        case VT_INT:
            V_INTREF(var) = &V_INT(realvar);
            break;

        case VT_UINT:
            V_UINTREF(var) = &V_UINT(realvar);
            break;

        case VT_CY:
            V_CYREF(var) = &V_CY(realvar);
            break;
        case VT_DATE:
            V_DATEREF(var) = &V_DATE(realvar);
            break;
        case VT_BSTR:
            V_BSTRREF(var) = &V_BSTR(realvar);
            break;
        case VT_DISPATCH:
            V_DISPATCHREF(var) = &V_DISPATCH(realvar);
            break;
        case VT_ERROR:
            V_ERRORREF(var) = &V_ERROR(realvar);
            break;
        case VT_BOOL:
            V_BOOLREF(var) = &V_BOOL(realvar);
            break;
        case VT_UNKNOWN:
            V_UNKNOWNREF(var) = &V_UNKNOWN(realvar);
            break;
        case VT_ARRAY:
            V_ARRAYREF(var) = &V_ARRAY(realvar);
            break;
        default:
            rb_raise(eWIN32OLERuntimeError, "unknown type specified(setting BYREF):%d", vt);
            break;
        }
    }
}
示例#8
0
void EventProxy::convertJavaVariant(VARIANT *java, VARIANT *com) {

	  switch (com->vt)
	  {	  
		case VT_DISPATCH:
		{
			switch (java->vt)
			{
				case VT_DISPATCH:
				{
					V_DISPATCH(com) = V_DISPATCH(java);
					break;
				}

				case VT_DISPATCH | VT_BYREF:
				{
					V_DISPATCH(com) = *V_DISPATCHREF(java);
					break;
				}
			}
			break;
		}

		case VT_DISPATCH | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_DISPATCH:
				{
					*V_DISPATCHREF(com) = V_DISPATCH(java);
					break;
				}

				case VT_DISPATCH | VT_BYREF:
				{
					*V_DISPATCHREF(com) = *V_DISPATCHREF(java);
					break;
				}
			}
			break;
		}

		case VT_BOOL:
		{
			switch (java->vt)
			{
				case VT_BOOL:
				{
					V_BOOL(com) = V_BOOL(java);
					break;
				}

				case VT_BOOL | VT_BYREF:
				{
					V_BOOL(com) = *V_BOOLREF(java);
					break;
				}
			}
			break;
		}

		case VT_BOOL | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_BOOL:
				{
					*V_BOOLREF(com) = V_BOOL(java);
					break;
				}

				case VT_BOOL | VT_BYREF:
				{
					*V_BOOLREF(com) = *V_BOOLREF(java);
					break;
				}
			}
			break;
		}

		case VT_UI1:
		{
			switch (java->vt)
			{
				case VT_UI1:
				{
					V_UI1(com) = V_UI1(java);
					break;
				}

				case VT_UI1 | VT_BYREF:
				{
					V_UI1(com) = *V_UI1REF(java);
					break;
				}
			}
			break;
		}

		case VT_UI1 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_UI1:
				{
					*V_UI1REF(com) = V_UI1(java);
					break;
				}

				case VT_UI1 | VT_BYREF:
				{
					*V_UI1REF(com) = *V_UI1REF(java);
					break;
				}
			}
			break;
		}


		case VT_I2:
		{
			switch (java->vt)
			{
				case VT_I2:
				{
					V_I2(com) = V_I2(java);
					break;
				}

				case VT_I2 | VT_BYREF:
				{
					V_I2(com) = *V_I2REF(java);
					break;
				}
			}
			break;
		}

		case VT_I2 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_I2:
				{
					*V_I2REF(com) = V_I2(java);
					break;
				}

				case VT_I2 | VT_BYREF:
				{
					*V_I2REF(com) = *V_I2REF(java);
					break;
				}
			}
			break;
		}

		case VT_I4:
		{
			switch (java->vt)
			{
				case VT_I4:
				{
					V_I4(com) = V_I4(java);
					break;
				}

				case VT_I4 | VT_BYREF:
				{
					V_I4(com) = *V_I4REF(java);
					break;
				}
			}
			break;
		}

		case VT_I4 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_I4:
				{
					*V_I4REF(com) = V_I4(java);
					break;
				}

				case VT_I4 | VT_BYREF:
				{
					*V_I4REF(com) = *V_I4REF(java);
					break;
				}
			}
			break;
		}

		case VT_R4:
		{
			switch (java->vt)
			{
				case VT_R4:
				{
					V_R4(com) = V_R4(java);
					break;
				}

				case VT_R4 | VT_BYREF:
				{
					V_R4(com) = *V_R4REF(java);
					break;
				}
			}
			break;
		}

		case VT_R4 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_R4:
				{
					*V_R4REF(com) = V_R4(java);
					break;
				}

				case VT_R4 | VT_BYREF:
				{
					*V_R4REF(com) = *V_R4REF(java);
					break;
				}
			}
			break;
		}

		case VT_R8:
		{
			switch (java->vt)
			{
				case VT_R8:
				{
					V_R8(com) = V_R8(java);
					break;
				}

				case VT_R8 | VT_BYREF:
				{
					V_R8(com) = *V_R8REF(java);
					break;
				}
			}
			break;
		}

		case VT_R8 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_R8:
				{
					*V_R8REF(com) = V_R8(java);
					break;
				}

				case VT_R8 | VT_BYREF:
				{
					*V_R8REF(com) = *V_R8REF(java);
					break;
				}
			}
			break;
		}

				case VT_I1:
		{
			switch (java->vt)
			{
				case VT_I1:
				{
					V_I1(com) = V_I1(java);
					break;
				}

				case VT_I1 | VT_BYREF:
				{
					V_I1(com) = *V_I1REF(java);
					break;
				}
			}
			break;
		}

		case VT_I1 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_I1:
				{
					*V_I1REF(com) = V_I1(java);
					break;
				}

				case VT_I1 | VT_BYREF:
				{
					*V_I1REF(com) = *V_I1REF(java);
					break;
				}
			}
			break;
		}

				case VT_UI2:
		{
			switch (java->vt)
			{
				case VT_UI2:
				{
					V_UI2(com) = V_UI2(java);
					break;
				}

				case VT_UI2 | VT_BYREF:
				{
					V_UI2(com) = *V_UI2REF(java);
					break;
				}
			}
			break;
		}

		case VT_UI2 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_UI2:
				{
					*V_UI2REF(com) = V_UI2(java);
					break;
				}

				case VT_UI2 | VT_BYREF:
				{
					*V_UI2REF(com) = *V_UI2REF(java);
					break;
				}
			}
			break;
		}

				case VT_UI4:
		{
			switch (java->vt)
			{
				case VT_UI4:
				{
					V_UI4(com) = V_UI4(java);
					break;
				}

				case VT_UI4 | VT_BYREF:
				{
					V_UI4(com) = *V_UI4REF(java);
					break;
				}
			}
			break;
		}

		case VT_UI4 | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_UI4:
				{
					*V_UI4REF(com) = V_UI4(java);
					break;
				}

				case VT_UI4 | VT_BYREF:
				{
					*V_UI4REF(com) = *V_UI4REF(java);
					break;
				}
			}
			break;
		}

				case VT_INT:
		{
			switch (java->vt)
			{
				case VT_INT:
				{
					V_INT(com) = V_INT(java);
					break;
				}

				case VT_INT | VT_BYREF:
				{
					V_INT(com) = *V_INTREF(java);
					break;
				}
			}
			break;
		}

		case VT_INT | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_INT:
				{
					*V_INTREF(com) = V_INT(java);
					break;
				}

				case VT_INT | VT_BYREF:
				{
					*V_INTREF(com) = *V_INTREF(java);
					break;
				}
			}
			break;
		}

				case VT_UINT:
		{
			switch (java->vt)
			{
				case VT_UINT:
				{
					V_UINT(com) = V_UINT(java);
					break;
				}

				case VT_UINT | VT_BYREF:
				{
					V_UINT(com) = *V_UINTREF(java);
					break;
				}
			}
			break;
		}

		case VT_UINT | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_UINT:
				{
					*V_UINTREF(com) = V_UINT(java);
					break;
				}

				case VT_UINT | VT_BYREF:
				{
					*V_UINTREF(com) = *V_UINTREF(java);
					break;
				}
			}
			break;
		}

				case VT_CY:
		{
			switch (java->vt)
			{
				case VT_CY:
				{
					V_CY(com) = V_CY(java);
					break;
				}

				case VT_CY | VT_BYREF:
				{
					V_CY(com) = *V_CYREF(java);
					break;
				}
			}
			break;
		}

		case VT_CY | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_CY:
				{
					*V_CYREF(com) = V_CY(java);
					break;
				}

				case VT_CY | VT_BYREF:
				{
					*V_CYREF(com) = *V_CYREF(java);
					break;
				}
			}
			break;
		}

				case VT_DATE:
		{
			switch (java->vt)
			{
				case VT_DATE:
				{
					V_DATE(com) = V_DATE(java);
					break;
				}

				case VT_DATE | VT_BYREF:
				{
					V_DATE(com) = *V_DATEREF(java);
					break;
				}
			}
			break;
		}

		case VT_DATE | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_DATE:
				{
					*V_DATEREF(com) = V_DATE(java);
					break;
				}

				case VT_DATE | VT_BYREF:
				{
					*V_DATEREF(com) = *V_DATEREF(java);
					break;
				}
			}
			break;
		}

				case VT_BSTR:
		{
			switch (java->vt)
			{
				case VT_BSTR:
				{
					V_BSTR(com) = V_BSTR(java);
					break;
				}

				case VT_BSTR | VT_BYREF:
				{
					V_BSTR(com) = *V_BSTRREF(java);
					break;
				}
			}
			break;
		}

		case VT_BSTR | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_BSTR:
				{
					*V_BSTRREF(com) = V_BSTR(java);
					break;
				}

				case VT_BSTR | VT_BYREF:
				{
					*V_BSTRREF(com) = *V_BSTRREF(java);
					break;
				}
			}
			break;
		}

				case VT_DECIMAL:
		{
			switch (java->vt)
			{
				case VT_DECIMAL:
				{
					V_DECIMAL(com) = V_DECIMAL(java);
					break;
				}

				case VT_DECIMAL | VT_BYREF:
				{
					V_DECIMAL(com) = *V_DECIMALREF(java);
					break;
				}
			}
			break;
		}

		case VT_DECIMAL | VT_BYREF:
		{
			switch (java->vt)
			{
				case VT_DECIMAL:
				{
					*V_DECIMALREF(com) = V_DECIMAL(java);
					break;
				}

				case VT_DECIMAL | VT_BYREF:
				{
					*V_DECIMALREF(com) = *V_DECIMALREF(java);
					break;
				}
			}
			break;
		}


    }
}
////////////////////////////////////////////////////////
// CompareVariant
//
////////////////////////////////////////////////////////
LONG CompareVariant
(
	VARIANT *pVar1,	//@parm [in]: Pointer to the variant in the consumer's buffer.
	VARIANT *pVar2,	//@parm [in]: Pointer to the variant at the backend.
	BOOL fCaseSensitive
)
{
	//Handle NULL cases...
	if(pVar1==NULL || pVar2==NULL)
	{
		if(pVar1 == pVar2)
			return TRUE;
		return FALSE;
	}

	// The variant has to be the same type
	if (V_VT(pVar1) != V_VT(pVar2))
		return FALSE;
	
	// Return FALSE if vt is ORed with VT_RESERVED
	if (V_VT(pVar1) & VT_RESERVED)
		return FALSE;

	// Return TRUE is the vt is VT_EMPTY or VT_NULL
	if (V_VT(pVar1)==VT_EMPTY || V_VT(pVar1)==VT_NULL)
		return TRUE;

	switch(V_VT(pVar1))
	{	
		case VT_UI1:
			return V_UI1(pVar1) == V_UI1(pVar2);
		
		case VT_I2:
			return V_I2(pVar1) == V_I2(pVar2);

		case VT_I4:
			return V_I4(pVar1) == V_I4(pVar2);

		case VT_R4:
			return V_R4(pVar1) == V_R4(pVar2);

		case VT_R8:
			return V_R8(pVar1) == V_R8(pVar2);

		case VT_BOOL:
			return V_BOOL(pVar1) == V_BOOL(pVar2);

		case VT_ERROR:
			return V_ERROR(pVar1) == V_ERROR(pVar2);

		case VT_CY:
			return memcmp(&V_CY(pVar1), &V_CY(pVar2),8)==0;

		case VT_DATE:
			return V_DATE(pVar1) == V_DATE(pVar2);

		case VT_BSTR:
			if(fCaseSensitive)
				return wcscmp(V_BSTR(pVar1), V_BSTR(pVar2));
			else
				return _wcsicmp(V_BSTR(pVar1), V_BSTR(pVar2));

		// As we are not testing OLE object, return FALSE for VT_UNKNOWN
		case VT_UNKNOWN:
			return FALSE;

		// As we are not testing OLE object, return FALSE for VT_DISPATCH
		case VT_DISPATCH:
			return FALSE;

		case VT_I2 | VT_BYREF:
			return *V_I2REF(pVar1) == *V_I2REF(pVar2);

		case VT_I4 | VT_BYREF:
			return *V_I4REF(pVar1) == *V_I4REF(pVar2);

		case VT_R4 | VT_BYREF:
			return *V_R4REF(pVar1) == *V_R4REF(pVar2);

		case VT_R8 | VT_BYREF:
			return *V_R8REF(pVar1) == *V_R8REF(pVar2);

		case VT_BOOL | VT_BYREF:
			return *V_BOOLREF(pVar1) == *V_BOOLREF(pVar2);

		case VT_ERROR | VT_BYREF:
			return *V_ERRORREF(pVar1) == *V_ERRORREF(pVar2);

		case VT_CY | VT_BYREF:
			return memcmp(V_CYREF(pVar1), V_CYREF(pVar2),8)==0;

		case VT_DATE | VT_BYREF:
			return *V_DATEREF(pVar1) == *V_DATEREF(pVar2);

		case VT_BSTR | VT_BYREF:
			if(fCaseSensitive)
				return wcscmp(*V_BSTRREF(pVar1), *V_BSTRREF(pVar2));
			else
				return _wcsicmp(*V_BSTRREF(pVar1), *V_BSTRREF(pVar2));

		// As we are not testing OLE object, return FALSE for VT_UNKNOWN
		case VT_UNKNOWN | VT_BYREF:
			return FALSE;

		// As we are not testing OLE object, return FALSE for VT_DISPATCH
		case VT_DISPATCH | VT_BYREF:
			return FALSE;
	}

	return FALSE;
}
示例#10
0
PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar)
{
	int ret = SUCCESS;

	switch (V_VT(dstvar) & ~VT_BYREF) {
	case VT_EMPTY:
	case VT_NULL:
	case VT_VOID:
		/* should not be possible */
		break;

	case VT_UI1:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_UI1REF(dstvar) = V_UI1(srcvar);
		} else {
			 V_UI1(dstvar) = V_UI1(srcvar);
		}
		break;

	case VT_I1:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_I1REF(dstvar) = V_I1(srcvar);
		} else {
			V_I1(dstvar) = V_I1(srcvar);
		}
		break;

	case VT_UI2:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_UI2REF(dstvar) = V_UI2(srcvar);
		} else {
			V_UI2(dstvar) = V_UI2(srcvar);
		}
		break;

	case VT_I2:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_I2REF(dstvar) = V_I2(srcvar);
		} else {
			V_I2(dstvar) = V_I2(srcvar);
		}
		break;

	case VT_UI4:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_UI4REF(dstvar) = V_UI4(srcvar);
		} else {
			V_UI4(dstvar) = V_UI4(srcvar);
		}
		break;

	case VT_I4:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_I4REF(dstvar) = V_I4(srcvar);
		} else {
			V_I4(dstvar) = V_I4(srcvar);
		}
		break;
#if SIZEOF_ZEND_LONG == 8
	case VT_UI8:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_UI8REF(dstvar) = V_UI8(srcvar);
		} else {
			V_UI8(dstvar) = V_UI8(srcvar);
		}
		break;

	case VT_I8:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_I8REF(dstvar) = V_I8(srcvar);
		} else {
			V_I8(dstvar) = V_I8(srcvar);
		}
		break;
#endif
	case VT_INT:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_INTREF(dstvar) = V_INT(srcvar);
		} else {
			V_INT(dstvar) = V_INT(srcvar);
		}
		break;

	case VT_UINT:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_UINTREF(dstvar) = V_UINT(srcvar);
		} else {
			V_UINT(dstvar) = V_UINT(srcvar);
		}
		break;

	case VT_R4:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_R4REF(dstvar) = V_R4(srcvar);
		} else {
			V_R4(dstvar) = V_R4(srcvar);
		}
		break;

	case VT_R8:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_R8REF(dstvar) = V_R8(srcvar);
		} else {
			V_R8(dstvar) = V_R8(srcvar);
		}
		break;

	case VT_BOOL:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_BOOLREF(dstvar) = V_BOOL(srcvar);
		} else {
			V_BOOL(dstvar) = V_BOOL(srcvar);
		}
        break;

	case VT_BSTR:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_BSTRREF(dstvar) = V_BSTR(srcvar);
		} else {
			V_BSTR(dstvar) = V_BSTR(srcvar);
        }
		break;

	case VT_UNKNOWN:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_UNKNOWNREF(dstvar) = V_UNKNOWN(srcvar);
		} else {
			V_UNKNOWN(dstvar) = V_UNKNOWN(srcvar);
		}
		break;

	case VT_DISPATCH:
		if (V_VT(dstvar) & VT_BYREF) {
			*V_DISPATCHREF(dstvar) = V_DISPATCH(srcvar);
		} else {
			V_DISPATCH(dstvar) = V_DISPATCH(srcvar);
		}
		break;

	case VT_VARIANT:
		return php_com_copy_variant(V_VARIANTREF(dstvar), srcvar);

	default:
		php_error_docref(NULL, E_WARNING, "variant->variant: failed to copy from 0x%x to 0x%x", V_VT(dstvar), V_VT(srcvar));
		ret = FAILURE;
	}
	return ret;
}