From e93c28053d7d31853f59dc5adf0bfaff52819fb2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rouven=20We=C3=9Fling?= Date: Fri, 29 Jan 2016 11:02:46 +0100 Subject: [PATCH] Replace usage of php_uint16 with uint16_t --- ext/phar/phar.c | 8 ++++---- ext/phar/phar_internal.h | 7 ------- ext/phar/zip.c | 12 ++++++------ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index cee438ad77..54aa02bee6 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -516,11 +516,11 @@ void phar_entry_remove(phar_entry_data *idata, char **error) /* {{{ */ memcpy(&var, buffer, sizeof(var)); \ buffer += 4 # define PHAR_GET_16(buffer, var) \ - var = *(php_uint16*)(buffer); \ + var = *(uint16_t*)(buffer); \ buffer += 2 #endif -#define PHAR_ZIP_16(var) ((php_uint16)((((php_uint16)var[0]) & 0xff) | \ - (((php_uint16)var[1]) & 0xff) << 8)) +#define PHAR_ZIP_16(var) ((uint16_t)((((uint16_t)var[0]) & 0xff) | \ + (((uint16_t)var[1]) & 0xff) << 8)) #define PHAR_ZIP_32(var) ((uint32_t)((((uint32_t)var[0]) & 0xff) | \ (((uint32_t)var[1]) & 0xff) << 8 | \ (((uint32_t)var[2]) & 0xff) << 16 | \ @@ -655,7 +655,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char phar_archive_data *mydata = NULL; phar_entry_info entry; uint32_t manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags; - php_uint16 manifest_ver; + uint16_t manifest_ver; uint32_t len; zend_long offset; int sig_len, register_alias = 0, temp_alias = 0; diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 3f944c77db..610482b290 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -199,13 +199,6 @@ ZEND_EXTERN_MODULE_GLOBALS(phar) ZEND_TSRMLS_CACHE_EXTERN(); #endif -#ifndef php_uint16 -# if SIZEOF_SHORT == 2 -# define php_uint16 unsigned short -# else -# define php_uint16 uint16_t -# endif -#endif #include "pharzip.h" typedef union _phar_archive_object phar_archive_object; diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 688ca88a45..4994dd0e04 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -18,8 +18,8 @@ #include "phar_internal.h" -#define PHAR_GET_16(var) ((php_uint16)((((php_uint16)var[0]) & 0xff) | \ - (((php_uint16)var[1]) & 0xff) << 8)) +#define PHAR_GET_16(var) ((uint16_t)((((uint16_t)var[0]) & 0xff) | \ + (((uint16_t)var[1]) & 0xff) << 8)) #define PHAR_GET_32(var) ((uint32_t)((((uint32_t)var[0]) & 0xff) | \ (((uint32_t)var[1]) & 0xff) << 8 | \ (((uint32_t)var[2]) & 0xff) << 16 | \ @@ -37,9 +37,9 @@ static inline void phar_write_16(char buffer[2], uint32_t value) buffer[0] = (unsigned char) (value & 0xff); } # 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)); +# define PHAR_SET_16(var, value) phar_write_16(var, (uint16_t) (value)); -static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len) /* {{{ */ +static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, uint16_t len) /* {{{ */ { union { phar_zip_extra_field_header header; @@ -143,7 +143,7 @@ static time_t phar_zip_d2u_time(char *cdtime, char *cddate) /* {{{ */ static void phar_zip_u2d_time(time_t time, char *dtime, char *ddate) /* {{{ */ { - php_uint16 ctime, cdate; + uint16_t ctime, cdate; struct tm *tm, tmbuf; tm = php_localtime_r(&time, &tmbuf); @@ -168,7 +168,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, phar_zip_dir_end locator; char buf[sizeof(locator) + 65536]; zend_long size; - php_uint16 i; + uint16_t i; phar_archive_data *mydata = NULL; phar_entry_info entry = {0}; char *p = buf, *ext, *actual_alias = NULL; -- 2.50.1