's' works with size_t round 4

This commit is contained in:
Anatol Belski 2014-08-27 20:42:47 +02:00
parent 6db8d4f829
commit bf96ee95ce
11 changed files with 29 additions and 24 deletions

View file

@ -81,7 +81,7 @@ FILE_RCSID("@(#)$File: magic.c,v 1.81 2013/11/29 15:42:51 christos Exp $")
#endif #endif
private void close_and_restore(const struct magic_set *, const char *, int, private void close_and_restore(const struct magic_set *, const char *, int,
const struct stat *); const zend_stat_t *);
private int unreadable_info(struct magic_set *, mode_t, const char *); private int unreadable_info(struct magic_set *, mode_t, const char *);
#if 0 #if 0
private const char* get_default_magic(void); private const char* get_default_magic(void);
@ -286,7 +286,7 @@ magic_list(struct magic_set *ms, const char *magicfile)
private void private void
close_and_restore(const struct magic_set *ms, const char *name, int fd, close_and_restore(const struct magic_set *ms, const char *name, int fd,
const struct stat *sb) const zend_stat_t *sb)
{ {
if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) { if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {

View file

@ -173,7 +173,7 @@ static zend_object *spl_filesystem_object_new_check(zend_class_entry *class_type
} }
/* }}} */ /* }}} */
PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC) /* {{{ */ PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, size_t *len TSRMLS_DC) /* {{{ */
{ {
#ifdef HAVE_GLOB #ifdef HAVE_GLOB
if (intern->type == SPL_FS_DIR) { if (intern->type == SPL_FS_DIR) {
@ -490,7 +490,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
} else { } else {
intern->file_name = estrndup(source->file_name, source->file_name_len); intern->file_name = estrndup(source->file_name, source->file_name_len);
intern->file_name_len = source->file_name_len; intern->file_name_len = source->file_name_len;
intern->_path = spl_filesystem_object_get_path(source, &intern->_path_len TSRMLS_CC); intern->_path = spl_filesystem_object_get_path(source, (size_t *)&intern->_path_len TSRMLS_CC);
intern->_path = estrndup(intern->_path, intern->_path_len); intern->_path = estrndup(intern->_path, intern->_path_len);
} }
break; break;
@ -514,7 +514,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
} else { } else {
intern->file_name = source->file_name; intern->file_name = source->file_name;
intern->file_name_len = source->file_name_len; intern->file_name_len = source->file_name_len;
intern->_path = spl_filesystem_object_get_path(source, &intern->_path_len TSRMLS_CC); intern->_path = spl_filesystem_object_get_path(source, (size_t *)&intern->_path_len TSRMLS_CC);
intern->_path = estrndup(intern->_path, intern->_path_len); intern->_path = estrndup(intern->_path, intern->_path_len);
intern->u.file.open_mode = "r"; intern->u.file.open_mode = "r";
@ -554,7 +554,7 @@ static int spl_filesystem_is_invalid_or_dot(const char * d_name) /* {{{ */
} }
/* }}} */ /* }}} */
static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, int *len TSRMLS_DC) { /* {{{ */ static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, size_t *len TSRMLS_DC) { /* {{{ */
switch (intern->type) { switch (intern->type) {
case SPL_FS_INFO: case SPL_FS_INFO:
case SPL_FS_FILE: case SPL_FS_FILE:
@ -1384,7 +1384,7 @@ SPL_METHOD(SplFileInfo, getPathInfo)
zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC); zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &ce) == SUCCESS) {
int path_len; size_t path_len;
char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC); char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC);
if (path) { if (path) {
char *dpath = estrndup(path, path_len); char *dpath = estrndup(path, path_len);

View file

@ -3840,7 +3840,8 @@ PHP_FUNCTION(constant)
PHP_NAMED_FUNCTION(php_inet_ntop) PHP_NAMED_FUNCTION(php_inet_ntop)
{ {
char *address; char *address;
int address_len, af = AF_INET; size_t address_len;
int af = AF_INET;
char buffer[40]; char buffer[40];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) {
@ -3874,7 +3875,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
{ {
int ret, af = AF_INET; int ret, af = AF_INET;
char *address; char *address;
int address_len; size_t address_len;
char buffer[17]; char buffer[17];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &address, &address_len) == FAILURE) {
@ -3910,7 +3911,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
PHP_FUNCTION(ip2long) PHP_FUNCTION(ip2long)
{ {
char *addr; char *addr;
int addr_len; size_t addr_len;
#ifdef HAVE_INET_PTON #ifdef HAVE_INET_PTON
struct in_addr ip; struct in_addr ip;
#else #else
@ -3949,7 +3950,7 @@ PHP_FUNCTION(long2ip)
{ {
/* "It's a long but it's not, PHP ints are signed */ /* "It's a long but it's not, PHP ints are signed */
char *ip; char *ip;
int ip_len; size_t ip_len;
zend_ulong n; zend_ulong n;
struct in_addr myaddr; struct in_addr myaddr;
#ifdef HAVE_INET_PTON #ifdef HAVE_INET_PTON
@ -5493,7 +5494,7 @@ PHP_FUNCTION(ignore_user_abort)
PHP_FUNCTION(getservbyname) PHP_FUNCTION(getservbyname)
{ {
char *name, *proto; char *name, *proto;
int name_len, proto_len; size_t name_len, proto_len;
struct servent *serv; struct servent *serv;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &proto, &proto_len) == FAILURE) {

View file

@ -153,7 +153,7 @@ PHP_FUNCTION(gethostname)
PHP_FUNCTION(gethostbyaddr) PHP_FUNCTION(gethostbyaddr)
{ {
char *addr; char *addr;
int addr_len; size_t addr_len;
zend_string *hostname; zend_string *hostname;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &addr, &addr_len) == FAILURE) {

View file

@ -418,7 +418,7 @@ PHP_FUNCTION(escapeshellcmd)
PHP_FUNCTION(escapeshellarg) PHP_FUNCTION(escapeshellarg)
{ {
char *argument; char *argument;
int argument_len; size_t argument_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &argument, &argument_len) == FAILURE) {
return; return;

View file

@ -1209,7 +1209,11 @@ PHPAPI PHP_FUNCTION(fwrite)
if (ZEND_NUM_ARGS() == 2) { if (ZEND_NUM_ARGS() == 2) {
num_bytes = arg2len; num_bytes = arg2len;
} else { } else {
num_bytes = MAX(0, MIN((int)arg3, arg2len)); if (arg3 > 0) {
num_bytes = MAX(0, MIN((size_t)arg3, arg2len));
} else {
num_bytes = 0;
}
} }
if (!num_bytes) { if (!num_bytes) {
@ -1965,7 +1969,7 @@ PHP_FUNCTION(fgetcsv)
{ {
zval *fd, *len_zv = NULL; zval *fd, *len_zv = NULL;
char *delimiter_str = NULL; char *delimiter_str = NULL;
int delimiter_str_len = 0; size_t delimiter_str_len = 0;
char *enclosure_str = NULL; char *enclosure_str = NULL;
size_t enclosure_str_len = 0; size_t enclosure_str_len = 0;
char *escape_str = NULL; char *escape_str = NULL;

View file

@ -233,7 +233,7 @@ PHP_FUNCTION(disk_total_space)
{ {
double bytestotal; double bytestotal;
char *path; char *path;
int path_len; size_t path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) {
return; return;
@ -368,7 +368,7 @@ PHP_FUNCTION(disk_free_space)
{ {
double bytesfree; double bytesfree;
char *path; char *path;
int path_len; size_t path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &path, &path_len) == FAILURE) {
return; return;
@ -829,7 +829,7 @@ PHP_FUNCTION(clearstatcache)
{ {
zend_bool clear_realpath_cache = 0; zend_bool clear_realpath_cache = 0;
char *filename = NULL; char *filename = NULL;
int filename_len = 0; size_t filename_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bp", &clear_realpath_cache, &filename, &filename_len) == FAILURE) {
return; return;

View file

@ -180,7 +180,7 @@ PHP_FUNCTION(setcookie)
char *name, *value = NULL, *path = NULL, *domain = NULL; char *name, *value = NULL, *path = NULL, *domain = NULL;
zend_long expires = 0; zend_long expires = 0;
zend_bool secure = 0, httponly = 0; zend_bool secure = 0, httponly = 0;
int name_len, value_len = 0, path_len = 0, domain_len = 0; size_t name_len, value_len = 0, path_len = 0, domain_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name,
&name_len, &value, &value_len, &expires, &path, &name_len, &value, &value_len, &expires, &path,
@ -203,7 +203,7 @@ PHP_FUNCTION(setrawcookie)
char *name, *value = NULL, *path = NULL, *domain = NULL; char *name, *value = NULL, *path = NULL, *domain = NULL;
zend_long expires = 0; zend_long expires = 0;
zend_bool secure = 0, httponly = 0; zend_bool secure = 0, httponly = 0;
int name_len, value_len = 0, path_len = 0, domain_len = 0; size_t name_len, value_len = 0, path_len = 0, domain_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slssbb", &name,
&name_len, &value, &value_len, &expires, &path, &name_len, &value, &value_len, &expires, &path,

View file

@ -79,7 +79,7 @@ extern zend_long php_getuid(TSRMLS_D);
PHP_FUNCTION(ezmlm_hash) PHP_FUNCTION(ezmlm_hash)
{ {
char *str = NULL; char *str = NULL;
zend_ulong h = 5381; zend_ulong h = Z_UL(5381);
size_t j, str_len; size_t j, str_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {

View file

@ -308,7 +308,7 @@ PHP_FUNCTION(password_hash)
{ {
char *hash_format, *hash, *salt, *password; char *hash_format, *hash, *salt, *password;
zend_long algo = 0; zend_long algo = 0;
int password_len = 0, hash_len; size_t password_len = 0, hash_len;
size_t salt_len = 0, required_salt_len = 0, hash_format_len; size_t salt_len = 0, required_salt_len = 0, hash_format_len;
HashTable *options = 0; HashTable *options = 0;
zval *option_buffer; zval *option_buffer;

View file

@ -311,7 +311,7 @@ static int php_zip_add_file(struct zip *za, const char *filename, size_t filenam
} }
/* }}} */ /* }}} */
static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char **remove_path, int *remove_path_len, char **add_path, int *add_path_len TSRMLS_DC) /* {{{ */ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char **remove_path, size_t *remove_path_len, char **add_path, size_t *add_path_len TSRMLS_DC) /* {{{ */
{ {
zval *option; zval *option;
if ((option = zend_hash_str_find(HASH_OF(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) { if ((option = zend_hash_str_find(HASH_OF(options), "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) {