From: Michael Wallner Date: Mon, 2 Mar 2015 18:55:28 +0000 (+0100) Subject: STATUS -> ZEND_RESULT_CODE X-Git-Tag: RELEASE_2_4_0~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=789f8205b16e89ce1982e4d492c7406e8ff66271;p=m6w6%2Fext-http STATUS -> ZEND_RESULT_CODE --- diff --git a/php_http_api.h b/php_http_api.h index ec18293..08b6ba8 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -41,9 +41,6 @@ # define PHP_HTTP_API extern #endif -/* make functions that return SUCCESS|FAILURE more obvious */ -typedef int STATUS; - #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV)) # define PHP_HTTP_HAVE_ICONV #endif diff --git a/php_http_client.c b/php_http_client.c index 4f0de3c..364903e 100644 --- a/php_http_client.c +++ b/php_http_client.c @@ -20,12 +20,12 @@ */ static HashTable php_http_client_drivers; -STATUS php_http_client_driver_add(php_http_client_driver_t *driver) +ZEND_RESULT_CODE php_http_client_driver_add(php_http_client_driver_t *driver) { return zend_hash_add(&php_http_client_drivers, driver->name_str, driver->name_len + 1, (void *) driver, sizeof(php_http_client_driver_t), NULL); } -STATUS php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver) +ZEND_RESULT_CODE php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver) { php_http_client_driver_t *tmp; @@ -216,7 +216,7 @@ void php_http_client_free(php_http_client_t **h) { } } -STATUS php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) +ZEND_RESULT_CODE php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) { TSRMLS_FETCH_FROM_CTX(h->ts); @@ -231,7 +231,7 @@ STATUS php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t * return FAILURE; } -STATUS php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request) +ZEND_RESULT_CODE php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request) { TSRMLS_FETCH_FROM_CTX(h->ts); @@ -267,7 +267,7 @@ php_http_client_enqueue_t *php_http_client_enqueued(php_http_client_t *h, void * return el ? (php_http_client_enqueue_t *) el->data : NULL; } -STATUS php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout) +ZEND_RESULT_CODE php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout) { if (h->ops->wait) { return h->ops->wait(h, custom_timeout); @@ -285,7 +285,7 @@ int php_http_client_once(php_http_client_t *h) return FAILURE; } -STATUS php_http_client_exec(php_http_client_t *h) +ZEND_RESULT_CODE php_http_client_exec(php_http_client_t *h) { if (h->ops->exec) { return h->ops->exec(h); @@ -304,7 +304,7 @@ void php_http_client_reset(php_http_client_t *h) zend_llist_clean(&h->responses); } -STATUS php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg) +ZEND_RESULT_CODE php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg) { if (h->ops->setopt) { return h->ops->setopt(h, opt, arg); @@ -313,7 +313,7 @@ STATUS php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t return FAILURE; } -STATUS php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr) +ZEND_RESULT_CODE php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr) { if (h->ops->getopt) { return h->ops->getopt(h, opt, arg, res_ptr); @@ -377,7 +377,7 @@ static void handle_history(zval *zclient, php_http_message_t *request, php_http_ zval_ptr_dtor(&new_hist); } -static STATUS handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **response) +static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **response) { zend_bool dequeue = 0; zval zclient; diff --git a/php_http_client.h b/php_http_client.h index 4008e87..f4a5b59 100644 --- a/php_http_client.h +++ b/php_http_client.h @@ -41,13 +41,13 @@ typedef struct php_http_client *(*php_http_client_init_func_t)(struct php_http_c typedef struct php_http_client *(*php_http_client_copy_func_t)(struct php_http_client *from, struct php_http_client *to); typedef void (*php_http_client_dtor_func_t)(struct php_http_client *p); typedef void (*php_http_client_reset_func_t)(struct php_http_client *p); -typedef STATUS (*php_http_client_exec_func_t)(struct php_http_client *p); +typedef ZEND_RESULT_CODE (*php_http_client_exec_func_t)(struct php_http_client *p); typedef int (*php_http_client_once_func_t)(struct php_http_client *p); -typedef STATUS (*php_http_client_wait_func_t)(struct php_http_client *p, struct timeval *custom_timeout); -typedef STATUS (*php_http_client_enqueue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); -typedef STATUS (*php_http_client_dequeue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); -typedef STATUS (*php_http_client_setopt_func_t)(struct php_http_client *p, php_http_client_setopt_opt_t opt, void *arg); -typedef STATUS (*php_http_client_getopt_func_t)(struct php_http_client *h, php_http_client_getopt_opt_t opt, void *arg, void **res); +typedef ZEND_RESULT_CODE (*php_http_client_wait_func_t)(struct php_http_client *p, struct timeval *custom_timeout); +typedef ZEND_RESULT_CODE (*php_http_client_enqueue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); +typedef ZEND_RESULT_CODE (*php_http_client_dequeue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue); +typedef ZEND_RESULT_CODE (*php_http_client_setopt_func_t)(struct php_http_client *p, php_http_client_setopt_opt_t opt, void *arg); +typedef ZEND_RESULT_CODE (*php_http_client_getopt_func_t)(struct php_http_client *h, php_http_client_getopt_opt_t opt, void *arg, void **res); typedef struct php_http_client_ops { php_resource_factory_ops_t *rsrc; @@ -70,8 +70,8 @@ typedef struct php_http_client_driver { php_http_client_ops_t *client_ops; } php_http_client_driver_t; -PHP_HTTP_API STATUS php_http_client_driver_add(php_http_client_driver_t *driver); -PHP_HTTP_API STATUS php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_driver_add(php_http_client_driver_t *driver); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver); typedef struct php_http_client_progress_state { struct { @@ -87,7 +87,7 @@ typedef struct php_http_client_progress_state { unsigned finished:1; } php_http_client_progress_state_t; -typedef STATUS (*php_http_client_response_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_message_t **response); +typedef ZEND_RESULT_CODE (*php_http_client_response_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_message_t **response); typedef void (*php_http_client_progress_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *state); typedef struct php_http_client { @@ -130,17 +130,17 @@ PHP_HTTP_API php_http_client_t *php_http_client_copy(php_http_client_t *from, ph PHP_HTTP_API void php_http_client_dtor(php_http_client_t *h); PHP_HTTP_API void php_http_client_free(php_http_client_t **h); -PHP_HTTP_API STATUS php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue); -PHP_HTTP_API STATUS php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request); -PHP_HTTP_API STATUS php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout); PHP_HTTP_API int php_http_client_once(php_http_client_t *h); -PHP_HTTP_API STATUS php_http_client_exec(php_http_client_t *h); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_exec(php_http_client_t *h); PHP_HTTP_API void php_http_client_reset(php_http_client_t *h); -PHP_HTTP_API STATUS php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg); -PHP_HTTP_API STATUS php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg); +PHP_HTTP_API ZEND_RESULT_CODE php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr); typedef int (*php_http_client_enqueue_cmp_func_t)(php_http_client_enqueue_t *cmp, void *arg); /* compare with request message pointer if compare_func is NULL */ diff --git a/php_http_client_curl.c b/php_http_client_curl.c index 44b2c21..18f1dec 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -314,7 +314,7 @@ static int php_http_curle_body_callback(char *data, size_t n, size_t l, void *ar return php_http_message_body_append(h->response.body, data, n*l); } -static STATUS php_http_curle_get_info(CURL *ch, HashTable *info) +static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info) { char *c; long l; @@ -812,7 +812,7 @@ static php_http_options_t php_http_curle_options, php_http_curlm_options; #define PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR 0x0002 #define PHP_HTTP_CURLE_OPTION_TRANSFORM_MS 0x0004 -static STATUS php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -823,7 +823,7 @@ static STATUS php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, z return SUCCESS; } -static STATUS php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -845,7 +845,7 @@ static STATUS php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval return SUCCESS; } -static STATUS php_http_curle_option_set_cookies(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_cookies(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -892,7 +892,7 @@ static STATUS php_http_curle_option_set_cookies(php_http_option_t *opt, zval *va return SUCCESS; } -static STATUS php_http_curle_option_set_encodecookies(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_encodecookies(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; @@ -900,7 +900,7 @@ static STATUS php_http_curle_option_set_encodecookies(php_http_option_t *opt, zv return SUCCESS; } -static STATUS php_http_curle_option_set_lastmodified(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_lastmodified(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -929,7 +929,7 @@ static STATUS php_http_curle_option_set_lastmodified(php_http_option_t *opt, zva return SUCCESS; } -static STATUS php_http_curle_option_set_compress(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_compress(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -943,7 +943,7 @@ static STATUS php_http_curle_option_set_compress(php_http_option_t *opt, zval *v return SUCCESS; } -static STATUS php_http_curle_option_set_etag(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_etag(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; php_http_buffer_t header; @@ -959,7 +959,7 @@ static STATUS php_http_curle_option_set_etag(php_http_option_t *opt, zval *val, return SUCCESS; } -static STATUS php_http_curle_option_set_range(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_range(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -1003,7 +1003,7 @@ static STATUS php_http_curle_option_set_range(php_http_option_t *opt, zval *val, return SUCCESS; } -static STATUS php_http_curle_option_set_resume(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_resume(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -1017,7 +1017,7 @@ static STATUS php_http_curle_option_set_resume(php_http_option_t *opt, zval *val return SUCCESS; } -static STATUS php_http_curle_option_set_retrydelay(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_retrydelay(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; @@ -1025,7 +1025,7 @@ static STATUS php_http_curle_option_set_retrydelay(php_http_option_t *opt, zval return SUCCESS; } -static STATUS php_http_curle_option_set_retrycount(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_retrycount(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; @@ -1033,7 +1033,7 @@ static STATUS php_http_curle_option_set_retrycount(php_http_option_t *opt, zval return SUCCESS; } -static STATUS php_http_curle_option_set_redirect(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_redirect(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -1046,7 +1046,7 @@ static STATUS php_http_curle_option_set_redirect(php_http_option_t *opt, zval *v return SUCCESS; } -static STATUS php_http_curle_option_set_portrange(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_portrange(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -1085,7 +1085,7 @@ static STATUS php_http_curle_option_set_portrange(php_http_option_t *opt, zval * } #if PHP_HTTP_CURL_VERSION(7,37,0) -static STATUS php_http_curle_option_set_proxyheader(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_proxyheader(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; TSRMLS_FETCH_FROM_CTX(curl->client->ts); @@ -1122,7 +1122,7 @@ static STATUS php_http_curle_option_set_proxyheader(php_http_option_t *opt, zval #endif #if PHP_HTTP_CURL_VERSION(7,21,3) -static STATUS php_http_curle_option_set_resolve(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_resolve(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -1152,7 +1152,7 @@ static STATUS php_http_curle_option_set_resolve(php_http_option_t *opt, zval *va #endif #if PHP_HTTP_CURL_VERSION(7,21,4) && defined(PHP_HTTP_CURL_TLSAUTH_SRP) -static STATUS php_http_curle_option_set_ssl_tlsauthtype(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_option_set_ssl_tlsauthtype(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; @@ -1499,13 +1499,13 @@ static zval *php_http_curle_get_option(php_http_option_t *opt, HashTable *option return option; } -static STATUS php_http_curle_set_option(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curle_set_option(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_curl_handler_t *curl = userdata; CURL *ch = curl->handle; zval tmp; CURLcode rc = CURLE_OK; - STATUS rv = SUCCESS; + ZEND_RESULT_CODE rv = SUCCESS; TSRMLS_FETCH_FROM_CTX(curl->client->ts); if (!val) { @@ -1581,7 +1581,7 @@ static STATUS php_http_curle_set_option(php_http_option_t *opt, zval *val, void } #if PHP_HTTP_CURL_VERSION(7,30,0) -static STATUS php_http_curlm_option_set_pipelining_bl(php_http_option_t *opt, zval *value, void *userdata) +static ZEND_RESULT_CODE php_http_curlm_option_set_pipelining_bl(php_http_option_t *opt, zval *value, void *userdata) { php_http_client_t *client = userdata; php_http_client_curl_t *curl = client->ctx; @@ -1625,7 +1625,7 @@ static STATUS php_http_curlm_option_set_pipelining_bl(php_http_option_t *opt, zv #endif #if PHP_HTTP_HAVE_EVENT -static inline STATUS php_http_curlm_use_eventloop(php_http_client_t *h, zend_bool enable) +static inline ZEND_RESULT_CODE php_http_curlm_use_eventloop(php_http_client_t *h, zend_bool enable) { php_http_client_curl_t *curl = h->ctx; @@ -1650,7 +1650,7 @@ static inline STATUS php_http_curlm_use_eventloop(php_http_client_t *h, zend_boo return SUCCESS; } -static STATUS php_http_curlm_option_set_use_eventloop(php_http_option_t *opt, zval *value, void *userdata) +static ZEND_RESULT_CODE php_http_curlm_option_set_use_eventloop(php_http_option_t *opt, zval *value, void *userdata) { php_http_client_t *client = userdata; @@ -1711,14 +1711,14 @@ static void php_http_curlm_options_init(php_http_options_t *registry TSRMLS_DC) #endif } -static STATUS php_http_curlm_set_option(php_http_option_t *opt, zval *val, void *userdata) +static ZEND_RESULT_CODE php_http_curlm_set_option(php_http_option_t *opt, zval *val, void *userdata) { php_http_client_t *client = userdata; php_http_client_curl_t *curl = client->ctx; CURLM *ch = curl->handle; zval *orig = val; CURLMcode rc = CURLM_UNKNOWN_OPTION; - STATUS rv = SUCCESS; + ZEND_RESULT_CODE rv = SUCCESS; TSRMLS_FETCH_FROM_CTX(client->ts); if (!val) { @@ -1759,7 +1759,7 @@ static STATUS php_http_curlm_set_option(php_http_option_t *opt, zval *val, void /* client ops */ -static STATUS php_http_client_curl_handler_reset(php_http_client_curl_handler_t *curl) +static ZEND_RESULT_CODE php_http_client_curl_handler_reset(php_http_client_curl_handler_t *curl) { CURL *ch = curl->handle; php_http_curle_storage_t *st; @@ -1865,7 +1865,7 @@ static php_http_client_curl_handler_t *php_http_client_curl_handler_init(php_htt } -static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_t *curl, php_http_client_enqueue_t *enqueue) +static ZEND_RESULT_CODE php_http_client_curl_handler_prepare(php_http_client_curl_handler_t *curl, php_http_client_enqueue_t *enqueue) { size_t body_size; php_http_message_t *msg = enqueue->request; @@ -2105,7 +2105,7 @@ static php_resource_factory_t *create_rf(php_http_client_t *h, php_http_client_e return rf; } -static STATUS php_http_client_curl_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) +static ZEND_RESULT_CODE php_http_client_curl_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) { CURLMcode rs; php_http_client_curl_t *curl = h->ctx; @@ -2150,7 +2150,7 @@ static STATUS php_http_client_curl_enqueue(php_http_client_t *h, php_http_client } } -static STATUS php_http_client_curl_dequeue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) +static ZEND_RESULT_CODE php_http_client_curl_dequeue(php_http_client_t *h, php_http_client_enqueue_t *enqueue) { CURLMcode rs; php_http_client_curl_t *curl = h->ctx; @@ -2195,7 +2195,7 @@ static inline void php_http_client_curl_get_timeout(php_http_client_curl_t *curl # define SELECT_ERROR -1 #endif -static STATUS php_http_client_curl_wait(php_http_client_t *h, struct timeval *custom_timeout) +static ZEND_RESULT_CODE php_http_client_curl_wait(php_http_client_t *h, struct timeval *custom_timeout) { int MAX; fd_set R, W, E; @@ -2257,7 +2257,7 @@ static int php_http_client_curl_once(php_http_client_t *h) } -static STATUS php_http_client_curl_exec(php_http_client_t *h) +static ZEND_RESULT_CODE php_http_client_curl_exec(php_http_client_t *h) { #if PHP_HTTP_HAVE_EVENT php_http_client_curl_t *curl = h->ctx; @@ -2298,7 +2298,7 @@ static STATUS php_http_client_curl_exec(php_http_client_t *h) return SUCCESS; } -static STATUS php_http_client_curl_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg) +static ZEND_RESULT_CODE php_http_client_curl_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg) { php_http_client_curl_t *curl = h->ctx; @@ -2358,7 +2358,7 @@ static int apply_available_options(void *pDest TSRMLS_DC, int num_args, va_list return ZEND_HASH_APPLY_KEEP; } -static STATUS php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void **res) +static ZEND_RESULT_CODE php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void **res) { php_http_client_enqueue_t *enqueue; TSRMLS_FETCH_FROM_CTX(h->ts); diff --git a/php_http_encoding.c b/php_http_encoding.c index b7050f6..286f2b5 100644 --- a/php_http_encoding.c +++ b/php_http_encoding.c @@ -148,7 +148,7 @@ static inline int php_http_inflate_rounds(z_stream *Z, int flush, char **buf, si return status; } -STATUS php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len TSRMLS_DC) +ZEND_RESULT_CODE php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len TSRMLS_DC) { int status, level, wbits, strategy; z_stream Z; @@ -189,7 +189,7 @@ STATUS php_http_encoding_deflate(int flags, const char *data, size_t data_len, c return FAILURE; } -STATUS php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len TSRMLS_DC) +ZEND_RESULT_CODE php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len TSRMLS_DC) { z_stream Z; int status, wbits = PHP_HTTP_WINDOW_BITS_ANY; @@ -290,7 +290,7 @@ php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stre return NULL; } -STATUS php_http_encoding_stream_reset(php_http_encoding_stream_t **s) +ZEND_RESULT_CODE php_http_encoding_stream_reset(php_http_encoding_stream_t **s) { php_http_encoding_stream_t *ss; if ((*s)->ops->dtor) { @@ -303,7 +303,7 @@ STATUS php_http_encoding_stream_reset(php_http_encoding_stream_t **s) return FAILURE; } -STATUS php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len) +ZEND_RESULT_CODE php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len) { if (!s->ops->update) { return FAILURE; @@ -311,7 +311,7 @@ STATUS php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char return s->ops->update(s, in_str, in_len, out_str, out_len); } -STATUS php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *out_len) +ZEND_RESULT_CODE php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *out_len) { if (!s->ops->flush) { *out_str = NULL; @@ -329,7 +329,7 @@ zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t *s) return s->ops->done(s); } -STATUS php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *out_len) +ZEND_RESULT_CODE php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *out_len) { if (!s->ops->finish) { *out_str = NULL; @@ -478,7 +478,7 @@ static php_http_encoding_stream_t *dechunk_copy(php_http_encoding_stream_t *from return NULL; } -static STATUS deflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **encoded, size_t *encoded_len) +static ZEND_RESULT_CODE deflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **encoded, size_t *encoded_len) { int status; z_streamp ctx = s->ctx; @@ -519,7 +519,7 @@ static STATUS deflate_update(php_http_encoding_stream_t *s, const char *data, si return FAILURE; } -static STATUS inflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len) +static ZEND_RESULT_CODE inflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len) { int status; z_streamp ctx = s->ctx; @@ -558,7 +558,7 @@ retry_raw_inflate: return FAILURE; } -static STATUS dechunk_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len) +static ZEND_RESULT_CODE dechunk_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len) { php_http_buffer_t tmp; struct dechunk_ctx *ctx = s->ctx; @@ -686,7 +686,7 @@ static STATUS dechunk_update(php_http_encoding_stream_t *s, const char *data, si return SUCCESS; } -static STATUS deflate_flush(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len) +static ZEND_RESULT_CODE deflate_flush(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len) { int status; z_streamp ctx = s->ctx; @@ -715,7 +715,7 @@ static STATUS deflate_flush(php_http_encoding_stream_t *s, char **encoded, size_ return FAILURE; } -static STATUS dechunk_flush(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len) +static ZEND_RESULT_CODE dechunk_flush(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len) { struct dechunk_ctx *ctx = s->ctx; @@ -735,7 +735,7 @@ static STATUS dechunk_flush(php_http_encoding_stream_t *s, char **decoded, size_ return SUCCESS; } -static STATUS deflate_finish(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len) +static ZEND_RESULT_CODE deflate_finish(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len) { int status; z_streamp ctx = s->ctx; @@ -772,7 +772,7 @@ static STATUS deflate_finish(php_http_encoding_stream_t *s, char **encoded, size return FAILURE; } -static STATUS inflate_finish(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len) +static ZEND_RESULT_CODE inflate_finish(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len) { int status; z_streamp ctx = s->ctx; diff --git a/php_http_encoding.h b/php_http_encoding.h index 59bbd27..cdf7a1a 100644 --- a/php_http_encoding.h +++ b/php_http_encoding.h @@ -125,10 +125,10 @@ typedef struct php_http_encoding_stream php_http_encoding_stream_t; typedef php_http_encoding_stream_t *(*php_http_encoding_stream_init_func_t)(php_http_encoding_stream_t *s); typedef php_http_encoding_stream_t *(*php_http_encoding_stream_copy_func_t)(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to); -typedef STATUS (*php_http_encoding_stream_update_func_t)(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len); -typedef STATUS (*php_http_encoding_stream_flush_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len); +typedef ZEND_RESULT_CODE (*php_http_encoding_stream_update_func_t)(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len); +typedef ZEND_RESULT_CODE (*php_http_encoding_stream_flush_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len); typedef zend_bool (*php_http_encoding_stream_done_func_t)(php_http_encoding_stream_t *s); -typedef STATUS (*php_http_encoding_stream_finish_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len); +typedef ZEND_RESULT_CODE (*php_http_encoding_stream_finish_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len); typedef void (*php_http_encoding_stream_dtor_func_t)(php_http_encoding_stream_t *s); typedef struct php_http_encoding_stream_ops { @@ -156,17 +156,17 @@ PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechun PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stream_t *s, php_http_encoding_stream_ops_t *ops, unsigned flags TSRMLS_DC); PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to); -PHP_HTTP_API STATUS php_http_encoding_stream_reset(php_http_encoding_stream_t **s); -PHP_HTTP_API STATUS php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len); -PHP_HTTP_API STATUS php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *len); +PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_reset(php_http_encoding_stream_t **s); +PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len); +PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *len); PHP_HTTP_API zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t *s); -PHP_HTTP_API STATUS php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *len); +PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *len); PHP_HTTP_API void php_http_encoding_stream_dtor(php_http_encoding_stream_t *s); PHP_HTTP_API void php_http_encoding_stream_free(php_http_encoding_stream_t **s); PHP_HTTP_API const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len TSRMLS_DC); -PHP_HTTP_API STATUS php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len TSRMLS_DC); -PHP_HTTP_API STATUS php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len TSRMLS_DC); typedef struct php_http_encoding_stream_object { zend_object zo; diff --git a/php_http_env.c b/php_http_env.c index f06769c..c60d4c0 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -368,9 +368,9 @@ static void grab_headers(void *data, void *arg TSRMLS_DC) php_http_buffer_appends(PHP_HTTP_BUFFER(arg), PHP_HTTP_CRLF); } -STATUS php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC) { - STATUS status; + ZEND_RESULT_CODE status; php_http_buffer_t headers; php_http_buffer_init(&headers); @@ -413,15 +413,15 @@ long php_http_env_get_response_code(TSRMLS_D) return code ? code : 200; } -STATUS php_http_env_set_response_code(long http_code TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_set_response_code(long http_code TSRMLS_DC) { return sapi_header_op(SAPI_HEADER_SET_STATUS, (void *) http_code TSRMLS_CC); } -STATUS php_http_env_set_response_status_line(long code, php_http_version_t *v TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_set_response_status_line(long code, php_http_version_t *v TSRMLS_DC) { sapi_header_line h = {NULL, 0, 0}; - STATUS ret; + ZEND_RESULT_CODE ret; h.line_len = spprintf(&h.line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code)); ret = sapi_header_op(SAPI_HEADER_REPLACE, (void *) &h TSRMLS_CC); @@ -430,22 +430,22 @@ STATUS php_http_env_set_response_status_line(long code, php_http_version_t *v TS return ret; } -STATUS php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC) { return php_http_env_set_response_status_line(php_http_env_get_response_code(TSRMLS_C), v TSRMLS_CC); } -STATUS php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC) { sapi_header_line h = {estrndup(header_str, header_len), header_len, http_code}; - STATUS ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h TSRMLS_CC); + ZEND_RESULT_CODE ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h TSRMLS_CC); efree(h.line); return ret; } -STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC) { - STATUS ret = FAILURE; + ZEND_RESULT_CODE ret = FAILURE; sapi_header_line h = {NULL, 0, http_code}; h.line_len = vspprintf(&h.line, 0, fmt, argv); @@ -459,9 +459,9 @@ STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, co return ret; } -STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...) +ZEND_RESULT_CODE php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...) { - STATUS ret; + ZEND_RESULT_CODE ret; va_list args; va_start(args, fmt); @@ -471,7 +471,7 @@ STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace return ret; } -STATUS php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC) +ZEND_RESULT_CODE php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC) { if (!value) { sapi_header_line h = {(char *) name_str, name_len, http_code}; @@ -500,7 +500,7 @@ STATUS php_http_env_set_response_header_value(long http_code, const char *name_s return php_http_env_set_response_header_value(http_code, name_str, name_len, NULL, replace TSRMLS_CC); } else { sapi_header_line h; - STATUS ret; + ZEND_RESULT_CODE ret; if (name_len > INT_MAX) { name_len = INT_MAX; diff --git a/php_http_env.h b/php_http_env.h index 3b8d87f..3fc80ab 100644 --- a/php_http_env.h +++ b/php_http_env.h @@ -58,14 +58,14 @@ typedef enum php_http_cache_status { PHP_HTTP_API long php_http_env_get_response_code(TSRMLS_D); PHP_HTTP_API const char *php_http_env_get_response_status_for_code(unsigned code); -PHP_HTTP_API STATUS php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC); PHP_HTTP_API char *php_http_env_get_response_header(const char *name_str, size_t name_len TSRMLS_DC); -PHP_HTTP_API STATUS php_http_env_set_response_code(long http_code TSRMLS_DC); -PHP_HTTP_API STATUS php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC); -PHP_HTTP_API STATUS php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC); -PHP_HTTP_API STATUS php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC); -PHP_HTTP_API STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...); -PHP_HTTP_API STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_code(long http_code TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC); PHP_HTTP_API zval *php_http_env_get_server_var(const char *key_str, size_t key_len, zend_bool check TSRMLS_DC); #define php_http_env_got_server_var(v) (NULL != php_http_env_get_server_var((v), strlen(v), 1 TSRMLS_CC)) diff --git a/php_http_env_response.c b/php_http_env_response.c index 0bcc21d..67a6d58 100644 --- a/php_http_env_response.c +++ b/php_http_env_response.c @@ -263,7 +263,7 @@ static size_t output(void *context, char *buf, size_t len TSRMLS_DC) } #define php_http_env_response_send_done(r) php_http_env_response_send_data((r), NULL, 0) -static STATUS php_http_env_response_send_data(php_http_env_response_t *r, const char *buf, size_t len) +static ZEND_RESULT_CODE php_http_env_response_send_data(php_http_env_response_t *r, const char *buf, size_t len) { size_t chunks_sent, chunk = r->throttle.chunk ? r->throttle.chunk : PHP_HTTP_SENDBUF_SIZE; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -351,9 +351,9 @@ void php_http_env_response_free(php_http_env_response_t **r) } } -static STATUS php_http_env_response_send_head(php_http_env_response_t *r, php_http_message_t *request) +static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t *r, php_http_message_t *request) { - STATUS ret = SUCCESS; + ZEND_RESULT_CODE ret = SUCCESS; zval *zoption, *options = r->options; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -608,9 +608,9 @@ static STATUS php_http_env_response_send_head(php_http_env_response_t *r, php_ht return ret; } -static STATUS php_http_env_response_send_body(php_http_env_response_t *r) +static ZEND_RESULT_CODE php_http_env_response_send_body(php_http_env_response_t *r) { - STATUS ret = SUCCESS; + ZEND_RESULT_CODE ret = SUCCESS; zval *zoption; php_http_message_body_t *body; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -696,7 +696,7 @@ static STATUS php_http_env_response_send_body(php_http_env_response_t *r) return ret; } -STATUS php_http_env_response_send(php_http_env_response_t *r) +ZEND_RESULT_CODE php_http_env_response_send(php_http_env_response_t *r) { php_http_message_t *request; php_http_message_body_t *body; @@ -784,21 +784,21 @@ static long php_http_env_response_sapi_get_status(php_http_env_response_t *r) return php_http_env_get_response_code(TSRMLS_C); } -static STATUS php_http_env_response_sapi_set_status(php_http_env_response_t *r, long http_code) +static ZEND_RESULT_CODE php_http_env_response_sapi_set_status(php_http_env_response_t *r, long http_code) { TSRMLS_FETCH_FROM_CTX(r->ts); return php_http_env_set_response_code(http_code TSRMLS_CC); } -static STATUS php_http_env_response_sapi_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v) +static ZEND_RESULT_CODE php_http_env_response_sapi_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v) { TSRMLS_FETCH_FROM_CTX(r->ts); return php_http_env_set_response_protocol_version(v TSRMLS_CC); } -static STATUS php_http_env_response_sapi_set_header(php_http_env_response_t *r, const char *fmt, ...) +static ZEND_RESULT_CODE php_http_env_response_sapi_set_header(php_http_env_response_t *r, const char *fmt, ...) { - STATUS ret; + ZEND_RESULT_CODE ret; va_list args; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -808,9 +808,9 @@ static STATUS php_http_env_response_sapi_set_header(php_http_env_response_t *r, return ret; } -static STATUS php_http_env_response_sapi_add_header(php_http_env_response_t *r, const char *fmt, ...) +static ZEND_RESULT_CODE php_http_env_response_sapi_add_header(php_http_env_response_t *r, const char *fmt, ...) { - STATUS ret; + ZEND_RESULT_CODE ret; va_list args; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -820,13 +820,13 @@ static STATUS php_http_env_response_sapi_add_header(php_http_env_response_t *r, return ret; } -static STATUS php_http_env_response_sapi_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len) +static ZEND_RESULT_CODE php_http_env_response_sapi_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len) { TSRMLS_FETCH_FROM_CTX(r->ts); return php_http_env_set_response_header_value(0, header_str, header_len, NULL, 1 TSRMLS_CC); } -static STATUS php_http_env_response_sapi_write(php_http_env_response_t *r, const char *data_str, size_t data_len) +static ZEND_RESULT_CODE php_http_env_response_sapi_write(php_http_env_response_t *r, const char *data_str, size_t data_len) { TSRMLS_FETCH_FROM_CTX(r->ts); @@ -835,7 +835,7 @@ static STATUS php_http_env_response_sapi_write(php_http_env_response_t *r, const } return FAILURE; } -static STATUS php_http_env_response_sapi_flush(php_http_env_response_t *r) +static ZEND_RESULT_CODE php_http_env_response_sapi_flush(php_http_env_response_t *r) { TSRMLS_FETCH_FROM_CTX(r->ts); @@ -853,7 +853,7 @@ static STATUS php_http_env_response_sapi_flush(php_http_env_response_t *r) return SUCCESS; } -static STATUS php_http_env_response_sapi_finish(php_http_env_response_t *r) +static ZEND_RESULT_CODE php_http_env_response_sapi_finish(php_http_env_response_t *r) { return SUCCESS; } @@ -891,7 +891,7 @@ typedef struct php_http_env_response_stream_ctx { unsigned chunked:1; } php_http_env_response_stream_ctx_t; -static STATUS php_http_env_response_stream_init(php_http_env_response_t *r, void *init_arg) +static ZEND_RESULT_CODE php_http_env_response_stream_init(php_http_env_response_t *r, void *init_arg) { php_http_env_response_stream_ctx_t *ctx; size_t buffer_size = 0x1000; @@ -956,7 +956,7 @@ static void php_http_env_response_stream_header(php_http_env_response_stream_ctx } } } -static STATUS php_http_env_response_stream_start(php_http_env_response_stream_ctx_t *ctx TSRMLS_DC) +static ZEND_RESULT_CODE php_http_env_response_stream_start(php_http_env_response_stream_ctx_t *ctx TSRMLS_DC) { php_http_buffer_t header_buf; @@ -1003,7 +1003,7 @@ static long php_http_env_response_stream_get_status(php_http_env_response_t *r) return ctx->status_code; } -static STATUS php_http_env_response_stream_set_status(php_http_env_response_t *r, long http_code) +static ZEND_RESULT_CODE php_http_env_response_stream_set_status(php_http_env_response_t *r, long http_code) { php_http_env_response_stream_ctx_t *stream_ctx = r->ctx; @@ -1015,7 +1015,7 @@ static STATUS php_http_env_response_stream_set_status(php_http_env_response_t *r return SUCCESS; } -static STATUS php_http_env_response_stream_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v) +static ZEND_RESULT_CODE php_http_env_response_stream_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v) { php_http_env_response_stream_ctx_t *stream_ctx = r->ctx; @@ -1027,7 +1027,7 @@ static STATUS php_http_env_response_stream_set_protocol_version(php_http_env_res return SUCCESS; } -static STATUS php_http_env_response_stream_set_header_ex(php_http_env_response_t *r, zend_bool replace, const char *fmt, va_list argv) +static ZEND_RESULT_CODE php_http_env_response_stream_set_header_ex(php_http_env_response_t *r, zend_bool replace, const char *fmt, va_list argv) { php_http_env_response_stream_ctx_t *stream_ctx = r->ctx; char *header_end, *header_str = NULL; @@ -1064,9 +1064,9 @@ static STATUS php_http_env_response_stream_set_header_ex(php_http_env_response_t return SUCCESS; } } -static STATUS php_http_env_response_stream_set_header(php_http_env_response_t *r, const char *fmt, ...) +static ZEND_RESULT_CODE php_http_env_response_stream_set_header(php_http_env_response_t *r, const char *fmt, ...) { - STATUS ret; + ZEND_RESULT_CODE ret; va_list argv; va_start(argv, fmt); @@ -1075,9 +1075,9 @@ static STATUS php_http_env_response_stream_set_header(php_http_env_response_t *r return ret; } -static STATUS php_http_env_response_stream_add_header(php_http_env_response_t *r, const char *fmt, ...) +static ZEND_RESULT_CODE php_http_env_response_stream_add_header(php_http_env_response_t *r, const char *fmt, ...) { - STATUS ret; + ZEND_RESULT_CODE ret; va_list argv; va_start(argv, fmt); @@ -1086,7 +1086,7 @@ static STATUS php_http_env_response_stream_add_header(php_http_env_response_t *r return ret; } -static STATUS php_http_env_response_stream_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len) +static ZEND_RESULT_CODE php_http_env_response_stream_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len) { php_http_env_response_stream_ctx_t *stream_ctx = r->ctx; @@ -1097,7 +1097,7 @@ static STATUS php_http_env_response_stream_del_header(php_http_env_response_t *r zend_hash_del(&stream_ctx->header, header_str, header_len + 1); return SUCCESS; } -static STATUS php_http_env_response_stream_write(php_http_env_response_t *r, const char *data_str, size_t data_len) +static ZEND_RESULT_CODE php_http_env_response_stream_write(php_http_env_response_t *r, const char *data_str, size_t data_len) { php_http_env_response_stream_ctx_t *stream_ctx = r->ctx; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -1117,7 +1117,7 @@ static STATUS php_http_env_response_stream_write(php_http_env_response_t *r, con return SUCCESS; } -static STATUS php_http_env_response_stream_flush(php_http_env_response_t *r) +static ZEND_RESULT_CODE php_http_env_response_stream_flush(php_http_env_response_t *r) { php_http_env_response_stream_ctx_t *stream_ctx = r->ctx; TSRMLS_FETCH_FROM_CTX(r->ts); @@ -1133,7 +1133,7 @@ static STATUS php_http_env_response_stream_flush(php_http_env_response_t *r) return php_stream_flush(stream_ctx->stream); } -static STATUS php_http_env_response_stream_finish(php_http_env_response_t *r) +static ZEND_RESULT_CODE php_http_env_response_stream_finish(php_http_env_response_t *r) { php_http_env_response_stream_ctx_t *ctx = r->ctx; TSRMLS_FETCH_FROM_CTX(r->ts); diff --git a/php_http_env_response.h b/php_http_env_response.h index b672930..e6a112f 100644 --- a/php_http_env_response.h +++ b/php_http_env_response.h @@ -16,17 +16,17 @@ typedef struct php_http_env_response php_http_env_response_t; typedef struct php_http_env_response_ops { - STATUS (*init)(php_http_env_response_t *r, void *arg); + ZEND_RESULT_CODE (*init)(php_http_env_response_t *r, void *arg); void (*dtor)(php_http_env_response_t *r); long (*get_status)(php_http_env_response_t *r); - STATUS (*set_status)(php_http_env_response_t *r, long http_code); - STATUS (*set_protocol_version)(php_http_env_response_t *r, php_http_version_t *v); - STATUS (*set_header)(php_http_env_response_t *r, const char *fmt, ...); - STATUS (*add_header)(php_http_env_response_t *r, const char *fmt, ...); - STATUS (*del_header)(php_http_env_response_t *r, const char *header_str, size_t header_len); - STATUS (*write)(php_http_env_response_t *r, const char *data_str, size_t data_len); - STATUS (*flush)(php_http_env_response_t *r); - STATUS (*finish)(php_http_env_response_t *r); + ZEND_RESULT_CODE (*set_status)(php_http_env_response_t *r, long http_code); + ZEND_RESULT_CODE (*set_protocol_version)(php_http_env_response_t *r, php_http_version_t *v); + ZEND_RESULT_CODE (*set_header)(php_http_env_response_t *r, const char *fmt, ...); + ZEND_RESULT_CODE (*add_header)(php_http_env_response_t *r, const char *fmt, ...); + ZEND_RESULT_CODE (*del_header)(php_http_env_response_t *r, const char *header_str, size_t header_len); + ZEND_RESULT_CODE (*write)(php_http_env_response_t *r, const char *data_str, size_t data_len); + ZEND_RESULT_CODE (*flush)(php_http_env_response_t *r); + ZEND_RESULT_CODE (*finish)(php_http_env_response_t *r); } php_http_env_response_ops_t; PHP_HTTP_API php_http_env_response_ops_t *php_http_env_response_get_sapi_ops(void); @@ -67,7 +67,7 @@ struct php_http_env_response { }; PHP_HTTP_API php_http_env_response_t *php_http_env_response_init(php_http_env_response_t *r, zval *options, php_http_env_response_ops_t *ops, void *ops_ctx TSRMLS_DC); -PHP_HTTP_API STATUS php_http_env_response_send(php_http_env_response_t *r); +PHP_HTTP_API ZEND_RESULT_CODE php_http_env_response_send(php_http_env_response_t *r); PHP_HTTP_API void php_http_env_response_dtor(php_http_env_response_t *r); PHP_HTTP_API void php_http_env_response_free(php_http_env_response_t **r); diff --git a/php_http_header.c b/php_http_header.c index 5a9ecd3..41601df 100644 --- a/php_http_header.c +++ b/php_http_header.c @@ -12,7 +12,7 @@ #include "php_http_api.h" -STATUS php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC) +ZEND_RESULT_CODE php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC) { php_http_header_parser_t ctx; php_http_buffer_t buf; diff --git a/php_http_header.h b/php_http_header.h index d420e3f..a2baecb 100644 --- a/php_http_header.h +++ b/php_http_header.h @@ -15,7 +15,7 @@ #include "php_http_info.h" -PHP_HTTP_API STATUS php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC); PHP_HTTP_API void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg TSRMLS_DC); PHP_HTTP_API void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS_DC); diff --git a/php_http_header_parser.c b/php_http_header_parser.c index f5b88f4..2fbcb93 100644 --- a/php_http_header_parser.c +++ b/php_http_header_parser.c @@ -115,7 +115,7 @@ static void php_http_header_parser_error(size_t valid_len, char *str, size_t len efree(escaped_str); } -STATUS php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_buffer_t *buffer, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg) +php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_buffer_t *buffer, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg) { TSRMLS_FETCH_FROM_CTX(parser->ts); diff --git a/php_http_message.c b/php_http_message.c index b7b500b..3b19a8c 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -543,11 +543,11 @@ typedef struct php_http_message_object_prophandler { php_http_message_object_prophandler_func_t write; } php_http_message_object_prophandler_t; -static STATUS php_http_message_object_add_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_func_t read, php_http_message_object_prophandler_func_t write) { +static ZEND_RESULT_CODE php_http_message_object_add_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_func_t read, php_http_message_object_prophandler_func_t write) { php_http_message_object_prophandler_t h = { read, write }; return zend_hash_add(&php_http_message_object_prophandlers, prop_str, prop_len + 1, (void *) &h, sizeof(h), NULL); } -static STATUS php_http_message_object_get_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_t **handler) { +static ZEND_RESULT_CODE php_http_message_object_get_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_t **handler) { return zend_hash_find(&php_http_message_object_prophandlers, prop_str, prop_len + 1, (void *) handler); } static void php_http_message_object_prophandler_get_type(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) { @@ -753,7 +753,7 @@ void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool to } } -STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval *zbody TSRMLS_DC) +ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval *zbody TSRMLS_DC) { zval *tmp = NULL; php_stream *s; @@ -819,7 +819,7 @@ STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval return SUCCESS; } -STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj) +ZEND_RESULT_CODE php_http_message_object_init_body_object(php_http_message_object_t *obj) { TSRMLS_FETCH_FROM_CTX(obj->message->ts); diff --git a/php_http_message.h b/php_http_message.h index 6524a27..780ea68 100644 --- a/php_http_message.h +++ b/php_http_message.h @@ -82,8 +82,8 @@ PHP_MSHUTDOWN_FUNCTION(http_message); void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top /* = 1 */ TSRMLS_DC); void php_http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_DC); -STATUS php_http_message_object_set_body(php_http_message_object_t *obj, zval *zbody TSRMLS_DC); -STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj); +ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *obj, zval *zbody TSRMLS_DC); +ZEND_RESULT_CODE php_http_message_object_init_body_object(php_http_message_object_t *obj); zend_object_value php_http_message_object_new(zend_class_entry *ce TSRMLS_DC); zend_object_value php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg, php_http_message_object_t **ptr TSRMLS_DC); diff --git a/php_http_message_body.c b/php_http_message_body.c index fa91551..c80c238 100644 --- a/php_http_message_body.c +++ b/php_http_message_body.c @@ -28,8 +28,8 @@ #define BOUNDARY_CLOSE(body) \ php_http_message_body_appendf(body, PHP_HTTP_CRLF "--%s--" PHP_HTTP_CRLF, php_http_message_body_boundary(body)) -static STATUS add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value); -static STATUS add_recursive_files(php_http_message_body_t *body, const char *name, zval *value); +static ZEND_RESULT_CODE add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value); +static ZEND_RESULT_CODE add_recursive_files(php_http_message_body_t *body, const char *name, zval *value); php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **body_ptr, php_stream *stream TSRMLS_DC) { @@ -165,7 +165,7 @@ void php_http_message_body_to_string(php_http_message_body_t *body, char **buf, *len = php_stream_copy_to_mem(s, buf, forlen, 0); } -STATUS php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *dst, off_t offset, size_t forlen) +ZEND_RESULT_CODE php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *dst, off_t offset, size_t forlen) { php_stream *s = php_http_message_body_stream(body); TSRMLS_FETCH_FROM_CTX(body->ts); @@ -178,7 +178,7 @@ STATUS php_http_message_body_to_stream(php_http_message_body_t *body, php_stream return php_stream_copy_to_stream_ex(s, dst, forlen, NULL); } -STATUS php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen) +ZEND_RESULT_CODE php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen) { php_stream *s = php_http_message_body_stream(body); char *buf = emalloc(0x1000); @@ -250,7 +250,7 @@ size_t php_http_message_body_appendf(php_http_message_body_t *body, const char * return print_len; } -STATUS php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files) +ZEND_RESULT_CODE php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files) { zval tmp; @@ -280,7 +280,7 @@ void php_http_message_body_add_part(php_http_message_body_t *body, php_http_mess } -STATUS php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len) +ZEND_RESULT_CODE php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len) { char *safe_name; TSRMLS_FETCH_FROM_CTX(body->ts); @@ -301,7 +301,7 @@ STATUS php_http_message_body_add_form_field(php_http_message_body_t *body, const return SUCCESS; } -STATUS php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *path, php_stream *in) +ZEND_RESULT_CODE php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *path, php_stream *in) { char *safe_name, *path_dup = estrdup(path), *bname; size_t bname_len; @@ -348,7 +348,7 @@ static inline char *format_key(uint type, char *str, ulong num, const char *pref return new_key; } -static STATUS add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value) +static ZEND_RESULT_CODE add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value) { if (Z_TYPE_P(value) == IS_ARRAY || Z_TYPE_P(value) == IS_OBJECT) { zval **val; @@ -380,7 +380,7 @@ static STATUS add_recursive_fields(php_http_message_body_t *body, const char *na return SUCCESS; } -static STATUS add_recursive_files(php_http_message_body_t *body, const char *name, zval *value) +static ZEND_RESULT_CODE add_recursive_files(php_http_message_body_t *body, const char *name, zval *value) { zval **zdata = NULL, **zfile, **zname, **ztype; HashTable *ht; @@ -441,7 +441,7 @@ static STATUS add_recursive_files(php_http_message_body_t *body, const char *nam } else { zval *znc = php_http_ztyp(IS_STRING, *zname), *ztc = php_http_ztyp(IS_STRING, *ztype); char *key = format_key(HASH_KEY_IS_STRING, Z_STRVAL_P(znc), 0, name); - STATUS ret = php_http_message_body_add_form_file(body, key, Z_STRVAL_P(ztc), Z_STRVAL_P(zfc), stream); + ZEND_RESULT_CODE ret = php_http_message_body_add_form_file(body, key, Z_STRVAL_P(ztc), Z_STRVAL_P(zfc), stream); efree(key); zval_ptr_dtor(&znc); diff --git a/php_http_message_body.h b/php_http_message_body.h index 860cd8a..dc2c7a2 100644 --- a/php_http_message_body.h +++ b/php_http_message_body.h @@ -28,15 +28,15 @@ struct php_http_message; PHP_HTTP_API php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **body, php_stream *stream TSRMLS_DC); PHP_HTTP_API unsigned php_http_message_body_addref(php_http_message_body_t *body); PHP_HTTP_API php_http_message_body_t *php_http_message_body_copy(php_http_message_body_t *from, php_http_message_body_t *to); -PHP_HTTP_API STATUS php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files); -PHP_HTTP_API STATUS php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len); -PHP_HTTP_API STATUS php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *file, php_stream *stream); +PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files); +PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len); +PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *file, php_stream *stream); PHP_HTTP_API void php_http_message_body_add_part(php_http_message_body_t *body, struct php_http_message *part); PHP_HTTP_API size_t php_http_message_body_append(php_http_message_body_t *body, const char *buf, size_t len); PHP_HTTP_API size_t php_http_message_body_appendf(php_http_message_body_t *body, const char *fmt, ...); PHP_HTTP_API void php_http_message_body_to_string(php_http_message_body_t *body, char **buf, size_t *len, off_t offset, size_t forlen); -PHP_HTTP_API STATUS php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *s, off_t offset, size_t forlen); -PHP_HTTP_API STATUS php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen); +PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *s, off_t offset, size_t forlen); +PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen); PHP_HTTP_API void php_http_message_body_free(php_http_message_body_t **body); PHP_HTTP_API const php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body); #define php_http_message_body_size(b) (php_http_message_body_stat((b))->sb.st_size) diff --git a/php_http_misc.h b/php_http_misc.h index cf00f24..15daa96 100644 --- a/php_http_misc.h +++ b/php_http_misc.h @@ -154,6 +154,13 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i # define PHP_HTTP_ZEND_LITERAL_CCN , NULL #endif +#if PHP_VERSION_ID < 50500 +typedef enum { + SUCCESS = 0, + FAILURE = -1 +} ZEND_RESULT_CODE; +#endif + #if PHP_VERSION_ID < 50700 # define z_is_true zend_is_true #else @@ -200,7 +207,7 @@ static inline zval *php_http_zsep(zend_bool add_ref, int type, zval *z) } } -static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, const char **value_str, size_t *value_len, zend_bool orig TSRMLS_DC) +static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t name_len, const char **value_str, size_t *value_len, zend_bool orig TSRMLS_DC) { zend_ini_entry *ini_entry; diff --git a/php_http_object.c b/php_http_object.c index ba6d28c..d57388d 100644 --- a/php_http_object.c +++ b/php_http_object.c @@ -35,7 +35,7 @@ zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, ph return o->zv; } -STATUS php_http_new(zend_object_value *ovp, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC) +ZEND_RESULT_CODE php_http_new(zend_object_value *ovp, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC) { zend_object_value ov; @@ -101,9 +101,9 @@ void php_http_object_method_free(php_http_object_method_t **cb) } } -STATUS php_http_object_method_call(php_http_object_method_t *cb, zval *zobject, zval **retval_ptr, int argc, zval ***args TSRMLS_DC) +ZEND_RESULT_CODE php_http_object_method_call(php_http_object_method_t *cb, zval *zobject, zval **retval_ptr, int argc, zval ***args TSRMLS_DC) { - STATUS rv; + ZEND_RESULT_CODE rv; zval *retval = NULL; Z_ADDREF_P(zobject); diff --git a/php_http_object.h b/php_http_object.h index 1fbd817..3f75932 100644 --- a/php_http_object.h +++ b/php_http_object.h @@ -23,7 +23,7 @@ zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, ph typedef zend_object_value (*php_http_new_t)(zend_class_entry *ce, void *, void ** TSRMLS_DC); -STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC); +ZEND_RESULT_CODE php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC); typedef struct php_http_method { zend_fcall_info fci; @@ -31,7 +31,7 @@ typedef struct php_http_method { } php_http_object_method_t; php_http_object_method_t *php_http_object_method_init(php_http_object_method_t *cb, zval *zobject, const char *method_str, size_t method_len TSRMLS_DC); -STATUS php_http_object_method_call(php_http_object_method_t *cb, zval *zobject, zval **retval, int argc, zval ***args TSRMLS_DC); +ZEND_RESULT_CODE php_http_object_method_call(php_http_object_method_t *cb, zval *zobject, zval **retval, int argc, zval ***args TSRMLS_DC); void php_http_object_method_dtor(php_http_object_method_t *cb); void php_http_object_method_free(php_http_object_method_t **cb); diff --git a/php_http_options.c b/php_http_options.c index 1ba987a..59b9c5f 100644 --- a/php_http_options.c +++ b/php_http_options.c @@ -26,7 +26,7 @@ php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_boo return registry; } -STATUS php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata) +ZEND_RESULT_CODE php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata) { HashPosition pos; zval *val; diff --git a/php_http_options.h b/php_http_options.h index 6726815..2475383 100644 --- a/php_http_options.h +++ b/php_http_options.h @@ -16,7 +16,7 @@ typedef struct php_http_option php_http_option_t; typedef struct php_http_options php_http_options_t; -typedef STATUS (*php_http_option_set_callback_t)(php_http_option_t *opt, zval *val, void *userdata); +typedef ZEND_RESULT_CODE (*php_http_option_set_callback_t)(php_http_option_t *opt, zval *val, void *userdata); typedef zval *(*php_http_option_get_callback_t)(php_http_option_t *opt, HashTable *options, void *userdata); struct php_http_options { @@ -46,7 +46,7 @@ struct php_http_option { }; PHP_HTTP_API php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent); -PHP_HTTP_API STATUS php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata); +PHP_HTTP_API ZEND_RESULT_CODE php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata); PHP_HTTP_API void php_http_options_dtor(php_http_options_t *registry); PHP_HTTP_API void php_http_options_free(php_http_options_t **registry); diff --git a/php_http_querystring.c b/php_http_querystring.c index 933529f..15a000b 100644 --- a/php_http_querystring.c +++ b/php_http_querystring.c @@ -76,7 +76,7 @@ static inline void php_http_querystring_get(zval *this_ptr, int type, char *name } #ifdef PHP_HTTP_HAVE_ICONV -STATUS php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe TSRMLS_DC) +ZEND_RESULT_CODE php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe TSRMLS_DC) { HashPosition pos; zval **entry = NULL; @@ -131,7 +131,7 @@ STATUS php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const ch } #endif /* HAVE_ICONV */ -STATUS php_http_querystring_ctor(zval *instance, zval *params TSRMLS_DC) +ZEND_RESULT_CODE php_http_querystring_ctor(zval *instance, zval *params TSRMLS_DC) { php_http_querystring_set(instance, params, 0 TSRMLS_CC); return SUCCESS; @@ -158,9 +158,9 @@ static int apply_querystring(void *pData TSRMLS_DC) return ZEND_HASH_APPLY_KEEP; } -STATUS php_http_querystring_parse(HashTable *ht, const char *str, size_t len TSRMLS_DC) +ZEND_RESULT_CODE php_http_querystring_parse(HashTable *ht, const char *str, size_t len TSRMLS_DC) { - STATUS rv = FAILURE; + ZEND_RESULT_CODE rv = FAILURE; php_http_params_opts_t opts; php_http_params_token_t psep = { ZEND_STRL("&") }, *psepp[] = { &psep, NULL }; php_http_params_token_t vsep = { ZEND_STRL("=") }, *vsepp[] = { &vsep, NULL }; @@ -206,7 +206,7 @@ STATUS php_http_querystring_parse(HashTable *ht, const char *str, size_t len TSR return rv; } -STATUS php_http_querystring_update(zval *qarray, zval *params, zval *outstring TSRMLS_DC) +ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *outstring TSRMLS_DC) { /* enforce proper type */ if (Z_TYPE_P(qarray) != IS_ARRAY) { diff --git a/php_http_querystring.h b/php_http_querystring.h index 4ebdd77..3391e91 100644 --- a/php_http_querystring.h +++ b/php_http_querystring.h @@ -14,10 +14,10 @@ #define PHP_HTTP_QUERYSTRING_H #ifdef PHP_HTTP_HAVE_ICONV -PHP_HTTP_API STATUS php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe TSRMLS_DC); #endif /* PHP_HTTP_HAVE_ICONV */ -PHP_HTTP_API STATUS php_http_querystring_update(zval *qarray, zval *params, zval *qstring TSRMLS_DC); -PHP_HTTP_API STATUS php_http_querystring_ctor(zval *instance, zval *params TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *qstring TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_querystring_ctor(zval *instance, zval *params TSRMLS_DC); typedef php_http_object_t php_http_querystring_object_t; diff --git a/php_http_url.c b/php_http_url.c index 13ab900..35178dc 100644 --- a/php_http_url.c +++ b/php_http_url.c @@ -550,7 +550,7 @@ HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct TSRMLS_ return Z_ARRVAL(arr); } -STATUS php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC) +ZEND_RESULT_CODE php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC) { const char *arg_sep_str; size_t arg_sep_len; @@ -569,7 +569,7 @@ STATUS php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, si return SUCCESS; } -STATUS php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len TSRMLS_DC) +ZEND_RESULT_CODE php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len TSRMLS_DC) { if (pre_encoded_len && pre_encoded_str) { php_http_buffer_append(qstr, pre_encoded_str, pre_encoded_len); @@ -760,7 +760,7 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch return 0; } -static STATUS parse_userinfo(struct parse_state *state, const char *ptr) +static ZEND_RESULT_CODE parse_userinfo(struct parse_state *state, const char *ptr) { size_t mb; const char *password = NULL, *end = state->ptr, *tmp = ptr; @@ -827,7 +827,7 @@ static STATUS parse_userinfo(struct parse_state *state, const char *ptr) #if defined(PHP_WIN32) || defined(HAVE_UIDNA_IDNTOASCII) typedef size_t (*parse_mb_func)(unsigned *wc, const char *ptr, const char *end); -static STATUS to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len) +static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len) { size_t offset = 0, u8_len = strlen(u8); @@ -871,7 +871,7 @@ static STATUS to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t #endif #ifdef PHP_HTTP_HAVE_IDN -static STATUS parse_idn(struct parse_state *state, size_t prev_len) +static ZEND_RESULT_CODE parse_idn(struct parse_state *state, size_t prev_len) { char *idn = NULL; int rv = -1; @@ -906,7 +906,7 @@ typedef uint16_t UChar; typedef enum { U_ZERO_ERROR = 0 } UErrorCode; int32_t uidna_IDNToASCII(const UChar *src, int32_t srcLength, UChar *dest, int32_t destCapacity, int32_t options, void *parseError, UErrorCode *status); # endif -static STATUS parse_uidn(struct parse_state *state) +static ZEND_RESULT_CODE parse_uidn(struct parse_state *state) { char *host_ptr; uint16_t *uhost_str, ahost_str[MAXHOSTNAMELEN], *ahost_ptr; @@ -949,7 +949,7 @@ static STATUS parse_uidn(struct parse_state *state) #endif #if 0 && defined(PHP_WIN32) -static STATUS parse_widn(struct parse_state *state) +static ZEND_RESULT_CODE parse_widn(struct parse_state *state) { char *host_ptr; uint16_t *uhost_str, ahost_str[MAXHOSTNAMELEN], *ahost_ptr; @@ -992,7 +992,7 @@ static STATUS parse_widn(struct parse_state *state) } #endif -static STATUS parse_hostinfo(struct parse_state *state, const char *ptr) +static ZEND_RESULT_CODE parse_hostinfo(struct parse_state *state, const char *ptr) { size_t mb, len; const char *end = state->ptr, *tmp = ptr, *port = NULL; diff --git a/php_http_url.h b/php_http_url.h index 303b936..636efb5 100644 --- a/php_http_url.h +++ b/php_http_url.h @@ -68,8 +68,8 @@ PHP_HTTP_API char *php_http_url_to_string(const php_http_url_t *url, char **url_ PHP_HTTP_API char *php_http_url_authority_to_string(const php_http_url_t *url, char **url_str, size_t *url_len); PHP_HTTP_API void php_http_url_free(php_http_url_t **url); -PHP_HTTP_API STATUS php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC); -PHP_HTTP_API STATUS php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC); +PHP_HTTP_API ZEND_RESULT_CODE php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len TSRMLS_DC); static inline void php_http_url_argsep(const char **str, size_t *len TSRMLS_DC) {