com php-src: Fix handling and extend ext/ffi/tests/044.phpt: ext/ffi/ffi.c ext/ffi/tests/044.phpt
| From: | Anatol Belski | Date: | Sat, 30 Mar 2019 11:53:32 +0000 |
| Subject: | com php-src: Fix handling and extend ext/ffi/tests/044.phpt: ext/ffi/ffi.c ext/ffi/tests/044.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105410@lists.php.net to get a copy of this message | ||
Commit: 039500adb615ceddfcf53e375bfb5e4d2c7c31d5
Author: Anatol Belski <ab@php.net> Sat, 30 Mar 2019 12:53:32 +0100
Parents: 3207741df0ac71dc78f8b8c54c4b3a44553208f0
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=039500adb615ceddfcf53e375bfb5e4d2c7c31d5
Log:
Fix handling and extend ext/ffi/tests/044.phpt
Changed paths:
M ext/ffi/ffi.c
M ext/ffi/tests/044.phpt
Diff:
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index f062170..e124995 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 ab07e23..f0d08ec 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)