Skip to content

Commit e93c280

Browse files
realitykingnikic
authored andcommitted
Replace usage of php_uint16 with uint16_t
1 parent a61029b commit e93c280

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

ext/phar/phar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,11 @@ void phar_entry_remove(phar_entry_data *idata, char **error) /* {{{ */
516516
memcpy(&var, buffer, sizeof(var)); \
517517
buffer += 4
518518
# define PHAR_GET_16(buffer, var) \
519-
var = *(php_uint16*)(buffer); \
519+
var = *(uint16_t*)(buffer); \
520520
buffer += 2
521521
#endif
522-
#define PHAR_ZIP_16(var) ((php_uint16)((((php_uint16)var[0]) & 0xff) | \
523-
(((php_uint16)var[1]) & 0xff) << 8))
522+
#define PHAR_ZIP_16(var) ((uint16_t)((((uint16_t)var[0]) & 0xff) | \
523+
(((uint16_t)var[1]) & 0xff) << 8))
524524
#define PHAR_ZIP_32(var) ((uint32_t)((((uint32_t)var[0]) & 0xff) | \
525525
(((uint32_t)var[1]) & 0xff) << 8 | \
526526
(((uint32_t)var[2]) & 0xff) << 16 | \
@@ -655,7 +655,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
655655
phar_archive_data *mydata = NULL;
656656
phar_entry_info entry;
657657
uint32_t manifest_len, manifest_count, manifest_flags, manifest_index, tmp_len, sig_flags;
658-
php_uint16 manifest_ver;
658+
uint16_t manifest_ver;
659659
uint32_t len;
660660
zend_long offset;
661661
int sig_len, register_alias = 0, temp_alias = 0;

ext/phar/phar_internal.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,6 @@ ZEND_EXTERN_MODULE_GLOBALS(phar)
199199
ZEND_TSRMLS_CACHE_EXTERN();
200200
#endif
201201

202-
#ifndef php_uint16
203-
# if SIZEOF_SHORT == 2
204-
# define php_uint16 unsigned short
205-
# else
206-
# define php_uint16 uint16_t
207-
# endif
208-
#endif
209202
#include "pharzip.h"
210203

211204
typedef union _phar_archive_object phar_archive_object;

ext/phar/zip.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#include "phar_internal.h"
2020

21-
#define PHAR_GET_16(var) ((php_uint16)((((php_uint16)var[0]) & 0xff) | \
22-
(((php_uint16)var[1]) & 0xff) << 8))
21+
#define PHAR_GET_16(var) ((uint16_t)((((uint16_t)var[0]) & 0xff) | \
22+
(((uint16_t)var[1]) & 0xff) << 8))
2323
#define PHAR_GET_32(var) ((uint32_t)((((uint32_t)var[0]) & 0xff) | \
2424
(((uint32_t)var[1]) & 0xff) << 8 | \
2525
(((uint32_t)var[2]) & 0xff) << 16 | \
@@ -37,9 +37,9 @@ static inline void phar_write_16(char buffer[2], uint32_t value)
3737
buffer[0] = (unsigned char) (value & 0xff);
3838
}
3939
# define PHAR_SET_32(var, value) phar_write_32(var, (uint32_t) (value));
40-
# define PHAR_SET_16(var, value) phar_write_16(var, (php_uint16) (value));
40+
# define PHAR_SET_16(var, value) phar_write_16(var, (uint16_t) (value));
4141

42-
static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, php_uint16 len) /* {{{ */
42+
static int phar_zip_process_extra(php_stream *fp, phar_entry_info *entry, uint16_t len) /* {{{ */
4343
{
4444
union {
4545
phar_zip_extra_field_header header;
@@ -143,7 +143,7 @@ static time_t phar_zip_d2u_time(char *cdtime, char *cddate) /* {{{ */
143143

144144
static void phar_zip_u2d_time(time_t time, char *dtime, char *ddate) /* {{{ */
145145
{
146-
php_uint16 ctime, cdate;
146+
uint16_t ctime, cdate;
147147
struct tm *tm, tmbuf;
148148

149149
tm = php_localtime_r(&time, &tmbuf);
@@ -168,7 +168,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias,
168168
phar_zip_dir_end locator;
169169
char buf[sizeof(locator) + 65536];
170170
zend_long size;
171-
php_uint16 i;
171+
uint16_t i;
172172
phar_archive_data *mydata = NULL;
173173
phar_entry_info entry = {0};
174174
char *p = buf, *ext, *actual_alias = NULL;

0 commit comments

Comments
 (0)