From: Michael Wallner Date: Tue, 15 Nov 2005 13:50:24 +0000 (+0000) Subject: - ditch some warnings X-Git-Tag: RELEASE_0_18_0~5 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=a0bca521b491711e43aef74fe19c23a8eb4d0777 - ditch some warnings --- diff --git a/http.c b/http.c index 244c423..38f91f8 100644 --- a/http.c +++ b/http.c @@ -334,10 +334,9 @@ PHP_MSHUTDOWN_FUNCTION(http) /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(http) { - char *m; - - if (m = INI_STR("http.allowed_methods")) { - http_check_allowed_methods(m, strlen(m)); + if (HTTP_G(request).methods.allowed) { + http_check_allowed_methods(HTTP_G(request).methods.allowed, + strlen(HTTP_G(request).methods.allowed)); } http_globals_init(HTTP_GLOBALS); diff --git a/http_api.c b/http_api.c index a78416a..2be27d0 100644 --- a/http_api.c +++ b/http_api.c @@ -88,7 +88,7 @@ char *_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool x if (key && key_len) { size_t i; int wasalpha; - if (wasalpha = isalpha((int) key[0])) { + if ((wasalpha = isalpha((int) key[0]))) { key[0] = (char) (uctitle ? toupper((int) key[0]) : tolower((int) key[0])); } for (i = 1; i < key_len; i++) { diff --git a/http_cache_api.c b/http_cache_api.c index 322c509..eb68044 100644 --- a/http_cache_api.c +++ b/http_cache_api.c @@ -120,7 +120,7 @@ PHP_HTTP_API zend_bool _http_match_last_modified_ex(const char *entry, time_t t, HTTP_GSC(zmodified, entry, !enforce_presence); modified = estrndup(Z_STRVAL_P(zmodified), Z_STRLEN_P(zmodified)); - if (chr_ptr = strrchr(modified, ';')) { + if ((chr_ptr = strrchr(modified, ';'))) { chr_ptr = 0; } retval = (t <= http_parse_date(modified)); diff --git a/http_date_api.c b/http_date_api.c index 1ebef70..3872009 100644 --- a/http_date_api.c +++ b/http_date_api.c @@ -147,7 +147,7 @@ PHP_HTTP_API char *_http_date(time_t t TSRMLS_DC) { struct tm *gmtime, tmbuf; - if (gmtime = php_gmtime_r(&t, &tmbuf)) { + if ((gmtime = php_gmtime_r(&t, &tmbuf))) { char *date = ecalloc(1, 31); snprintf(date, 30, "%s, %02d %s %04d %02d:%02d:%02d GMT", diff --git a/http_encoding_api.c b/http_encoding_api.c index eecbbab..9475a17 100644 --- a/http_encoding_api.c +++ b/http_encoding_api.c @@ -520,7 +520,7 @@ PHP_HTTP_API STATUS _http_encoding_stream_init(http_encoding_stream *s, int gzip HTTP_ENCODING_STREAM_ERROR(status, NULL); } - if (s->gzip = gzip) { + if ((s->gzip = gzip)) { s->crc = crc32(0L, Z_NULL, 0); *encoded_len = sizeof(http_encoding_gzip_header); *encoded = emalloc(*encoded_len); @@ -622,7 +622,7 @@ PHP_HTTP_API zend_bool _http_encoding_response_start(size_t content_length TSRML HTTP_G(send).gzip_encoding = 0; - if (selected = http_negotiate_encoding(&zsupported)) { + if ((selected = http_negotiate_encoding(&zsupported))) { STATUS hs = FAILURE; char *encoding = NULL; ulong idx; diff --git a/http_filter_api.c b/http_filter_api.c index ee42d60..944bff2 100644 --- a/http_filter_api.c +++ b/http_filter_api.c @@ -175,7 +175,7 @@ static HTTP_FILTER_FUNCTION(chunked_decode) /* we need eol, so we can be sure we have all hex digits */ phpstr_fix(PHPSTR(buffer)); - if (eolstr = http_locate_eol(PHPSTR_VAL(buffer), &eollen)) { + if ((eolstr = http_locate_eol(PHPSTR_VAL(buffer), &eollen))) { char *stop = NULL; /* read in chunk size */ @@ -287,7 +287,7 @@ static php_stream_filter *http_filter_create(const char *name, zval *params, int if (!strcasecmp(name, "http.chunked_decode")) { http_filter_buffer *b = NULL; - if (b = pecalloc(1, sizeof(http_filter_buffer), p)) { + if ((b = pecalloc(1, sizeof(http_filter_buffer), p))) { phpstr_init_ex(PHPSTR(b), 4096, p ? PHPSTR_INIT_PERSISTENT : 0); if (!(f = php_stream_filter_alloc(&HTTP_FILTER_OP(chunked_decode), b, p))) { pefree(b, p); diff --git a/http_functions.c b/http_functions.c index 3ec0577..9156ccc 100644 --- a/http_functions.c +++ b/http_functions.c @@ -108,7 +108,7 @@ PHP_FUNCTION(http_build_uri) #define HTTP_DO_NEGOTIATE(type, supported, rs_array) \ { \ HashTable *result; \ - if (result = http_negotiate_ ##type(supported)) { \ + if ((result = http_negotiate_ ##type(supported))) { \ char *key; \ uint key_len; \ ulong idx; \ @@ -447,7 +447,7 @@ PHP_FUNCTION(http_cache_last_modified) /* 0 or omitted */ if (!last_modified) { /* does the client have? (att: caching "forever") */ - if (zlm = http_get_server_var("HTTP_IF_MODIFIED_SINCE")) { + if ((zlm = http_get_server_var("HTTP_IF_MODIFIED_SINCE"))) { last_modified = send_modified = http_parse_date(Z_STRVAL_P(zlm)); /* send current time */ } else { @@ -817,7 +817,7 @@ PHP_FUNCTION(http_parse_message) RETURN_NULL(); } - if (msg = http_message_parse(message, message_len)) { + if ((msg = http_message_parse(message, message_len))) { object_init(return_value); http_message_tostruct_recursive(msg, return_value); http_message_free(&msg); @@ -1269,7 +1269,7 @@ PHP_FUNCTION(http_request_method_register) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &method, &method_len)) { RETURN_FALSE; } - if (existing = http_request_method_exists(1, 0, method)) { + if ((existing = http_request_method_exists(1, 0, method))) { RETURN_LONG((long) existing); } diff --git a/http_headers_api.c b/http_headers_api.c index 4c3c502..c4d23c8 100644 --- a/http_headers_api.c +++ b/http_headers_api.c @@ -82,7 +82,7 @@ char *_http_negotiate_language_func(const char *test, double *quality, HashTable } /* no distinct match found, so try primaries */ - if (dash_test = strchr(test, '-')) { + if ((dash_test = strchr(test, '-'))) { FOREACH_HASH_VAL(pos, supported, value) { int len = dash_test - test; #if HTTP_DBG_NEG @@ -161,7 +161,7 @@ PHP_HTTP_API HashTable *_http_negotiate_q(const char *header, HashTable *support fprintf(stderr, "Checking %s\n", Z_STRVAL_PP(entry)); #endif - if (separator = strchr(Z_STRVAL_PP(entry), ';')) { + if ((separator = strchr(Z_STRVAL_PP(entry), ';'))) { const char *ptr = separator; while (*++ptr && !isdigit(*ptr)); @@ -173,7 +173,7 @@ PHP_HTTP_API HashTable *_http_negotiate_q(const char *header, HashTable *support identifier = estrndup(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry)); } - if (selected = neg(identifier, &quality, supported TSRMLS_CC)) { + if ((selected = neg(identifier, &quality, supported TSRMLS_CC))) { /* don't overwrite previously set with higher quality */ if (!zend_hash_exists(Z_ARRVAL(array), selected, strlen(selected) + 1)) { add_assoc_double(&array, selected, quality); diff --git a/http_message_api.c b/http_message_api.c index d175201..77f18e0 100644 --- a/http_message_api.c +++ b/http_message_api.c @@ -144,7 +144,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char } /* header parsing stops at (CR)LF (CR)LF */ - if (body = http_locate_body(message)) { + if ((body = http_locate_body(message))) { zval *c; const char *continue_at = NULL; size_t remaining = message + message_length - body; @@ -155,7 +155,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char size_t decoded_len; /* decode and replace Transfer-Encoding with Content-Length header */ - if (continue_at = http_encoding_dechunk(body, message + message_length - body, &decoded, &decoded_len)) { + if ((continue_at = http_encoding_dechunk(body, message + message_length - body, &decoded, &decoded_len))) { zval *len; char *tmp; int tmp_len; @@ -174,7 +174,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char } else /* message has content-length header */ - if (c = http_message_header(msg, "Content-Length")) { + if ((c = http_message_header(msg, "Content-Length"))) { ulong len = strtoul(Z_STRVAL_P(c), NULL, 10); if (len > remaining) { http_error_ex(HE_NOTICE, HTTP_E_MALFORMED_HEADERS, "The Content-Length header pretends a larger body than actually received (expected %lu bytes; got %lu bytes)", len, remaining); @@ -185,7 +185,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char } else /* message has content-range header */ - if (c = http_message_header(msg, "Content-Range")) { + if ((c = http_message_header(msg, "Content-Range"))) { ulong total = 0, start = 0, end = 0, len = 0; if (!strncasecmp(Z_STRVAL_P(c), "bytes", lenof("bytes")) && @@ -224,7 +224,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char #if defined(HTTP_HAVE_ZLIB) || defined(HAVE_ZLIB) /* check for compressed data */ - if (c = http_message_header(msg, "Content-Encoding")) { + if ((c = http_message_header(msg, "Content-Encoding"))) { char *decoded = NULL; size_t decoded_len = 0; # if defined(HAVE_ZLIB) && !defined(HTTP_HAVE_ZLIB) @@ -288,7 +288,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char http_message *next = NULL, *most = NULL; /* set current message to parent of most parent following messages and return deepest */ - if (most = next = http_message_parse(continue_at, message + message_length - continue_at)) { + if ((most = next = http_message_parse(continue_at, message + message_length - continue_at))) { while (most->parent) most = most->parent; most->parent = msg; msg = next; @@ -382,7 +382,7 @@ PHP_HTTP_API void _http_message_serialize(http_message *message, char **string, http_message_tostring(message, &buf, &len); phpstr_prepend(&str, buf, len); efree(buf); - } while (message = message->parent); + } while ((message = message->parent)); buf = phpstr_data(&str, string, length); if (!string) { @@ -412,6 +412,10 @@ PHP_HTTP_API void _http_message_tostruct_recursive(http_message *msg, zval *obj add_assoc_string(&strct, "requestMethod", msg->http.info.request.method, 1); add_assoc_string(&strct, "requestUri", msg->http.info.request.URI, 1); break; + + case HTTP_MSG_NONE: + /* avoid compiler warning */ + break; } MAKE_STD_ZVAL(headers); @@ -493,7 +497,7 @@ PHP_HTTP_API STATUS _http_message_send(http_message *message TSRMLS_DC) int port = 0; /* check for port */ - if (colon = strchr(Z_STRVAL_PP(zhost), ':')) { + if ((colon = strchr(Z_STRVAL_PP(zhost), ':'))) { port = atoi(colon + 1); host = estrndup(Z_STRVAL_PP(zhost), host_len = (Z_STRVAL_PP(zhost) - colon - 1)); } else { diff --git a/http_message_object.c b/http_message_object.c index bd15bec..fbe5fc2 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -554,7 +554,7 @@ PHP_METHOD(HttpMessage, __construct) http_message *msg = obj->message; http_message_dtor(msg); - if (obj->message = http_message_parse_ex(msg, message, length)) { + if ((obj->message = http_message_parse_ex(msg, message, length))) { if (obj->message->parent) { obj->parent = http_message_object_new_ex(Z_OBJCE_P(getThis()), obj->message->parent, NULL); } @@ -590,7 +590,7 @@ PHP_METHOD(HttpMessage, fromString) SET_EH_THROW_HTTP(); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &length)) { - if (msg = http_message_parse(string, length)) { + if ((msg = http_message_parse(string, length))) { ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL)); } } diff --git a/http_request_api.c b/http_request_api.c index d94e558..496a63e 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -426,47 +426,47 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char #endif /* progress callback */ - if (zoption = http_curl_getopt(options, "onprogress", 0)) { + if ((zoption = http_curl_getopt(options, "onprogress", 0))) { HTTP_CURL_OPT(NOPROGRESS, 0); HTTP_CURL_OPT(PROGRESSFUNCTION, http_curl_progress_callback); HTTP_CURL_OPT(PROGRESSDATA, http_request_callback_data(zoption)); } /* proxy */ - if (zoption = http_curl_getopt(options, "proxyhost", IS_STRING)) { + if ((zoption = http_curl_getopt(options, "proxyhost", IS_STRING))) { HTTP_CURL_OPT(PROXY, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption))); /* port */ - if (zoption = http_curl_getopt(options, "proxyport", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "proxyport", IS_LONG))) { HTTP_CURL_OPT(PROXYPORT, Z_LVAL_P(zoption)); } /* user:pass */ - if (zoption = http_curl_getopt(options, "proxyauth", IS_STRING)) { + if ((zoption = http_curl_getopt(options, "proxyauth", IS_STRING))) { HTTP_CURL_OPT(PROXYUSERPWD, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption))); } #if LIBCURL_VERSION_NUM >= 0x070a07 /* auth method */ - if (zoption = http_curl_getopt(options, "proxyauthtype", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "proxyauthtype", IS_LONG))) { HTTP_CURL_OPT(PROXYAUTH, Z_LVAL_P(zoption)); } #endif } /* outgoing interface */ - if (zoption = http_curl_getopt(options, "interface", IS_STRING)) { + if ((zoption = http_curl_getopt(options, "interface", IS_STRING))) { HTTP_CURL_OPT(INTERFACE, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption))); } /* another port */ - if (zoption = http_curl_getopt(options, "port", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "port", IS_LONG))) { HTTP_CURL_OPT(PORT, Z_LVAL_P(zoption)); } /* auth */ - if (zoption = http_curl_getopt(options, "httpauth", IS_STRING)) { + if ((zoption = http_curl_getopt(options, "httpauth", IS_STRING))) { HTTP_CURL_OPT(USERPWD, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption))); } #if LIBCURL_VERSION_NUM >= 0x070a06 - if (zoption = http_curl_getopt(options, "httpauthtype", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "httpauthtype", IS_LONG))) { HTTP_CURL_OPT(HTTPAUTH, Z_LVAL_P(zoption)); } #endif @@ -481,26 +481,26 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char } /* redirects, defaults to 0 */ - if (zoption = http_curl_getopt(options, "redirect", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "redirect", IS_LONG))) { HTTP_CURL_OPT(FOLLOWLOCATION, Z_LVAL_P(zoption) ? 1 : 0); HTTP_CURL_OPT(MAXREDIRS, Z_LVAL_P(zoption)); - if (zoption = http_curl_getopt(options, "unrestrictedauth", IS_BOOL)) { + if ((zoption = http_curl_getopt(options, "unrestrictedauth", IS_BOOL))) { HTTP_CURL_OPT(UNRESTRICTED_AUTH, Z_LVAL_P(zoption)); } } /* referer */ - if (zoption = http_curl_getopt(options, "referer", IS_STRING)) { + if ((zoption = http_curl_getopt(options, "referer", IS_STRING))) { HTTP_CURL_OPT(REFERER, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption))); } /* useragent, default "PECL::HTTP/version (PHP/version)" */ - if (zoption = http_curl_getopt(options, "useragent", IS_STRING)) { + if ((zoption = http_curl_getopt(options, "useragent", IS_STRING))) { HTTP_CURL_OPT(USERAGENT, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption))); } /* additional headers, array('name' => 'value') */ - if (zoption = http_curl_getopt(options, "headers", IS_ARRAY)) { + if ((zoption = http_curl_getopt(options, "headers", IS_ARRAY))) { char *header_key; ulong header_idx; HashPosition pos; @@ -526,7 +526,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char } /* cookies, array('name' => 'value') */ - if (zoption = http_curl_getopt(options, "cookies", IS_ARRAY)) { + if ((zoption = http_curl_getopt(options, "cookies", IS_ARRAY))) { char *cookie_key = NULL; ulong cookie_idx = 0; HashPosition pos; @@ -552,7 +552,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char } /* session cookies */ - if (zoption = http_curl_getopt(options, "cookiesession", IS_BOOL)) { + if ((zoption = http_curl_getopt(options, "cookiesession", IS_BOOL))) { if (Z_LVAL_P(zoption)) { /* accept cookies for this session */ HTTP_CURL_OPT(COOKIEFILE, ""); @@ -575,12 +575,12 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char } /* maxfilesize */ - if (zoption = http_curl_getopt(options, "maxfilesize", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "maxfilesize", IS_LONG))) { HTTP_CURL_OPT(MAXFILESIZE, Z_LVAL_P(zoption)); } /* lastmodified */ - if (zoption = http_curl_getopt(options, "lastmodified", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "lastmodified", IS_LONG))) { if (Z_LVAL_P(zoption)) { if (Z_LVAL_P(zoption) > 0) { HTTP_CURL_OPT(TIMEVALUE, Z_LVAL_P(zoption)); @@ -594,17 +594,17 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char } /* timeout, defaults to 0 */ - if (zoption = http_curl_getopt(options, "timeout", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "timeout", IS_LONG))) { HTTP_CURL_OPT(TIMEOUT, Z_LVAL_P(zoption)); } /* connecttimeout, defaults to 3 */ - if (zoption = http_curl_getopt(options, "connecttimeout", IS_LONG)) { + if ((zoption = http_curl_getopt(options, "connecttimeout", IS_LONG))) { HTTP_CURL_OPT(CONNECTTIMEOUT, Z_LVAL_P(zoption)); } /* ssl */ - if (zoption = http_curl_getopt(options, "ssl", IS_ARRAY)) { + if ((zoption = http_curl_getopt(options, "ssl", IS_ARRAY))) { ulong idx; char *key = NULL; zval **param; @@ -629,7 +629,6 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char HTTP_CURL_OPT_SSL_LONG_(VERIFYHOST); HTTP_CURL_OPT_SSL_STRING_(CIPHER_LIST); - HTTP_CURL_OPT_STRING(CAINFO); #if LIBCURL_VERSION_NUM >= 0x070908 HTTP_CURL_OPT_STRING(CAPATH); @@ -866,8 +865,8 @@ static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size phpstr_append(conv->request, data, length); } break; -#if 0 default: +#if 0 fprintf(stderr, "## ", type); if (!type) { fprintf(stderr, "%s", data); @@ -884,8 +883,8 @@ static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size if (data[length-1] != 0xa) { fprintf(stderr, "\n"); } - break; #endif + break; } if (type) { diff --git a/http_request_object.c b/http_request_object.c index 2ed9797..43cf5a8 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -1894,7 +1894,7 @@ PHP_METHOD(HttpRequest, getRequestMessage) getObject(http_request_object, obj); SET_EH_THROW_HTTP(); - if (msg = http_message_parse(PHPSTR_VAL(&obj->request), PHPSTR_LEN(&obj->request))) { + if ((msg = http_message_parse(PHPSTR_VAL(&obj->request), PHPSTR_LEN(&obj->request)))) { ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL)); } SET_EH_NORMAL(); @@ -1930,7 +1930,7 @@ PHP_METHOD(HttpRequest, getHistory) getObject(http_request_object, obj); SET_EH_THROW_HTTP(); - if (msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history))) { + if ((msg = http_message_parse(PHPSTR_VAL(&obj->history), PHPSTR_LEN(&obj->history)))) { ZVAL_OBJVAL(return_value, http_message_object_new_ex(http_message_object_ce, msg, NULL)); } SET_EH_NORMAL(); diff --git a/http_request_pool_api.c b/http_request_pool_api.c index 9abbc3a..c221f1e 100644 --- a/http_request_pool_api.c +++ b/http_request_pool_api.c @@ -269,7 +269,7 @@ PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool TSRMLS_DC) while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(pool->ch, &pool->unfinished)); - while (msg = curl_multi_info_read(pool->ch, &remaining)) { + while ((msg = curl_multi_info_read(pool->ch, &remaining))) { if (CURLMSG_DONE == msg->msg) { if (CURLE_OK != msg->data.result) { http_error(HE_WARNING, HTTP_E_REQUEST, curl_easy_strerror(msg->data.result)); diff --git a/http_response_object.c b/http_response_object.c index a0b8817..e5b0d00 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -900,7 +900,7 @@ PHP_METHOD(HttpResponse, setData) } UPD_STATIC_PROP(long, lastModified, http_last_modified(the_data, SEND_DATA)); - if (etag = http_etag(Z_STRVAL_P(the_data), Z_STRLEN_P(the_data), SEND_DATA)) { + if ((etag = http_etag(Z_STRVAL_P(the_data), Z_STRLEN_P(the_data), SEND_DATA))) { UPD_STATIC_PROP(string, eTag, etag); efree(etag); } @@ -959,7 +959,7 @@ PHP_METHOD(HttpResponse, setStream) zend_list_addref(Z_LVAL_P(the_stream)); UPD_STATIC_PROP(long, lastModified, http_last_modified(the_real_stream, SEND_RSRC)); - if (etag = http_etag(the_real_stream, 0, SEND_RSRC)) { + if ((etag = http_etag(the_real_stream, 0, SEND_RSRC))) { UPD_STATIC_PROP(string, eTag, etag); efree(etag); } @@ -1018,7 +1018,7 @@ PHP_METHOD(HttpResponse, setFile) } UPD_STATIC_PROP(long, lastModified, http_last_modified(the_file, -1)); - if (etag = http_etag(the_file, 0, -1)) { + if ((etag = http_etag(the_file, 0, -1))) { UPD_STATIC_PROP(string, eTag, etag); efree(etag); } diff --git a/http_send_api.c b/http_send_api.c index dfd0643..d432b5c 100644 --- a/http_send_api.c +++ b/http_send_api.c @@ -313,14 +313,14 @@ PHP_HTTP_API STATUS _http_send_ex(const void *data_ptr, size_t data_size, http_s zend_hash_init(&ranges, 0, NULL, ZVAL_PTR_DTOR, 0); range_status = http_get_request_ranges(&ranges, data_size); - if (range_status == RANGE_ERR) { - zend_hash_destroy(&ranges); - http_send_status(416); - return FAILURE; - } - switch (range_status) { + case RANGE_ERR: + { + zend_hash_destroy(&ranges); + http_send_status(416); + return FAILURE; + } case RANGE_OK: { /* Range Request - only send ranges if entity hasn't changed */ @@ -400,7 +400,7 @@ PHP_HTTP_API STATUS _http_send_ex(const void *data_ptr, size_t data_size, http_s if (!no_cache && cache_etag) { char *etag = NULL; - if (etag = http_etag(data_ptr, data_size, data_mode)) { + if ((etag = http_etag(data_ptr, data_size, data_mode))) { char *sent_header = NULL; http_send_etag_ex(etag, strlen(etag), &sent_header); diff --git a/http_url_api.c b/http_url_api.c index dd70660..9c35a5c 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -90,7 +90,7 @@ PHP_HTTP_API char *_http_absolute_url_ex( furl.port = purl->port; } else if (strncmp(furl.scheme, "http", 4)) { #if defined(PHP_WIN32) || defined(HAVE_NETDB_H) - if (se = getservbyname(furl.scheme, "tcp")) { + if ((se = getservbyname(furl.scheme, "tcp"))) { furl.port = se->s_port; } #endif diff --git a/phpstr/phpstr.c b/phpstr/phpstr.c index 69f577f..8ab8737 100644 --- a/phpstr/phpstr.c +++ b/phpstr/phpstr.c @@ -25,7 +25,7 @@ PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size, int flags) PHPSTR_API phpstr *phpstr_from_string_ex(phpstr *buf, const char *string, size_t length) { - if (buf = phpstr_init(buf)) { + if ((buf = phpstr_init(buf))) { if (NOMEM == phpstr_append(buf, string, length)) { pefree(buf, buf->pmem); buf = NULL; @@ -346,7 +346,7 @@ PHPSTR_API void phpstr_chunked_output(phpstr **s, const char *data, size_t data_ char *chunk = NULL; size_t got = 0; - while (got = phpstr_chunk_buffer(s, data, data_len, &chunk, chunk_len)) { + while ((got = phpstr_chunk_buffer(s, data, data_len, &chunk, chunk_len))) { passthru(chunk, got TSRMLS_CC); if (!chunk_len) { /* we already got the last chunk,