@@ -274,7 +274,7 @@ PHP_FUNCTION(pack)
274
274
}
275
275
276
276
/* Handle special arg '*' for all codes and check argv overflows */
277
- switch (( int ) code ) {
277
+ switch (code ) {
278
278
/* Never uses any args */
279
279
case 'x' :
280
280
case 'X' :
@@ -380,10 +380,10 @@ PHP_FUNCTION(pack)
380
380
381
381
/* Calculate output length and upper bound while processing*/
382
382
for (i = 0 ; i < formatcount ; i ++ ) {
383
- int code = ( int ) formatcodes [i ];
383
+ char code = formatcodes [i ];
384
384
int arg = formatargs [i ];
385
385
386
- switch (( int ) code ) {
386
+ switch (code ) {
387
387
case 'h' :
388
388
case 'H' :
389
389
INC_OUTPUTPOS ((arg + (arg % 2 )) / 2 ,1 ) /* 4 bit per arg */
@@ -463,10 +463,10 @@ PHP_FUNCTION(pack)
463
463
464
464
/* Do actual packing */
465
465
for (i = 0 ; i < formatcount ; i ++ ) {
466
- int code = ( int ) formatcodes [i ];
466
+ char code = formatcodes [i ];
467
467
int arg = formatargs [i ];
468
468
469
- switch (( int ) code ) {
469
+ switch (code ) {
470
470
case 'a' :
471
471
case 'A' :
472
472
case 'Z' : {
@@ -632,7 +632,7 @@ PHP_FUNCTION(pack)
632
632
633
633
case 'd' : {
634
634
while (arg -- > 0 ) {
635
- double v = ( double ) zval_get_double (& argv [currentarg ++ ]);
635
+ double v = zval_get_double (& argv [currentarg ++ ]);
636
636
memcpy (& ZSTR_VAL (output )[outputpos ], & v , sizeof (v ));
637
637
outputpos += sizeof (v );
638
638
}
@@ -642,7 +642,7 @@ PHP_FUNCTION(pack)
642
642
case 'e' : {
643
643
/* pack little endian double */
644
644
while (arg -- > 0 ) {
645
- double v = ( double ) zval_get_double (& argv [currentarg ++ ]);
645
+ double v = zval_get_double (& argv [currentarg ++ ]);
646
646
php_pack_copy_double (1 , & ZSTR_VAL (output )[outputpos ], v );
647
647
outputpos += sizeof (v );
648
648
}
@@ -652,7 +652,7 @@ PHP_FUNCTION(pack)
652
652
case 'E' : {
653
653
/* pack big endian double */
654
654
while (arg -- > 0 ) {
655
- double v = ( double ) zval_get_double (& argv [currentarg ++ ]);
655
+ double v = zval_get_double (& argv [currentarg ++ ]);
656
656
php_pack_copy_double (0 , & ZSTR_VAL (output )[outputpos ], v );
657
657
outputpos += sizeof (v );
658
658
}
@@ -784,7 +784,7 @@ PHP_FUNCTION(unpack)
784
784
if (namelen > 200 )
785
785
namelen = 200 ;
786
786
787
- switch (( int ) type ) {
787
+ switch (type ) {
788
788
/* Never use any input */
789
789
case 'X' :
790
790
size = -1 ;
@@ -902,7 +902,7 @@ PHP_FUNCTION(unpack)
902
902
real_name = zend_string_concat2 (name , namelen , res , digits );
903
903
}
904
904
905
- switch (( int ) type ) {
905
+ switch (type ) {
906
906
case 'a' : {
907
907
/* a will not strip any trailing whitespace or null padding */
908
908
zend_long len = inputlen - inputpos ; /* Remaining string */
0 commit comments