Browse Source

Use sprintf everywhere and define sprintf to php_sprintf, if sprintf is broken.

PHP-4.0.5
Sascha Schumann 27 years ago
parent
commit
bb09ee9505
  1. 2
      ext/odbc/php_odbc.c
  2. 2
      ext/standard/math.c
  3. 2
      main/php.h
  4. 3
      main/snprintf.h
  5. 2
      sapi/cgi/cgi_main.c

2
ext/odbc/php_odbc.c

@ -1725,7 +1725,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
RETURN_FALSE;
}
hashed_len = php_sprintf(hashed_details, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt);
hashed_len = sprintf(hashed_details, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt);
/* FIXME the idea of checking to see if our connection is already persistent
is good, but it adds a lot of overhead to non-persistent connections. We

2
ext/standard/math.c

@ -613,7 +613,7 @@ char *_php_math_number_format(double d,int dec,char dec_point,char thousand_sep)
dec = MAX(0,dec);
tmpbuf = (char *) emalloc(32+dec);
tmplen=php_sprintf(tmpbuf,"%.*f",dec,d);
tmplen=sprintf(tmpbuf,"%.*f",dec,d);
if (!isdigit((int)tmpbuf[0])) {
return tmpbuf;

2
main/php.h

@ -188,7 +188,7 @@ extern char *strerror(int);
#define LONG_MIN (- LONG_MAX - 1)
#endif
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) || defined(BROKEN_SPRINTF)
#include "snprintf.h"
#endif

3
main/snprintf.h

@ -31,8 +31,7 @@ extern int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
#if BROKEN_SPRINTF
int php_sprintf (char* s, const char* format, ...);
#else
#define php_sprintf sprintf
#define sprintf php_sprintf
#endif
#endif /* _PHP_SNPRINTF_H */

2
sapi/cgi/cgi_main.c

@ -146,7 +146,7 @@ static void sapi_cgi_register_variables(zval *track_vars_array ELS_DC SLS_DC PLS
pi = NULL;
}
val = emalloc(l + 1);
php_sprintf(val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */
sprintf(val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */
php_register_variable("PHP_SELF", val, track_vars_array ELS_CC PLS_CC);
efree(val);
}

Loading…
Cancel
Save