Specify function pointer signature for scanf implementation

Fix [-Wstrict-prototypes] warnings in standard/scanf.c
This commit is contained in:
George Peter Banyard 2021-05-12 14:41:11 +01:00
parent e90180d06a
commit b7356692f6
No known key found for this signature in database
GPG key ID: D49A095D7329F6DC

View file

@ -106,6 +106,8 @@ typedef struct CharSet {
} *ranges; } *ranges;
} CharSet; } CharSet;
typedef zend_long (*int_string_formater)(const char*, char**, int);
/* /*
* Declarations for functions used only in this file. * Declarations for functions used only in this file.
*/ */
@ -583,7 +585,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
int base = 0; int base = 0;
int underflow = 0; int underflow = 0;
size_t width; size_t width;
zend_long (*fn)() = NULL; int_string_formater fn = NULL;
char *ch, sch; char *ch, sch;
int flags; int flags;
char buf[64]; /* Temporary buffer to hold scanned number char buf[64]; /* Temporary buffer to hold scanned number
@ -740,29 +742,29 @@ literal:
case 'D': case 'D':
op = 'i'; op = 'i';
base = 10; base = 10;
fn = (zend_long (*)())ZEND_STRTOL_PTR; fn = (int_string_formater)ZEND_STRTOL_PTR;
break; break;
case 'i': case 'i':
op = 'i'; op = 'i';
base = 0; base = 0;
fn = (zend_long (*)())ZEND_STRTOL_PTR; fn = (int_string_formater)ZEND_STRTOL_PTR;
break; break;
case 'o': case 'o':
op = 'i'; op = 'i';
base = 8; base = 8;
fn = (zend_long (*)())ZEND_STRTOL_PTR; fn = (int_string_formater)ZEND_STRTOL_PTR;
break; break;
case 'x': case 'x':
case 'X': case 'X':
op = 'i'; op = 'i';
base = 16; base = 16;
fn = (zend_long (*)())ZEND_STRTOL_PTR; fn = (int_string_formater)ZEND_STRTOL_PTR;
break; break;
case 'u': case 'u':
op = 'i'; op = 'i';
base = 10; base = 10;
flags |= SCAN_UNSIGNED; flags |= SCAN_UNSIGNED;
fn = (zend_long (*)())ZEND_STRTOUL_PTR; fn = (int_string_formater)ZEND_STRTOUL_PTR;
break; break;
case 'f': case 'f':