summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2019-03-30 12:53:32 +0100
committerAnatol Belski <ab@php.net>2019-03-30 12:53:32 +0100
commit039500adb615ceddfcf53e375bfb5e4d2c7c31d5 (patch)
tree97b2bd03968ff19ca386b4bd8fb57db46151505a
parent3207741df0ac71dc78f8b8c54c4b3a44553208f0 (diff)
downloadphp-git-039500adb615ceddfcf53e375bfb5e4d2c7c31d5.tar.gz
Fix handling and extend ext/ffi/tests/044.phpt
-rw-r--r--ext/ffi/ffi.c6
-rw-r--r--ext/ffi/tests/044.phpt12
2 files changed, 18 insertions, 0 deletions
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index f062170f42..e124995c50 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -5004,12 +5004,18 @@ static void zend_ffi_finalize_type(zend_ffi_dcl *dcl) /* {{{ */
dcl->type = (zend_ffi_type*)&zend_ffi_type_uint64;
}
break;
+#ifdef _WIN32
+ case ZEND_FFI_DCL_LONG_LONG:
+#endif
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG:
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_SIGNED:
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_INT:
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_INT:
dcl->type = (zend_ffi_type*)&zend_ffi_type_sint64;
break;
+#ifdef _WIN32
+ case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_UNSIGNED:
+#endif
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_UNSIGNED:
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_UNSIGNED|ZEND_FFI_DCL_INT:
dcl->type = (zend_ffi_type*)&zend_ffi_type_uint64;
diff --git a/ext/ffi/tests/044.phpt b/ext/ffi/tests/044.phpt
index ab07e23e1b..f0d08ecd40 100644
--- a/ext/ffi/tests/044.phpt
+++ b/ext/ffi/tests/044.phpt
@@ -8,23 +8,35 @@ ffi.enable=1
<?php
$ffi = FFI::cdef("
typedef int a __attribute__ ((__mode__ (__QI__)));
+typedef unsigned int ua __attribute__ ((__mode__ (__QI__)));
typedef int b __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int ub __attribute__ ((__mode__ (__HI__)));
typedef int c __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int uc __attribute__ ((__mode__ (__SI__)));
typedef int d __attribute__ ((__mode__ (__DI__)));
+typedef unsigned int ud __attribute__ ((__mode__ (__DI__)));
typedef float e __attribute__ ((__mode__ (__SF__)));
typedef float f __attribute__ ((__mode__ (__DF__)));
");
var_dump(FFI::sizeof($ffi->new("a")));
+var_dump(FFI::sizeof($ffi->new("ua")));
var_dump(FFI::sizeof($ffi->new("b")));
+var_dump(FFI::sizeof($ffi->new("ub")));
var_dump(FFI::sizeof($ffi->new("c")));
+var_dump(FFI::sizeof($ffi->new("uc")));
var_dump(FFI::sizeof($ffi->new("d")));
+var_dump(FFI::sizeof($ffi->new("ud")));
var_dump(FFI::sizeof($ffi->new("e")));
var_dump(FFI::sizeof($ffi->new("f")));
?>
--EXPECT--
int(1)
+int(1)
+int(2)
int(2)
int(4)
+int(4)
+int(8)
int(8)
int(4)
int(8)