diff options
author | Rouven Weßling <rouven@contentful.com> | 2016-01-28 17:11:53 +0100 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2016-02-04 11:57:41 +0100 |
commit | a61029b15554d1a5da81a6e6d498f02629bf4242 (patch) | |
tree | 36159f58938cc549879b313f8fd347f9c6087df0 | |
parent | d998ca6e3cedfd663a1a40a36b814d05b5df6e71 (diff) | |
download | php-git-a61029b15554d1a5da81a6e6d498f02629bf4242.tar.gz |
Replace usage of php_int32 and php_uint32 with int32_t and uint32_t
-rw-r--r-- | ext/phar/phar.c | 30 | ||||
-rw-r--r-- | ext/phar/phar_internal.h | 30 | ||||
-rw-r--r-- | ext/phar/phar_object.c | 14 | ||||
-rw-r--r-- | ext/phar/tar.c | 24 | ||||
-rw-r--r-- | ext/phar/util.c | 4 | ||||
-rw-r--r-- | ext/phar/zip.c | 24 | ||||
-rw-r--r-- | ext/session/mod_mm.c | 22 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 8 | ||||
-rw-r--r-- | ext/standard/basic_functions.h | 16 | ||||
-rw-r--r-- | ext/standard/crc32.c | 4 | ||||
-rw-r--r-- | ext/standard/lcg.c | 4 | ||||
-rw-r--r-- | ext/standard/md5.c | 20 | ||||
-rw-r--r-- | ext/standard/md5.h | 6 | ||||
-rw-r--r-- | ext/standard/php_crypt_r.c | 2 | ||||
-rw-r--r-- | ext/standard/php_lcg.h | 4 | ||||
-rw-r--r-- | ext/standard/php_rand.h | 4 | ||||
-rw-r--r-- | ext/standard/rand.c | 18 | ||||
-rw-r--r-- | ext/standard/sha1.c | 38 | ||||
-rw-r--r-- | ext/standard/sha1.h | 4 |
19 files changed, 131 insertions, 145 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 3cf21b56c8..cee438ad77 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -521,10 +521,10 @@ void phar_entry_remove(phar_entry_data *idata, char **error) /* {{{ */ #endif #define PHAR_ZIP_16(var) ((php_uint16)((((php_uint16)var[0]) & 0xff) | \ (((php_uint16)var[1]) & 0xff) << 8)) -#define PHAR_ZIP_32(var) ((php_uint32)((((php_uint32)var[0]) & 0xff) | \ - (((php_uint32)var[1]) & 0xff) << 8 | \ - (((php_uint32)var[2]) & 0xff) << 16 | \ - (((php_uint32)var[3]) & 0xff) << 24)) +#define PHAR_ZIP_32(var) ((uint32_t)((((uint32_t)var[0]) & 0xff) | \ + (((uint32_t)var[1]) & 0xff) << 8 | \ + (((uint32_t)var[2]) & 0xff) << 16 | \ + (((uint32_t)var[3]) & 0xff) << 24)) /** * Open an already loaded phar @@ -604,7 +604,7 @@ int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len * * data is the serialized zval */ -int phar_parse_metadata(char **buffer, zval *metadata, php_uint32 zip_metadata_len) /* {{{ */ +int phar_parse_metadata(char **buffer, zval *metadata, uint32_t zip_metadata_len) /* {{{ */ { php_unserialize_data_t var_hash; @@ -649,14 +649,14 @@ int phar_parse_metadata(char **buffer, zval *metadata, php_uint32 zip_metadata_l * This is used by phar_open_from_filename to process the manifest, but can be called * directly. */ -static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, zend_long halt_offset, phar_archive_data** pphar, php_uint32 compression, char **error) /* {{{ */ +static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char *alias, int alias_len, zend_long halt_offset, phar_archive_data** pphar, uint32_t compression, char **error) /* {{{ */ { char b32[4], *buffer, *endbuffer, *savebuf; phar_archive_data *mydata = NULL; phar_entry_info entry; - php_uint32 manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags; + uint32_t manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags; php_uint16 manifest_ver; - php_uint32 len; + uint32_t len; zend_long offset; int sig_len, register_alias = 0, temp_alias = 0; char *signature = NULL; @@ -778,7 +778,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char switch(sig_flags) { case PHAR_SIG_OPENSSL: { - php_uint32 signature_len; + uint32_t signature_len; char *sig; zend_off_t whence; @@ -1565,7 +1565,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a const zend_long tokenlen = sizeof(token) - 1; zend_long halt_offset; size_t got; - php_uint32 compression = PHAR_FILE_COMPRESSED_NONE; + uint32_t compression = PHAR_FILE_COMPRESSED_NONE; if (error) { *error = NULL; @@ -2309,9 +2309,9 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error) /* {{{ /** * Validate the CRC32 of a file opened from within the phar */ -int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip) /* {{{ */ +int phar_postprocess_file(phar_entry_data *idata, uint32_t crc32, char **error, int process_zip) /* {{{ */ { - php_uint32 crc = ~0; + uint32_t crc = ~0; int len = idata->internal_file->uncompressed_filesize; php_stream *fp = idata->fp; phar_entry_info *entry = idata->internal_file; @@ -2476,8 +2476,8 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv zend_off_t manifest_ftell; zend_long offset; size_t wrote; - php_uint32 manifest_len, mytime, loc, new_manifest_count; - php_uint32 newcrc32; + uint32_t manifest_len, mytime, loc, new_manifest_count; + uint32_t newcrc32; php_stream *file, *oldfile, *newfile, *stubfile; php_stream_filter *filter; php_serialize_data_t metadata_hash; @@ -2809,7 +2809,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv php_stream_flush(entry->cfp); php_stream_filter_remove(filter, 1); php_stream_seek(entry->cfp, 0, SEEK_END); - entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp); + entry->compressed_filesize = (uint32_t) php_stream_tell(entry->cfp); /* generate crc on compressed file */ php_stream_rewind(entry->cfp); entry->old_flags = entry->flags; diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 003287543c..3f944c77db 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -229,17 +229,17 @@ enum phar_fp_type { /* entry for one file in a phar file */ typedef struct _phar_entry_info { /* first bytes are exactly as in file */ - php_uint32 uncompressed_filesize; - php_uint32 timestamp; - php_uint32 compressed_filesize; - php_uint32 crc32; - php_uint32 flags; + uint32_t uncompressed_filesize; + uint32_t timestamp; + uint32_t compressed_filesize; + uint32_t crc32; + uint32_t flags; /* remainder */ /* when changing compression, save old flags in case fp is NULL */ - php_uint32 old_flags; + uint32_t old_flags; zval metadata; int metadata_len; /* only used for cached manifests */ - php_uint32 filename_len; + uint32_t filename_len; char *filename; enum phar_fp_type fp_type; /* offset within original phar file of the file contents */ @@ -295,14 +295,14 @@ struct _phar_archive_data { HashTable virtual_dirs; /* hash of mounted directory paths */ HashTable mounted_dirs; - php_uint32 flags; - php_uint32 min_timestamp; - php_uint32 max_timestamp; + uint32_t flags; + uint32_t min_timestamp; + uint32_t max_timestamp; php_stream *fp; /* decompressed file contents are stored here */ php_stream *ufp; int refcount; - php_uint32 sig_flags; + uint32_t sig_flags; int sig_len; char *signature; zval metadata; @@ -536,7 +536,7 @@ void phar_object_init(void); void phar_destroy_phar_data(phar_archive_data *phar); int phar_open_entry_file(phar_archive_data *phar, phar_entry_info *entry, char **error); -int phar_postprocess_file(phar_entry_data *idata, php_uint32 crc32, char **error, int process_zip); +int phar_postprocess_file(phar_entry_data *idata, uint32_t crc32, char **error, int process_zip); int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error); int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error); int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error); @@ -544,7 +544,7 @@ int phar_open_executed_filename(char *alias, int alias_len, char **error); int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len); int phar_get_archive(phar_archive_data **archive, char *fname, int fname_len, char *alias, int alias_len, char **error); int phar_open_parsed_phar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error); -int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error); +int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error); int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signature, int *signature_length, char **error); /* utility functions */ @@ -558,7 +558,7 @@ int phar_mount_entry(phar_archive_data *phar, char *filename, int filename_len, zend_string *phar_find_in_include_path(char *file, int file_len, phar_archive_data **pphar); char *phar_fix_filepath(char *path, int *new_len, int use_cwd); phar_entry_info * phar_open_jit(phar_archive_data *phar, phar_entry_info *entry, char **error); -int phar_parse_metadata(char **buffer, zval *metadata, php_uint32 zip_metadata_len); +int phar_parse_metadata(char **buffer, zval *metadata, uint32_t zip_metadata_len); void destroy_phar_manifest_entry(zval *zv); int phar_seek_efp(phar_entry_info *entry, zend_off_t offset, int whence, zend_off_t position, int follow_links); php_stream *phar_get_efp(phar_entry_info *entry, int follow_links); @@ -572,7 +572,7 @@ int phar_copy_on_write(phar_archive_data **pphar); /* tar functions in tar.c */ int phar_is_tar(char *buf, char *fname); -int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error); +int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, uint32_t compression, char **error); int phar_open_or_create_tar(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error); int phar_tar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int defaultstub, char **error); diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 2e0ceb837b..249fbff4de 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -2164,7 +2164,7 @@ its_ok: } /* }}} */ -static zend_object *phar_convert_to_other(phar_archive_data *source, int convert, char *ext, php_uint32 flags) /* {{{ */ +static zend_object *phar_convert_to_other(phar_archive_data *source, int convert, char *ext, uint32_t flags) /* {{{ */ { phar_archive_data *phar; phar_entry_info *entry, newentry; @@ -2288,7 +2288,7 @@ PHP_METHOD(Phar, convertToExecutable) char *ext = NULL; int is_data; size_t ext_len = 0; - php_uint32 flags; + uint32_t flags; zend_object *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday, so there) */ zend_long format = 9021976, method = 9021976; @@ -2392,7 +2392,7 @@ PHP_METHOD(Phar, convertToData) char *ext = NULL; int is_data; size_t ext_len = 0; - php_uint32 flags; + uint32_t flags; zend_object *ret; /* a number that is not 0, 1 or 2 (Which is also Greg's birthday so there) */ zend_long format = 9021976, method = 9021976; @@ -3066,7 +3066,7 @@ PHP_METHOD(Phar, getModified) static int phar_set_compression(zval *zv, void *argument) /* {{{ */ { phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(zv); - php_uint32 compress = *(php_uint32 *)argument; + uint32_t compress = *(uint32_t *)argument; if (entry->is_deleted) { return ZEND_HASH_APPLY_KEEP; @@ -3104,7 +3104,7 @@ static int phar_test_compression(zval *zv, void *argument) /* {{{ */ } /* }}} */ -static void pharobj_set_compression(HashTable *manifest, php_uint32 compress) /* {{{ */ +static void pharobj_set_compression(HashTable *manifest, uint32_t compress) /* {{{ */ { zend_hash_apply_with_argument(manifest, phar_set_compression, &compress); } @@ -3130,7 +3130,7 @@ PHP_METHOD(Phar, compress) zend_long method; char *ext = NULL; size_t ext_len = 0; - php_uint32 flags; + uint32_t flags; zend_object *ret; PHAR_ARCHIVE_OBJECT(); @@ -3239,7 +3239,7 @@ PHP_METHOD(Phar, decompress) PHP_METHOD(Phar, compressFiles) { char *error; - php_uint32 flags; + uint32_t flags; zend_long method; PHAR_ARCHIVE_OBJECT(); diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 3b5158b5f1..3b7373f6fa 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -19,9 +19,9 @@ #include "phar_internal.h" -static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */ +static uint32_t phar_tar_number(char *buf, int len) /* {{{ */ { - php_uint32 num = 0; + uint32_t num = 0; int i = 0; while (i < len && buf[i] == ' ') { @@ -62,7 +62,7 @@ static php_uint32 phar_tar_number(char *buf, int len) /* {{{ */ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -static int phar_tar_octal(char *buf, php_uint32 val, int len) /* {{{ */ +static int phar_tar_octal(char *buf, uint32_t val, int len) /* {{{ */ { char *p = buf; int s = len; @@ -84,9 +84,9 @@ static int phar_tar_octal(char *buf, php_uint32 val, int len) /* {{{ */ } /* }}} */ -static php_uint32 phar_tar_checksum(char *buf, int len) /* {{{ */ +static uint32_t phar_tar_checksum(char *buf, int len) /* {{{ */ { - php_uint32 sum = 0; + uint32_t sum = 0; char *end = buf + len; while (buf != end) { @@ -100,8 +100,8 @@ static php_uint32 phar_tar_checksum(char *buf, int len) /* {{{ */ int phar_is_tar(char *buf, char *fname) /* {{{ */ { tar_header *header = (tar_header *) buf; - php_uint32 checksum = phar_tar_number(header->checksum, sizeof(header->checksum)); - php_uint32 ret; + uint32_t checksum = phar_tar_number(header->checksum, sizeof(header->checksum)); + uint32_t ret; char save[sizeof(header->checksum)], *bname; /* assume that the first filename in a tar won't begin with <?php */ @@ -202,13 +202,13 @@ static size_t strnlen(const char *s, size_t maxlen) { } #endif -int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error) /* {{{ */ +int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, uint32_t compression, char **error) /* {{{ */ { char buf[512], *actual_alias = NULL, *p; phar_entry_info entry = {0}; size_t pos = 0, read, totalsize; tar_header *hdr; - php_uint32 sum1, sum2, size, old; + uint32_t sum1, sum2, size, old; phar_archive_data *myphar, *actual; int last_was_longlink = 0; int linkname_len; @@ -299,7 +299,7 @@ bail: | ((((unsigned char*)(buffer))[1]) << 8) \ | (((unsigned char*)(buffer))[0])) #else -# define PHAR_GET_32(buffer) (php_uint32) *(buffer) +# define PHAR_GET_32(buffer) (uint32_t) *(buffer) #endif myphar->sig_flags = PHAR_GET_32(buf); if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error)) { @@ -1235,12 +1235,12 @@ nostub: } #ifdef WORDS_BIGENDIAN # define PHAR_SET_32(var, buffer) \ - *(php_uint32 *)(var) = (((((unsigned char*)&(buffer))[3]) << 24) \ + *(uint32_t *)(var) = (((((unsigned char*)&(buffer))[3]) << 24) \ | ((((unsigned char*)&(buffer))[2]) << 16) \ | ((((unsigned char*)&(buffer))[1]) << 8) \ | (((unsigned char*)&(buffer))[0])) #else -# define PHAR_SET_32(var, buffer) *(php_uint32 *)(var) = (php_uint32) (buffer) +# define PHAR_SET_32(var, buffer) *(uint32_t *)(var) = (uint32_t) (buffer) #endif PHAR_SET_32(sigbuf, phar->sig_flags); PHAR_SET_32(sigbuf + 4, signature_length); diff --git a/ext/phar/util.c b/ext/phar/util.c index 9575af8160..39ecf399ae 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -1177,7 +1177,7 @@ char * phar_compress_filter(phar_entry_info * entry, int return_unknown) /* {{{ */ char * phar_decompress_filter(phar_entry_info * entry, int return_unknown) /* {{{ */ { - php_uint32 flags; + uint32_t flags; if (entry->is_modified) { flags = entry->old_flags; @@ -1473,7 +1473,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t /* }}} */ #endif /* #ifndef PHAR_HAVE_OPENSSL */ -int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error) /* {{{ */ +int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error) /* {{{ */ { int read_size, len; zend_off_t read_len; diff --git a/ext/phar/zip.c b/ext/phar/zip.c index bd088cf4fa..688ca88a45 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -20,23 +20,23 @@ #define PHAR_GET_16(var) ((php_uint16)((((php_uint16)var[0]) & 0xff) | \ (((php_uint16)var[1]) & 0xff) << 8)) -#define PHAR_GET_32(var) ((php_uint32)((((php_uint32)var[0]) & 0xff) | \ - (((php_uint32)var[1]) & 0xff) << 8 | \ - (((php_uint32)var[2]) & 0xff) << 16 | \ - (((php_uint32)var[3]) & 0xff) << 24)) -static inline void phar_write_32(char buffer[4], php_uint32 value) +#define PHAR_GET_32(var) ((uint32_t)((((uint32_t)var[0]) & 0xff) | \ + (((uint32_t)var[1]) & 0xff) << 8 | \ + (((uint32_t)var[2]) & 0xff) << 16 | \ + (((uint32_t)var[3]) & 0xff) << 24)) +static inline void phar_write_32(char buffer[4], uint32_t value) { buffer[3] = (unsigned char) ((value & 0xff000000) >> 24); buffer[2] = (unsigned char) ((value & 0xff0000) >> 16); buffer[1] = (unsigned char) ((value & 0xff00) >> 8); buffer[0] = (unsigned char) (value & 0xff); } -static inline void phar_write_16(char buffer[2], php_uint32 value) +static inline void phar_write_16(char buffer[2], uint32_t value) { buffer[1] = (unsigned char) ((value & 0xff00) >> 8); buffer[0] = (unsigned char) (value & 0xff); } -# define PHAR_SET_32(var, value) phar_write_32(var, (php_uint32) (value)); +# define PHAR_SET_32(var, value) phar_write_32(var, (uint32_t) (value)); # define PHAR_SET_16(var, value) phar_write_16(var, (php_uint16) (value)); static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len) /* {{{ */ @@ -791,7 +791,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{ phar_zip_unix3 perms; phar_zip_central_dir_file central; struct _phar_zip_pass *p; - php_uint32 newcrc32; + uint32_t newcrc32; zend_off_t offset; int not_really_modified = 0; p = (struct _phar_zip_pass*) arg; @@ -822,7 +822,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{ PHAR_SET_16(perms.size, sizeof(perms) - 4); PHAR_SET_16(perms.perms, entry->flags & PHAR_ENT_PERM_MASK); { - php_uint32 crc = (php_uint32) ~0; + uint32_t crc = (uint32_t) ~0; CRC32(crc, perms.perms[0]); CRC32(crc, perms.perms[1]); PHAR_SET_32(perms.crc32, ~crc); @@ -848,7 +848,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{ /* do extra field for perms later */ if (entry->is_modified) { - php_uint32 loc; + uint32_t loc; php_stream_filter *filter; php_stream *efp; @@ -936,7 +936,7 @@ static int phar_zip_changed_apply_int(phar_entry_info *entry, void *arg) /* {{{ php_stream_flush(entry->cfp); php_stream_filter_remove(filter, 1); php_stream_seek(entry->cfp, 0, SEEK_END); - entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp); + entry->compressed_filesize = (uint32_t) php_stream_tell(entry->cfp); PHAR_SET_32(central.compsize, entry->compressed_filesize); PHAR_SET_32(local.compsize, entry->compressed_filesize); /* generate crc on compressed file */ @@ -1194,7 +1194,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int char *temperr = NULL; struct _phar_zip_pass pass; phar_zip_dir_end eocd; - php_uint32 cdir_size, cdir_offset; + uint32_t cdir_size, cdir_offset; pass.error = &temperr; entry.flags = PHAR_ENT_PERM_DEF_FILE; diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c index 1978caed3c..3f69897556 100644 --- a/ext/session/mod_mm.c +++ b/ext/session/mod_mm.c @@ -29,6 +29,7 @@ #include <sys/types.h> #include <fcntl.h> +#include "php_stdint.h" #include "php_session.h" #include "mod_mm.h" #include "SAPI.h" @@ -39,14 +40,11 @@ #define PS_MM_FILE "session_mm_" -/* For php_uint32 */ -#include "ext/standard/basic_functions.h" - /* This list holds all data associated with one session. */ typedef struct ps_sd { struct ps_sd *next; - php_uint32 hv; /* hash value of key */ + uint32_t hv; /* hash value of key */ time_t ctime; /* time of last change */ void *data; size_t datalen; /* amount of valid data */ @@ -57,8 +55,8 @@ typedef struct ps_sd { typedef struct { MM *mm; ps_sd **hash; - php_uint32 hash_max; - php_uint32 hash_cnt; + uint32_t hash_max; + uint32_t hash_cnt; pid_t owner; } ps_mm; @@ -70,9 +68,9 @@ static ps_mm *ps_mm_instance = NULL; # define ps_mm_debug(a) #endif -static inline php_uint32 ps_sd_hash(const char *data, int len) +static inline uint32_t ps_sd_hash(const char *data, int len) { - php_uint32 h; + uint32_t h; const char *e = data + len; for (h = 2166136261U; data < e; ) { @@ -85,7 +83,7 @@ static inline php_uint32 ps_sd_hash(const char *data, int len) static void hash_split(ps_mm *data) { - php_uint32 nmax; + uint32_t nmax; ps_sd **nhash; ps_sd **ohash, **ehash; ps_sd *ps, *next; @@ -114,7 +112,7 @@ static void hash_split(ps_mm *data) static ps_sd *ps_sd_new(ps_mm *data, const char *key) { - php_uint32 hv, slot; + uint32_t hv, slot; ps_sd *sd; int keylen; @@ -155,7 +153,7 @@ static ps_sd *ps_sd_new(ps_mm *data, const char *key) static void ps_sd_destroy(ps_mm *data, ps_sd *sd) { - php_uint32 slot; + uint32_t slot; slot = ps_sd_hash(sd->key, strlen(sd->key)) & data->hash_max; @@ -180,7 +178,7 @@ static void ps_sd_destroy(ps_mm *data, ps_sd *sd) static ps_sd *ps_sd_lookup(ps_mm *data, const char *key, int rw) { - php_uint32 hv, slot; + uint32_t hv, slot; ps_sd *ret, *prev; hv = ps_sd_hash(key, strlen(key)); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e7f4d4f8fe..f8121c1ebf 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3493,8 +3493,8 @@ PHPAPI double php_get_nan(void) /* {{{ */ return HUGE_VAL + -HUGE_VAL; #elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha) double val = 0.0; - ((php_uint32*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH; - ((php_uint32*)&val)[0] = 0; + ((uint32_t*)&val)[1] = PHP_DOUBLE_QUIET_NAN_HIGH; + ((uint32_t*)&val)[0] = 0; return val; #elif HAVE_ATOF_ACCEPTS_NAN return atof("NAN"); @@ -3510,8 +3510,8 @@ PHPAPI double php_get_inf(void) /* {{{ */ return HUGE_VAL; #elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha) double val = 0.0; - ((php_uint32*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH; - ((php_uint32*)&val)[0] = 0; + ((uint32_t*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH; + ((uint32_t*)&val)[0] = 0; return val; #elif HAVE_ATOF_ACCEPTS_INF return atof("INF"); diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 774f85dd1a..4aa9040d65 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -149,18 +149,6 @@ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers); PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers); PHPAPI int php_prefix_varname(zval *result, zval *prefix, char *var_name, size_t var_name_len, zend_bool add_underscore); -#if SIZEOF_INT == 4 -/* Most 32-bit and 64-bit systems have 32-bit ints */ -typedef unsigned int php_uint32; -typedef signed int php_int32; -#elif SIZEOF_LONG == 4 -/* 16-bit systems? */ -typedef unsigned long php_uint32; -typedef signed long php_int32; -#else -#error Need type which holds 32 bits -#endif - #define MT_N (624) typedef struct _php_basic_globals { @@ -193,8 +181,8 @@ typedef struct _php_basic_globals { php_stream_statbuf ssb, lssb; /* rand.c */ - php_uint32 state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */ - php_uint32 *next; /* next random value is computed from here */ + uint32_t state[MT_N+1]; /* state vector + 1 extra to not violate ANSI C */ + uint32_t *next; /* next random value is computed from here */ int left; /* can *next++ this many times before reloading */ unsigned int rand_seed; /* Seed for rand(), in ts version */ diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index 45a2eb0667..e6024dcf11 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -28,8 +28,8 @@ PHP_NAMED_FUNCTION(php_if_crc32) { char *p; size_t nr; - php_uint32 crcinit = 0; - register php_uint32 crc; + uint32_t crcinit = 0; + register uint32_t crc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &p, &nr) == FAILURE) { return; diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index 9f40aba3e2..74b46eadd2 100644 --- a/ext/standard/lcg.c +++ b/ext/standard/lcg.c @@ -54,8 +54,8 @@ static void lcg_seed(void); PHPAPI double php_combined_lcg(void) /* {{{ */ { - php_int32 q; - php_int32 z; + int32_t q; + int32_t z; if (!LCG(seeded)) { lcg_seed(); diff --git a/ext/standard/md5.c b/ext/standard/md5.c index 2489b9971a..825df21c69 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -169,16 +169,16 @@ PHP_NAMED_FUNCTION(php_if_md5_file) */ #if defined(__i386__) || defined(__x86_64__) || defined(__vax__) # define SET(n) \ - (*(php_uint32 *)&ptr[(n) * 4]) + (*(uint32_t *)&ptr[(n) * 4]) # define GET(n) \ SET(n) #else # define SET(n) \ (ctx->block[(n)] = \ - (php_uint32)ptr[(n) * 4] | \ - ((php_uint32)ptr[(n) * 4 + 1] << 8) | \ - ((php_uint32)ptr[(n) * 4 + 2] << 16) | \ - ((php_uint32)ptr[(n) * 4 + 3] << 24)) + (uint32_t)ptr[(n) * 4] | \ + ((uint32_t)ptr[(n) * 4 + 1] << 8) | \ + ((uint32_t)ptr[(n) * 4 + 2] << 16) | \ + ((uint32_t)ptr[(n) * 4 + 3] << 24)) # define GET(n) \ (ctx->block[(n)]) #endif @@ -190,8 +190,8 @@ PHP_NAMED_FUNCTION(php_if_md5_file) static const void *body(PHP_MD5_CTX *ctx, const void *data, size_t size) { const unsigned char *ptr; - php_uint32 a, b, c, d; - php_uint32 saved_a, saved_b, saved_c, saved_d; + uint32_t a, b, c, d; + uint32_t saved_a, saved_b, saved_c, saved_d; ptr = data; @@ -307,8 +307,8 @@ PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx) PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size) { - php_uint32 saved_lo; - php_uint32 used, free; + uint32_t saved_lo; + uint32_t used, free; saved_lo = ctx->lo; if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) { @@ -342,7 +342,7 @@ PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size) PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx) { - php_uint32 used, free; + uint32_t used, free; used = ctx->lo & 0x3f; diff --git a/ext/standard/md5.h b/ext/standard/md5.h index 4210483864..5acd83ecbe 100644 --- a/ext/standard/md5.h +++ b/ext/standard/md5.h @@ -42,10 +42,10 @@ PHP_NAMED_FUNCTION(php_if_md5_file); /* MD5 context. */ typedef struct { - php_uint32 lo, hi; - php_uint32 a, b, c, d; + uint32_t lo, hi; + uint32_t a, b, c, d; unsigned char buffer[64]; - php_uint32 block[16]; + uint32_t block[16]; } PHP_MD5_CTX; PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx); diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index a8ca39b08e..8b97d4a496 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -323,7 +323,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) unsigned char final[16]; unsigned int i, sl, pwl; PHP_MD5_CTX ctx, ctx1; - php_uint32 l; + uint32_t l; int pl; pwl = strlen(pw); diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h index 60850d6c7c..2c24756012 100644 --- a/ext/standard/php_lcg.h +++ b/ext/standard/php_lcg.h @@ -24,8 +24,8 @@ #include "ext/standard/basic_functions.h" typedef struct { - php_int32 s1; - php_int32 s2; + int32_t s1; + int32_t s2; int seeded; } php_lcg_globals; diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index 44a40a7c3b..39ba00eb56 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -55,7 +55,7 @@ PHPAPI void php_srand(zend_long seed); PHPAPI zend_long php_rand(void); -PHPAPI void php_mt_srand(php_uint32 seed); -PHPAPI php_uint32 php_mt_rand(void); +PHPAPI void php_mt_srand(uint32_t seed); +PHPAPI uint32_t php_mt_rand(void); #endif /* PHP_RAND_H */ diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 2dd05e70bb..50729f2418 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -146,19 +146,19 @@ PHPAPI zend_long php_rand(void) #define loBits(u) ((u) & 0x7FFFFFFFU) /* mask the highest bit of u */ #define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */ -#define twist(m,u,v) (m ^ (mixBits(u,v)>>1) ^ ((php_uint32)(-(php_int32)(loBit(u))) & 0x9908b0dfU)) +#define twist(m,u,v) (m ^ (mixBits(u,v)>>1) ^ ((uint32_t)(-(int32_t)(loBit(u))) & 0x9908b0dfU)) /* {{{ php_mt_initialize */ -static inline void php_mt_initialize(php_uint32 seed, php_uint32 *state) +static inline void php_mt_initialize(uint32_t seed, uint32_t *state) { /* Initialize generator state with seed See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. In previous versions, most significant bits (MSBs) of the seed affect only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. */ - register php_uint32 *s = state; - register php_uint32 *r = state; + register uint32_t *s = state; + register uint32_t *r = state; register int i = 1; *s++ = seed & 0xffffffffU; @@ -176,8 +176,8 @@ static inline void php_mt_reload(void) /* Generate N new values in state Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) */ - register php_uint32 *state = BG(state); - register php_uint32 *p = state; + register uint32_t *state = BG(state); + register uint32_t *p = state; register int i; for (i = N - M; i--; ++p) @@ -192,7 +192,7 @@ static inline void php_mt_reload(void) /* {{{ php_mt_srand */ -PHPAPI void php_mt_srand(php_uint32 seed) +PHPAPI void php_mt_srand(uint32_t seed) { /* Seed the generator with a simple uint32 */ php_mt_initialize(seed, BG(state)); @@ -205,12 +205,12 @@ PHPAPI void php_mt_srand(php_uint32 seed) /* {{{ php_mt_rand */ -PHPAPI php_uint32 php_mt_rand(void) +PHPAPI uint32_t php_mt_rand(void) { /* Pull a 32-bit integer from the generator state Every other access function simply transforms the numbers extracted here */ - register php_uint32 s1; + register uint32_t s1; if (BG(left) == 0) { php_mt_reload(); diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index ad4f4a5603..c4bed51abc 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -103,9 +103,9 @@ PHP_FUNCTION(sha1_file) /* }}} */ -static void SHA1Transform(php_uint32[5], const unsigned char[64]); -static void SHA1Encode(unsigned char *, php_uint32 *, unsigned int); -static void SHA1Decode(php_uint32 *, const unsigned char *, unsigned int); +static void SHA1Transform(uint32_t[5], const unsigned char[64]); +static void SHA1Encode(unsigned char *, uint32_t *, unsigned int); +static void SHA1Decode(uint32_t *, const unsigned char *, unsigned int); static unsigned char PADDING[64] = { @@ -133,22 +133,22 @@ static unsigned char PADDING[64] = /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. */ #define FF(a, b, c, d, e, w) { \ - (e) += F ((b), (c), (d)) + (w) + (php_uint32)(0x5A827999); \ + (e) += F ((b), (c), (d)) + (w) + (uint32_t)(0x5A827999); \ (e) += ROTATE_LEFT ((a), 5); \ (b) = ROTATE_LEFT((b), 30); \ } #define GG(a, b, c, d, e, w) { \ - (e) += G ((b), (c), (d)) + (w) + (php_uint32)(0x6ED9EBA1); \ + (e) += G ((b), (c), (d)) + (w) + (uint32_t)(0x6ED9EBA1); \ (e) += ROTATE_LEFT ((a), 5); \ (b) = ROTATE_LEFT((b), 30); \ } #define HH(a, b, c, d, e, w) { \ - (e) += H ((b), (c), (d)) + (w) + (php_uint32)(0x8F1BBCDC); \ + (e) += H ((b), (c), (d)) + (w) + (uint32_t)(0x8F1BBCDC); \ (e) += ROTATE_LEFT ((a), 5); \ (b) = ROTATE_LEFT((b), 30); \ } #define II(a, b, c, d, e, w) { \ - (e) += I ((b), (c), (d)) + (w) + (php_uint32)(0xCA62C1D6); \ + (e) += I ((b), (c), (d)) + (w) + (uint32_t)(0xCA62C1D6); \ (e) += ROTATE_LEFT ((a), 5); \ (b) = ROTATE_LEFT((b), 30); \ } @@ -184,10 +184,10 @@ PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, index = (unsigned int) ((context->count[0] >> 3) & 0x3F); /* Update number of bits */ - if ((context->count[0] += ((php_uint32) inputLen << 3)) - < ((php_uint32) inputLen << 3)) + if ((context->count[0] += ((uint32_t) inputLen << 3)) + < ((uint32_t) inputLen << 3)) context->count[1]++; - context->count[1] += ((php_uint32) inputLen >> 29); + context->count[1] += ((uint32_t) inputLen >> 29); partLen = 64 - index; @@ -253,11 +253,11 @@ PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context) * SHA1 basic transformation. Transforms state based on block. */ static void SHA1Transform(state, block) -php_uint32 state[5]; +uint32_t state[5]; const unsigned char block[64]; { - php_uint32 a = state[0], b = state[1], c = state[2]; - php_uint32 d = state[3], e = state[4], x[16], tmp; + uint32_t a = state[0], b = state[1], c = state[2]; + uint32_t d = state[3], e = state[4], x[16], tmp; SHA1Decode(x, block, 64); @@ -361,12 +361,12 @@ const unsigned char block[64]; /* }}} */ /* {{{ SHA1Encode - Encodes input (php_uint32) into output (unsigned char). Assumes len is + Encodes input (uint32_t) into output (unsigned char). Assumes len is a multiple of 4. */ static void SHA1Encode(output, input, len) unsigned char *output; -php_uint32 *input; +uint32_t *input; unsigned int len; { unsigned int i, j; @@ -381,19 +381,19 @@ unsigned int len; /* }}} */ /* {{{ SHA1Decode - Decodes input (unsigned char) into output (php_uint32). Assumes len is + Decodes input (unsigned char) into output (uint32_t). Assumes len is a multiple of 4. */ static void SHA1Decode(output, input, len) -php_uint32 *output; +uint32_t *output; const unsigned char *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((php_uint32) input[j + 3]) | (((php_uint32) input[j + 2]) << 8) | - (((php_uint32) input[j + 1]) << 16) | (((php_uint32) input[j]) << 24); + output[i] = ((uint32_t) input[j + 3]) | (((uint32_t) input[j + 2]) << 8) | + (((uint32_t) input[j + 1]) << 16) | (((uint32_t) input[j]) << 24); } /* }}} */ diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h index d2cc1b70b9..de338fad38 100644 --- a/ext/standard/sha1.h +++ b/ext/standard/sha1.h @@ -25,8 +25,8 @@ /* SHA1 context. */ typedef struct { - php_uint32 state[5]; /* state (ABCD) */ - php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + uint32_t state[5]; /* state (ABCD) */ + uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } PHP_SHA1_CTX; |