mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
fixed compiler warnings
This commit is contained in:
parent
cb40015ffd
commit
be965f991f
@ -56,7 +56,7 @@ if test $PHP_UV != "no"; then
|
|||||||
fi
|
fi
|
||||||
PHP_ADD_INCLUDE([$ext_srcdir/libuv/include])
|
PHP_ADD_INCLUDE([$ext_srcdir/libuv/include])
|
||||||
|
|
||||||
CFLAGS=" $CFLAGS -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Wl,libuv/uv.a"
|
CFLAGS=" $CFLAGS -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Winline -Wunused-macros -Wredundant-decls -Wstrict-aliasing=2 -Wswitch-enum -Wdeclaration-after-statement -Wl,libuv/uv.a"
|
||||||
|
|
||||||
case $host in
|
case $host in
|
||||||
*darwin*)
|
*darwin*)
|
||||||
|
32
php_uv.c
32
php_uv.c
@ -159,7 +159,6 @@
|
|||||||
|
|
||||||
|
|
||||||
extern void php_uv_init(TSRMLS_D);
|
extern void php_uv_init(TSRMLS_D);
|
||||||
extern zend_class_entry *uv_class_entry;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uv_write_t req;
|
uv_write_t req;
|
||||||
@ -227,8 +226,6 @@ static char uv_fs_read_buf[8192];
|
|||||||
|
|
||||||
/* declarations */
|
/* declarations */
|
||||||
|
|
||||||
void php_uv_init(TSRMLS_D);
|
|
||||||
|
|
||||||
static inline uv_stream_t* php_uv_get_current_stream(php_uv_t *uv);
|
static inline uv_stream_t* php_uv_get_current_stream(php_uv_t *uv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -242,8 +239,6 @@ static inline uv_stream_t* php_uv_get_current_stream(php_uv_t *uv);
|
|||||||
*/
|
*/
|
||||||
static int php_uv_do_callback(zval **retval_ptr, zval *callback, zval ***params, int param_count TSRMLS_DC);
|
static int php_uv_do_callback(zval **retval_ptr, zval *callback, zval ***params, int param_count TSRMLS_DC);
|
||||||
|
|
||||||
static void php_uv_close_cb(uv_handle_t *handle);
|
|
||||||
|
|
||||||
void static destruct_uv(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
void static destruct_uv(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||||
|
|
||||||
static void php_uv_tcp_connect_cb(uv_connect_t *conn_req, int status);
|
static void php_uv_tcp_connect_cb(uv_connect_t *conn_req, int status);
|
||||||
@ -407,6 +402,9 @@ static inline int php_uv_common_init(php_uv_t **result, uv_loop_t *loop, enum ph
|
|||||||
uv->uv.check.data = uv;
|
uv->uv.check.data = uv;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpected type");
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
PHP_UV_INIT_ZVALS(uv)
|
PHP_UV_INIT_ZVALS(uv)
|
||||||
@ -456,6 +454,8 @@ static void php_uv_lock_init(enum php_uv_lock_type lock_type, INTERNAL_FUNCTION_
|
|||||||
|
|
||||||
switch (lock_type) {
|
switch (lock_type) {
|
||||||
case IS_UV_RWLOCK:
|
case IS_UV_RWLOCK:
|
||||||
|
case IS_UV_RWLOCK_WR:
|
||||||
|
case IS_UV_RWLOCK_RD:
|
||||||
{
|
{
|
||||||
PHP_UV_INIT_LOCK(lock, IS_UV_RWLOCK);
|
PHP_UV_INIT_LOCK(lock, IS_UV_RWLOCK);
|
||||||
error = uv_rwlock_init(PHP_UV_LOCK_RWLOCK_P(lock));
|
error = uv_rwlock_init(PHP_UV_LOCK_RWLOCK_P(lock));
|
||||||
@ -480,6 +480,9 @@ static void php_uv_lock_init(enum php_uv_lock_type lock_type, INTERNAL_FUNCTION_
|
|||||||
error = uv_sem_init(PHP_UV_LOCK_SEM_P(lock), val);
|
error = uv_sem_init(PHP_UV_LOCK_SEM_P(lock), val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpected type");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
@ -503,6 +506,7 @@ static void php_uv_lock_lock(enum php_uv_lock_type lock_type, INTERNAL_FUNCTION_
|
|||||||
ZEND_FETCH_RESOURCE(lock, php_uv_lock_t *, &handle, -1, PHP_UV_LOCK_RESOURCE_NAME, uv_lock_handle);
|
ZEND_FETCH_RESOURCE(lock, php_uv_lock_t *, &handle, -1, PHP_UV_LOCK_RESOURCE_NAME, uv_lock_handle);
|
||||||
|
|
||||||
switch (lock_type) {
|
switch (lock_type) {
|
||||||
|
case IS_UV_RWLOCK:
|
||||||
case IS_UV_RWLOCK_RD:
|
case IS_UV_RWLOCK_RD:
|
||||||
{
|
{
|
||||||
uv_rwlock_rdlock(PHP_UV_LOCK_RWLOCK_P(lock));
|
uv_rwlock_rdlock(PHP_UV_LOCK_RWLOCK_P(lock));
|
||||||
@ -526,6 +530,9 @@ static void php_uv_lock_lock(enum php_uv_lock_type lock_type, INTERNAL_FUNCTION_
|
|||||||
uv_sem_post(PHP_UV_LOCK_SEM_P(lock));
|
uv_sem_post(PHP_UV_LOCK_SEM_P(lock));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpected type");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,6 +549,7 @@ static void php_uv_lock_unlock(enum php_uv_lock_type lock_type, INTERNAL_FUNCTI
|
|||||||
ZEND_FETCH_RESOURCE(lock, php_uv_lock_t *, &handle, -1, PHP_UV_LOCK_RESOURCE_NAME, uv_lock_handle);
|
ZEND_FETCH_RESOURCE(lock, php_uv_lock_t *, &handle, -1, PHP_UV_LOCK_RESOURCE_NAME, uv_lock_handle);
|
||||||
|
|
||||||
switch (lock_type) {
|
switch (lock_type) {
|
||||||
|
case IS_UV_RWLOCK:
|
||||||
case IS_UV_RWLOCK_RD:
|
case IS_UV_RWLOCK_RD:
|
||||||
{
|
{
|
||||||
if (lock->locked == 0x01) {
|
if (lock->locked == 0x01) {
|
||||||
@ -571,6 +579,9 @@ static void php_uv_lock_unlock(enum php_uv_lock_type lock_type, INTERNAL_FUNCTI
|
|||||||
uv_sem_wait(PHP_UV_LOCK_SEM_P(lock));
|
uv_sem_wait(PHP_UV_LOCK_SEM_P(lock));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpected type");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,6 +599,7 @@ static void php_uv_lock_trylock(enum php_uv_lock_type lock_type, INTERNAL_FUNCTI
|
|||||||
ZEND_FETCH_RESOURCE(lock, php_uv_lock_t *, &handle, -1, PHP_UV_LOCK_RESOURCE_NAME, uv_lock_handle);
|
ZEND_FETCH_RESOURCE(lock, php_uv_lock_t *, &handle, -1, PHP_UV_LOCK_RESOURCE_NAME, uv_lock_handle);
|
||||||
|
|
||||||
switch(lock_type) {
|
switch(lock_type) {
|
||||||
|
case IS_UV_RWLOCK:
|
||||||
case IS_UV_RWLOCK_RD:
|
case IS_UV_RWLOCK_RD:
|
||||||
{
|
{
|
||||||
error = uv_rwlock_tryrdlock(PHP_UV_LOCK_RWLOCK_P(lock));
|
error = uv_rwlock_tryrdlock(PHP_UV_LOCK_RWLOCK_P(lock));
|
||||||
@ -628,6 +640,9 @@ static void php_uv_lock_trylock(enum php_uv_lock_type lock_type, INTERNAL_FUNCTI
|
|||||||
error = uv_sem_trywait(PHP_UV_LOCK_SEM_P(lock));
|
error = uv_sem_trywait(PHP_UV_LOCK_SEM_P(lock));
|
||||||
RETURN_LONG(error);
|
RETURN_LONG(error);
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpected type");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1480,6 +1495,8 @@ static void php_uv_fs_cb(uv_fs_t* req)
|
|||||||
efree(uv->buffer);
|
efree(uv->buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case UV_FS_UNKNOWN:
|
||||||
|
case UV_FS_CUSTOM:
|
||||||
default: {
|
default: {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "type; %d does not support yet.", uv->uv.fs.fs_type);
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "type; %d does not support yet.", uv->uv.fs.fs_type);
|
||||||
break;
|
break;
|
||||||
@ -2046,6 +2063,8 @@ static void php_uv_socket_bind(enum php_uv_socket_type ip_type, INTERNAL_FUNCTIO
|
|||||||
case PHP_UV_UDP_IPV6:
|
case PHP_UV_UDP_IPV6:
|
||||||
r = uv_udp_bind6((uv_udp_t*)&uv->uv.udp, PHP_UV_SOCKADDR_IPV6(addr), flags);
|
r = uv_udp_bind6((uv_udp_t*)&uv->uv.udp, PHP_UV_SOCKADDR_IPV6(addr), flags);
|
||||||
break;
|
break;
|
||||||
|
case PHP_UV_TCP:
|
||||||
|
case PHP_UV_UDP:
|
||||||
default:
|
default:
|
||||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unhandled type");
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unhandled type");
|
||||||
break;
|
break;
|
||||||
@ -2081,6 +2100,9 @@ static void php_uv_socket_getname(int type, INTERNAL_FUNCTION_PARAMETERS)
|
|||||||
case 3:
|
case 3:
|
||||||
error = uv_udp_getsockname(&uv->uv.udp, (struct sockaddr*)&addr, &addr_len);
|
error = uv_udp_getsockname(&uv->uv.udp, (struct sockaddr*)&addr, &addr_len);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpected type");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = php_uv_address_to_zval((struct sockaddr*)&addr);
|
result = php_uv_address_to_zval((struct sockaddr*)&addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user