summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-02-27 03:28:17 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-02-27 03:28:17 +0000
commitefad70c2cc2edd8416a18ea6daf06f8627d1d68d (patch)
tree0a59c0e22bb3b224433600d86b8430276ed87b45 /ext
parentcc04404b28d10481f63be986fe815de1fe31088b (diff)
downloadphp-git-efad70c2cc2edd8416a18ea6daf06f8627d1d68d.tar.gz
snprintf() -> slprintf()
Diffstat (limited to 'ext')
-rw-r--r--ext/ftp/ftp.c4
-rw-r--r--ext/hash/hash.c2
-rw-r--r--ext/mbstring/oniguruma/regerror.c3
-rw-r--r--ext/mhash/mhash.c2
-rw-r--r--ext/pcre/pcrelib/pcregrep.c2
-rw-r--r--ext/pdo_firebird/firebird_driver.c2
-rw-r--r--ext/session/mod_mm.c2
-rw-r--r--ext/session/session.c2
-rwxr-xr-xext/spl/spl_directory.c2
-rwxr-xr-xext/spl/spl_iterators.c2
-rw-r--r--ext/standard/html.c2
-rw-r--r--ext/standard/http_fopen_wrapper.c4
-rw-r--r--ext/standard/string.c2
-rw-r--r--ext/wddx/wddx.c6
14 files changed, 20 insertions, 17 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index e98fbb20a8..666f23c582 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -1102,13 +1102,13 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE) {
return 0;
}
- size = snprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s %s\r\n", cmd, args);
+ size = slprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s %s\r\n", cmd, args);
} else {
/* "cmd\r\n\0" */
if (strlen(cmd) + 3 > FTP_BUFSIZE) {
return 0;
}
- size = snprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s\r\n", cmd);
+ size = slprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s\r\n", cmd);
}
data = ftp->outbuf;
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index bb719e295d..05a4518746 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -588,7 +588,7 @@ PHP_MINFO_FUNCTION(hash)
for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
(type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT;
zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
- s += snprintf(s, e - s, "%s ", str);
+ s += slprintf(s, e - s, "%s ", str);
}
*s = 0;
diff --git a/ext/mbstring/oniguruma/regerror.c b/ext/mbstring/oniguruma/regerror.c
index 0e0174d8a8..134cf25c6b 100644
--- a/ext/mbstring/oniguruma/regerror.c
+++ b/ext/mbstring/oniguruma/regerror.c
@@ -278,6 +278,9 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
va_init_list(args, fmt);
n = vsnprintf((char* )buf, bufsize, (const char* )fmt, args);
+ if (n >= bufsize) {
+ return;
+ }
va_end(args);
need = (pat_end - pat) * 4 + 4;
diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c
index 3387d44b15..f9c2af3230 100644
--- a/ext/mhash/mhash.c
+++ b/ext/mhash/mhash.c
@@ -70,7 +70,7 @@ PHP_MINIT_FUNCTION(mhash)
for (i=0; i<n; i++) {
if ((name = mhash_get_hash_name(i))) {
- l = snprintf(buf, 127, "MHASH_%s", name);
+ l = slprintf(buf, 127, "MHASH_%s", name);
zend_register_long_constant(buf, l + 1, i, CONST_PERSISTENT, module_number TSRMLS_CC);
free(name);
}
diff --git a/ext/pcre/pcrelib/pcregrep.c b/ext/pcre/pcrelib/pcregrep.c
index 4db73485d6..e5ceec3ace 100644
--- a/ext/pcre/pcrelib/pcregrep.c
+++ b/ext/pcre/pcrelib/pcregrep.c
@@ -1188,7 +1188,7 @@ if ((sep = isdirectory(pathname)) != 0)
while ((nextfile = readdirectory(dir)) != NULL)
{
int frc, blen;
- blen = snprintf(buffer, sizeof(buffer), "%.512s%c%.128s", pathname, sep, nextfile);
+ blen = slprintf(buffer, sizeof(buffer), "%.512s%c%.128s", pathname, sep, nextfile);
if (exclude_compiled != NULL &&
pcre_exec(exclude_compiled, NULL, buffer, blen, 0, 0, NULL, 0) >= 0)
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index 7e65a880a7..6a6bc09696 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -619,7 +619,7 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRM
/* loop through all the provided arguments and set dpb fields accordingly */
for (i = 0; i < sizeof(dpb_flags); ++i) {
if (dpb_values[i] && buf_len > 0) {
- dpb_len = snprintf(dpb, buf_len, "%c%c%s", dpb_flags[i], (unsigned char)strlen(dpb_values[i]),
+ dpb_len = slprintf(dpb, buf_len, "%c%c%s", dpb_flags[i], (unsigned char)strlen(dpb_values[i]),
dpb_values[i]);
dpb += dpb_len;
buf_len -= dpb_len;
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 80fab9d690..17bb0589ec 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -262,7 +262,7 @@ PHP_MINIT_FUNCTION(ps_mm)
return FAILURE;
}
- if (!(euid_len = snprintf(euid, sizeof(euid), "%d", geteuid()))) {
+ if (!(euid_len = slprintf(euid, sizeof(euid), "%d", geteuid()))) {
return FAILURE;
}
diff --git a/ext/session/session.c b/ext/session/session.c
index 50dd3a5297..2b20dde0aa 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -950,7 +950,7 @@ static void strcpy_gmt(char *ubuf, time_t *when)
php_gmtime_r(when, &tm);
- n = snprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
+ n = slprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
week_days[tm.tm_wday], tm.tm_mday,
month_names[tm.tm_mon], tm.tm_year + 1900,
tm.tm_hour, tm.tm_min,
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 4847f65edb..5b69ac9792 100755
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1642,7 +1642,7 @@ SPL_METHOD(SplTempFileObject, __construct)
intern->file_name = "php://memory";
intern->file_name_len = 12;
} else if (ZEND_NUM_ARGS()) {
- intern->file_name_len = snprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%ld", max_memory);
+ intern->file_name_len = slprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%ld", max_memory);
intern->file_name = tmp_fname;
} else {
intern->file_name = "php://temp";
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index c93ded1762..471b24f433 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1390,7 +1390,7 @@ SPL_METHOD(RegexIterator, accept)
if (intern->u.regex.flags & REGIT_USE_KEY) {
if (intern->current.key_type == HASH_KEY_IS_LONG) {
- subject_len = snprintf(tmp, sizeof(tmp), "%ld", intern->current.int_key);
+ subject_len = slprintf(tmp, sizeof(tmp), "%ld", intern->current.int_key);
subject = &tmp[0];
use_copy = 0;
} else {
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 30539cdf6f..e2badee474 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -912,7 +912,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
if (entity_map[j].table[k - entity_map[j].basechar] == NULL)
continue;
- entity_length = snprintf(entity, sizeof(entity), "&%s;", entity_map[j].table[k - entity_map[j].basechar]);
+ entity_length = slprintf(entity, sizeof(entity), "&%s;", entity_map[j].table[k - entity_map[j].basechar]);
if (entity_length >= sizeof(entity)) {
continue;
}
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index c43aced2cb..5ca17c9ed7 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -438,7 +438,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
/* ensure the header is only sent if user_agent is not blank */
if (ua_len > sizeof(_UA_HEADER)) {
ua = emalloc(ua_len + 1);
- if ((ua_len = snprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) {
+ if ((ua_len = slprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) {
ua[ua_len] = 0;
php_stream_write(stream, ua, ua_len);
} else {
@@ -456,7 +456,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS &&
Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) {
if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) {
- scratch_len = snprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval));
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval));
php_stream_write(stream, scratch, scratch_len);
}
if (!(have_header & HTTP_HEADER_TYPE)) {
diff --git a/ext/standard/string.c b/ext/standard/string.c
index c65da88087..854c3ec174 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -905,7 +905,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
case IS_LONG: {
char stmp[MAX_LENGTH_OF_LONG + 1];
- str_len = snprintf(stmp, sizeof(stmp), "%ld", Z_LVAL_PP(tmp));
+ str_len = slprintf(stmp, sizeof(stmp), "%ld", Z_LVAL_PP(tmp));
smart_str_appendl(&implstr, stmp, str_len);
}
break;
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 6bdbb05ed3..a250e20e36 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -284,7 +284,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
switch (hash_type) {
case HASH_KEY_IS_LONG:
- key_length = snprintf(tmp, sizeof(tmp), "%ld", idx) + 1;
+ key_length = slprintf(tmp, sizeof(tmp), "%ld", idx) + 1;
key = tmp;
/* fallthru */
case HASH_KEY_IS_STRING:
@@ -501,7 +501,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
php_wddx_serialize_var(packet, *ent, prop_name, strlen(prop_name)+1 TSRMLS_CC);
} else {
- key_len = snprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
+ key_len = slprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
}
}
@@ -572,7 +572,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
if (ent_type == HASH_KEY_IS_STRING) {
php_wddx_serialize_var(packet, *ent, key, key_len TSRMLS_CC);
} else {
- key_len = snprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
+ key_len = slprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
}
} else