@@ -274,7 +274,7 @@ PHP_FUNCTION(pack)
274274 }
275275
276276 /* Handle special arg '*' for all codes and check argv overflows */
277- switch (( int ) code ) {
277+ switch (code ) {
278278 /* Never uses any args */
279279 case 'x' :
280280 case 'X' :
@@ -380,10 +380,10 @@ PHP_FUNCTION(pack)
380380
381381 /* Calculate output length and upper bound while processing*/
382382 for (i = 0 ; i < formatcount ; i ++ ) {
383- int code = ( int ) formatcodes [i ];
383+ char code = formatcodes [i ];
384384 int arg = formatargs [i ];
385385
386- switch (( int ) code ) {
386+ switch (code ) {
387387 case 'h' :
388388 case 'H' :
389389 INC_OUTPUTPOS ((arg + (arg % 2 )) / 2 ,1 ) /* 4 bit per arg */
@@ -463,10 +463,10 @@ PHP_FUNCTION(pack)
463463
464464 /* Do actual packing */
465465 for (i = 0 ; i < formatcount ; i ++ ) {
466- int code = ( int ) formatcodes [i ];
466+ char code = formatcodes [i ];
467467 int arg = formatargs [i ];
468468
469- switch (( int ) code ) {
469+ switch (code ) {
470470 case 'a' :
471471 case 'A' :
472472 case 'Z' : {
@@ -632,7 +632,7 @@ PHP_FUNCTION(pack)
632632
633633 case 'd' : {
634634 while (arg -- > 0 ) {
635- double v = ( double ) zval_get_double (& argv [currentarg ++ ]);
635+ double v = zval_get_double (& argv [currentarg ++ ]);
636636 memcpy (& ZSTR_VAL (output )[outputpos ], & v , sizeof (v ));
637637 outputpos += sizeof (v );
638638 }
@@ -642,7 +642,7 @@ PHP_FUNCTION(pack)
642642 case 'e' : {
643643 /* pack little endian double */
644644 while (arg -- > 0 ) {
645- double v = ( double ) zval_get_double (& argv [currentarg ++ ]);
645+ double v = zval_get_double (& argv [currentarg ++ ]);
646646 php_pack_copy_double (1 , & ZSTR_VAL (output )[outputpos ], v );
647647 outputpos += sizeof (v );
648648 }
@@ -652,7 +652,7 @@ PHP_FUNCTION(pack)
652652 case 'E' : {
653653 /* pack big endian double */
654654 while (arg -- > 0 ) {
655- double v = ( double ) zval_get_double (& argv [currentarg ++ ]);
655+ double v = zval_get_double (& argv [currentarg ++ ]);
656656 php_pack_copy_double (0 , & ZSTR_VAL (output )[outputpos ], v );
657657 outputpos += sizeof (v );
658658 }
@@ -784,7 +784,7 @@ PHP_FUNCTION(unpack)
784784 if (namelen > 200 )
785785 namelen = 200 ;
786786
787- switch (( int ) type ) {
787+ switch (type ) {
788788 /* Never use any input */
789789 case 'X' :
790790 size = -1 ;
@@ -902,7 +902,7 @@ PHP_FUNCTION(unpack)
902902 real_name = zend_string_concat2 (name , namelen , res , digits );
903903 }
904904
905- switch (( int ) type ) {
905+ switch (type ) {
906906 case 'a' : {
907907 /* a will not strip any trailing whitespace or null padding */
908908 zend_long len = inputlen - inputpos ; /* Remaining string */
0 commit comments