Skip to content

Commit

Permalink
several fixes to com_dotnet for x64
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Oct 28, 2014
1 parent 3b6a9a3 commit 26e7e54
Show file tree
Hide file tree
Showing 4 changed files with 670 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ext/com_dotnet/com_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ PHP_MINIT_FUNCTION(com_dotnet)
COM_ERR_CONST(DISP_E_BADINDEX);
COM_ERR_CONST(MK_E_UNAVAILABLE);

#if SIZEOF_ZEND_LONG == 8
COM_CONST(VT_UI8);
COM_CONST(VT_I8);
#endif
return SUCCESS;
}
/* }}} */
Expand Down
28 changes: 26 additions & 2 deletions ext/com_dotnet/com_variant.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,19 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
ZVAL_LONG(z, (zend_long)V_I2(v));
break;
case VT_UI4: /* TODO: promote to double if large? */
ZVAL_LONG(z, (zend_long)V_UI4(v));
ZVAL_LONG(z, (long)V_UI4(v));
break;
case VT_I4:
ZVAL_LONG(z, (zend_long)V_I4(v));
ZVAL_LONG(z, (long)V_I4(v));
break;
#if SIZEOF_ZEND_LONG == 8
case VT_UI8:
ZVAL_LONG(z, (zend_long)V_UI8(v));
break;
case VT_I8:
ZVAL_LONG(z, (zend_long)V_I8(v));
break;
#endif
case VT_INT:
ZVAL_LONG(z, V_INT(v));
break;
Expand Down Expand Up @@ -333,7 +341,23 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSR
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);
Expand Down
3 changes: 2 additions & 1 deletion ext/com_dotnet/tests/variants.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
COM: General variant tests
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
if (4 != PHP_INT_SIZE) print "skip x86 only"; ?>
--FILE--
<?php // $Id$
error_reporting(E_ALL);
Expand Down
Loading

0 comments on commit 26e7e54

Please sign in to comment.