Skip to content

Commit 039500a

Browse files
committed
Fix handling and extend ext/ffi/tests/044.phpt
1 parent 3207741 commit 039500a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

ext/ffi/ffi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5004,12 +5004,18 @@ static void zend_ffi_finalize_type(zend_ffi_dcl *dcl) /* {{{ */
50045004
dcl->type = (zend_ffi_type*)&zend_ffi_type_uint64;
50055005
}
50065006
break;
5007+
#ifdef _WIN32
5008+
case ZEND_FFI_DCL_LONG_LONG:
5009+
#endif
50075010
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG:
50085011
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_SIGNED:
50095012
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_INT:
50105013
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_SIGNED|ZEND_FFI_DCL_INT:
50115014
dcl->type = (zend_ffi_type*)&zend_ffi_type_sint64;
50125015
break;
5016+
#ifdef _WIN32
5017+
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_UNSIGNED:
5018+
#endif
50135019
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_UNSIGNED:
50145020
case ZEND_FFI_DCL_LONG_LONG|ZEND_FFI_DCL_LONG|ZEND_FFI_DCL_UNSIGNED|ZEND_FFI_DCL_INT:
50155021
dcl->type = (zend_ffi_type*)&zend_ffi_type_uint64;

ext/ffi/tests/044.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,35 @@ ffi.enable=1
88
<?php
99
$ffi = FFI::cdef("
1010
typedef int a __attribute__ ((__mode__ (__QI__)));
11+
typedef unsigned int ua __attribute__ ((__mode__ (__QI__)));
1112
typedef int b __attribute__ ((__mode__ (__HI__)));
13+
typedef unsigned int ub __attribute__ ((__mode__ (__HI__)));
1214
typedef int c __attribute__ ((__mode__ (__SI__)));
15+
typedef unsigned int uc __attribute__ ((__mode__ (__SI__)));
1316
typedef int d __attribute__ ((__mode__ (__DI__)));
17+
typedef unsigned int ud __attribute__ ((__mode__ (__DI__)));
1418
typedef float e __attribute__ ((__mode__ (__SF__)));
1519
typedef float f __attribute__ ((__mode__ (__DF__)));
1620
");
1721
var_dump(FFI::sizeof($ffi->new("a")));
22+
var_dump(FFI::sizeof($ffi->new("ua")));
1823
var_dump(FFI::sizeof($ffi->new("b")));
24+
var_dump(FFI::sizeof($ffi->new("ub")));
1925
var_dump(FFI::sizeof($ffi->new("c")));
26+
var_dump(FFI::sizeof($ffi->new("uc")));
2027
var_dump(FFI::sizeof($ffi->new("d")));
28+
var_dump(FFI::sizeof($ffi->new("ud")));
2129
var_dump(FFI::sizeof($ffi->new("e")));
2230
var_dump(FFI::sizeof($ffi->new("f")));
2331
?>
2432
--EXPECT--
2533
int(1)
34+
int(1)
35+
int(2)
2636
int(2)
2737
int(4)
38+
int(4)
39+
int(8)
2840
int(8)
2941
int(4)
3042
int(8)

0 commit comments

Comments
 (0)