1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Remove legacy AC_CHECK_TYPE calls for uint and ulong

The AC_CHECK_TYPE was refactored in more recent versions of Autoconf
and the call with two arguments is obsolete and not recommended anymore.

This patch also refactors some leftovers of using ulong and uint which
are not standard nor common usages of types in C.

The ulong can be used as zend_ulong and uint usage is actually
`unsigned int`.

The usage of HAVE_ULONG removed since it is not used in current code
base.

Legacy edgecase for some legacy HPUX systems removed:
- sys/stream.h header is not checked and the HAVE_SYS_STREAM_H is
  not defined with current build system.

- flags are unsigned int
- max_allowed_packet changed to unsigned int
This commit is contained in:
Peter Kokot
2019-03-02 14:42:21 +01:00
parent 8c62c69265
commit bebcdcc745
15 changed files with 19 additions and 41 deletions

View File

@@ -39,10 +39,6 @@ _LT_AC_TRY_DLOPEN_SELF([
], [])
])
dnl This is required for QNX and may be some BSD derived systems
AC_CHECK_TYPE( uint, unsigned int )
AC_CHECK_TYPE( ulong, unsigned long )
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(strdup getpid kill strtod strtol finite fpclass sigsetjmp)

View File

@@ -38,9 +38,6 @@
#include <float.h>
typedef unsigned long ulong;
typedef unsigned int uint;
#define HAVE_STDIOSTR_H 1
#define HAVE_CLASS_ISTDIOSTREAM
#define istdiostream stdiostream

View File

@@ -31,9 +31,6 @@ AH_TOP([
#endif
#define ZEND_DLIMPORT
#undef uint
#undef ulong
])
AH_BOTTOM([
#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS

View File

@@ -100,18 +100,18 @@ static void com_iter_move_forwards(zend_object_iterator *iter)
I->key++;
} else {
/* indicate that there are no more items */
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
return;
}
} else {
/* safe array */
if (I->key >= (ULONG) I->sa_max) {
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
return;
}
I->key++;
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key) == 0) {
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
return;
}
}
@@ -193,7 +193,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
ZVAL_COPY_VALUE(&I->zdata, &ptr);
} else {
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
}
} else {
@@ -228,7 +228,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
ZVAL_COPY_VALUE(&I->zdata, &ptr);
} else {
/* indicate that there are no more items */
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
}
}

View File

@@ -397,7 +397,7 @@ static HRESULT STDMETHODCALLTYPE disp_getnextdispid(
/* [in] */ DISPID id,
/* [out] */ DISPID *pid)
{
ulong next = id+1;
zend_ulong next = id+1;
FETCH_DISP("GetNextDispID");
while(!zend_hash_index_exists(disp->dispid_to_name, next))

View File

@@ -54,10 +54,6 @@
#define WE_HAD_MBSTATE_T
#endif
#if defined(ulong) && !defined(HAVE_ULONG)
#define HAVE_ULONG
#endif
#include <my_global.h>
#if !defined(HAVE_MBRLEN) && defined(WE_HAD_MBRLEN)

View File

@@ -819,9 +819,9 @@ PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const cset,
*newstr = '\0';
if (escape_overflow) {
DBG_RETURN((ulong)~0);
DBG_RETURN((zend_ulong)~0);
}
DBG_RETURN((ulong)(newstr - newstr_s));
DBG_RETURN((zend_ulong)(newstr - newstr_s));
}
/* }}} */
@@ -899,9 +899,9 @@ PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset
*newstr = '\0';
if (escape_overflow) {
DBG_RETURN((ulong)~0);
DBG_RETURN((zend_ulong)~0);
}
DBG_RETURN((ulong)(newstr - newstr_s));
DBG_RETURN((zend_ulong)(newstr - newstr_s));
}
/* }}} */

View File

@@ -49,13 +49,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
#define _LONG_LONG 1 /* For AIX string library */
#endif
/* Go around some bugs in different OS and compilers */
#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)
#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
#define HAVE_ULONG
#endif
#if SIZEOF_LONG_LONG > 4
#define HAVE_LONG_LONG 1

View File

@@ -206,7 +206,7 @@ typedef struct st_mysqlnd_infile
typedef struct st_mysqlnd_session_options
{
ulong flags;
unsigned int flags;
/* init commands - we need to send them to server directly after connect */
unsigned int num_commands;
@@ -231,7 +231,7 @@ typedef struct st_mysqlnd_session_options
char *charset_name;
/* maximum allowed packet size for communication */
ulong max_allowed_packet;
unsigned int max_allowed_packet;
#ifdef MYSQLND_STRING_TO_INT_CONVERSION
zend_bool int_and_float_native;

View File

@@ -26,7 +26,7 @@
#include "zend_shared_alloc.h"
#if SIZEOF_SIZE_T <= SIZEOF_ZEND_LONG
/* If sizeof(void*) == sizeof(ulong) we can use zend_hash index functions */
/* If sizeof(void*) == sizeof(zend_ulong) we can use zend_hash index functions */
# define accel_xlat_set(old, new) zend_hash_index_add_new_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old), (new))
# define accel_xlat_get(old) zend_hash_index_find_ptr(&ZCG(bind_hash), (zend_ulong)(zend_uintptr_t)(old))
#else

View File

@@ -2382,7 +2382,7 @@ static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key)
{
struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter;
if (I->key == (ulong)-1) {
if (I->key == (zend_ulong)-1) {
ZVAL_NULL(key);
} else {
ZVAL_LONG(key, I->key);
@@ -2402,7 +2402,7 @@ static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter)
PDO_FETCH_ORI_NEXT, 0, 0)) {
PDO_HANDLE_STMT_ERR();
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
ZVAL_UNDEF(&I->fetch_ahead);
return;
@@ -2439,7 +2439,7 @@ zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int
if (!do_fetch(stmt, 1, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT,
PDO_FETCH_ORI_NEXT, 0, 0)) {
PDO_HANDLE_STMT_ERR();
I->key = (ulong)-1;
I->key = (zend_ulong)-1;
ZVAL_UNDEF(&I->fetch_ahead);
}

View File

@@ -2864,7 +2864,7 @@ double_str:
}
} else {
zend_long low, high;
/* lstep is a ulong so that comparisons to it don't overflow, i.e. low - high < lstep */
/* lstep is a zend_ulong so that comparisons to it don't overflow, i.e. low - high < lstep */
zend_ulong lstep;
uint32_t i, size;
long_str:

View File

@@ -695,7 +695,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out
if (ZSTR_LEN(url_state->url_app.s) != 0) {
*handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0), url_state);
if (sizeof(uint) < sizeof(size_t)) {
if (sizeof(unsigned int) < sizeof(size_t)) {
if (len > UINT_MAX)
len = UINT_MAX;
}

View File

@@ -95,8 +95,6 @@
typedef int uid_t;
typedef int gid_t;
typedef char * caddr_t;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef int pid_t;
# ifndef PHP_DEBUG

View File

@@ -573,7 +573,7 @@ PHPDBG_API const phpdbg_command_t *phpdbg_stack_resolve(const phpdbg_command_t *
const phpdbg_command_t *command = commands;
phpdbg_param_t *name = *top;
const phpdbg_command_t *matched[3] = {NULL, NULL, NULL};
ulong matches = 0L;
zend_ulong matches = 0L;
while (command && command->name && command->handler) {
if (name->len == 1 || command->name_len >= name->len) {