diff options
author | Dmitry Stogov <dmitry@zend.com> | 2016-06-21 16:00:37 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2016-06-21 16:00:37 +0300 |
commit | 16160386982a86e6ec7969c6c89707d38228f19e (patch) | |
tree | 47052539a23ab7d6d2cf79392dd1e47de67bb2f1 /ext/sockets | |
parent | 67e23f4be3c01a389043ee97b98d6bcc703d3557 (diff) | |
download | php-git-16160386982a86e6ec7969c6c89707d38228f19e.tar.gz |
Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
Diffstat (limited to 'ext/sockets')
-rw-r--r-- | ext/sockets/conversions.c | 12 | ||||
-rw-r--r-- | ext/sockets/multicast.c | 2 | ||||
-rw-r--r-- | ext/sockets/sendrecvmsg.c | 6 | ||||
-rw-r--r-- | ext/sockets/sockets.c | 8 |
4 files changed, 14 insertions, 14 deletions
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index f2621f65d0..892442a88f 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -656,7 +656,7 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_ } if (ZSTR_LEN(path_str) >= sizeof(saddr->sun_path)) { do_from_zval_err(ctx, "the path is too long, the maximum permitted " - "length is %ld", sizeof(saddr->sun_path) - 1); + "length is %zd", sizeof(saddr->sun_path) - 1); return; } @@ -965,7 +965,7 @@ static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context } if (CMSG_LEN(entry->size) > cmsg->cmsg_len) { do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; " - "expected a length of at least %pd, but got %pd", + "expected a length of at least " ZEND_LONG_FMT ", but got " ZEND_LONG_FMT, (zend_long)CMSG_LEN(entry->size), (zend_long)cmsg->cmsg_len); return; } @@ -1062,8 +1062,8 @@ static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c, } if (lval < 0 || lval > MAX_USER_BUFF_SIZE) { - do_from_zval_err(ctx, "the buffer size must be between 1 and %pd; " - "given %pd", (zend_long)MAX_USER_BUFF_SIZE, lval); + do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; " + "given " ZEND_LONG_FMT, (zend_long)MAX_USER_BUFF_SIZE, lval); return; } @@ -1238,7 +1238,7 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context if (Z_TYPE_P(zv) == IS_LONG) { if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */ do_from_zval_err(ctx, "the interface index cannot be negative or " - "larger than %u; given %pd", UINT_MAX, Z_LVAL_P(zv)); + "larger than %u; given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(zv)); } else { ret = (unsigned)Z_LVAL_P(zv); } @@ -1400,7 +1400,7 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx) if (*cmsg_len < data_offset) { do_to_zval_err(ctx, "length of cmsg is smaller than its data member " - "offset (%pd vs %pd)", (zend_long)*cmsg_len, (zend_long)data_offset); + "offset (" ZEND_LONG_FMT " vs " ZEND_LONG_FMT ")", (zend_long)*cmsg_len, (zend_long)data_offset); return; } num_elems = (*cmsg_len - data_offset) / sizeof(int); diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index 6d37bfb1dd..75984ec323 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -93,7 +93,7 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out) if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) { php_error_docref(NULL, E_WARNING, "the interface index cannot be negative or larger than %u;" - " given %pd", UINT_MAX, Z_LVAL_P(val)); + " given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(val)); ret = FAILURE; } else { *out = Z_LVAL_P(val); diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index 7471ad143a..72d8cfc47e 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -71,7 +71,7 @@ inline ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags) #define LONG_CHECK_VALID_INT(l) \ do { \ if ((l) < INT_MIN && (l) > INT_MAX) { \ - php_error_docref0(NULL, E_WARNING, "The value %pd does not fit inside " \ + php_error_docref0(NULL, E_WARNING, "The value " ZEND_LONG_FMT " does not fit inside " \ "the boundaries of a native integer", (l)); \ return; \ } \ @@ -299,7 +299,7 @@ PHP_FUNCTION(socket_cmsg_space) entry = get_ancillary_reg_entry(level, type); if (entry == NULL) { - php_error_docref0(NULL, E_WARNING, "The pair level %pd/type %pd is " + php_error_docref0(NULL, E_WARNING, "The pair level " ZEND_LONG_FMT "/type " ZEND_LONG_FMT " is " "not supported by PHP", level, type); return; } @@ -308,7 +308,7 @@ PHP_FUNCTION(socket_cmsg_space) (zend_long)CMSG_SPACE(0) - 15L) / entry->var_el_size) { /* the -15 is to account for any padding CMSG_SPACE may add after the data */ php_error_docref0(NULL, E_WARNING, "The value for the " - "third argument (%pd) is too large", n); + "third argument (" ZEND_LONG_FMT ") is too large", n); return; } diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 63674c50d7..c289b0f9a3 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -1377,12 +1377,12 @@ PHP_FUNCTION(socket_create) && arg1 != AF_INET6 #endif && arg1 != AF_INET) { - php_error_docref(NULL, E_WARNING, "invalid socket domain [%pd] specified for argument 1, assuming AF_INET", arg1); + php_error_docref(NULL, E_WARNING, "invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", arg1); arg1 = AF_INET; } if (arg2 > 10) { - php_error_docref(NULL, E_WARNING, "invalid socket type [%pd] specified for argument 2, assuming SOCK_STREAM", arg2); + php_error_docref(NULL, E_WARNING, "invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", arg2); arg2 = SOCK_STREAM; } @@ -2153,12 +2153,12 @@ PHP_FUNCTION(socket_create_pair) && domain != AF_INET6 #endif && domain != AF_UNIX) { - php_error_docref(NULL, E_WARNING, "invalid socket domain [%pd] specified for argument 1, assuming AF_INET", domain); + php_error_docref(NULL, E_WARNING, "invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", domain); domain = AF_INET; } if (type > 10) { - php_error_docref(NULL, E_WARNING, "invalid socket type [%pd] specified for argument 2, assuming SOCK_STREAM", type); + php_error_docref(NULL, E_WARNING, "invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", type); type = SOCK_STREAM; } |