From bb09ee9505023838079d427d47e7d0b0494d1b8c Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Sun, 12 Mar 2000 17:18:21 +0000 Subject: [PATCH] Use sprintf everywhere and define sprintf to php_sprintf, if sprintf is broken. --- ext/odbc/php_odbc.c | 2 +- ext/standard/math.c | 2 +- main/php.h | 2 +- main/snprintf.h | 3 +-- sapi/cgi/cgi_main.c | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index e9ee39a35e4..03e154b7c97 100644 --- a/ext/odbc/php_odbc.c +++ b/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 diff --git a/ext/standard/math.c b/ext/standard/math.c index 19b87e733c1..b5ecf38fd92 100644 --- a/ext/standard/math.c +++ b/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; diff --git a/main/php.h b/main/php.h index be87eb1a5ec..8cd8f02088b 100644 --- a/main/php.h +++ b/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 diff --git a/main/snprintf.h b/main/snprintf.h index 7392416f36b..2eb0eb20995 100644 --- a/main/snprintf.h +++ b/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 */ diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 6d7aa8eb7d0..09379d12baf 100644 --- a/sapi/cgi/cgi_main.c +++ b/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); }