- fix switch() CS
authorMichael Wallner <mike@php.net>
Fri, 19 May 2006 10:33:57 +0000 (10:33 +0000)
committerMichael Wallner <mike@php.net>
Fri, 19 May 2006 10:33:57 +0000 (10:33 +0000)
20 files changed:
http_api.c
http_cache_api.c
http_encoding_api.c
http_exception_object.c
http_filter_api.c
http_functions.c
http_headers_api.c
http_info_api.c
http_message_api.c
http_message_object.c
http_querystring_object.c
http_request_api.c
http_request_body_api.c
http_request_method_api.c
http_request_object.c
http_response_object.c
http_send_api.c
http_url_api.c
php_http_api.h
php_http_url_api.h

index 33cd17d1009c6adf5efc5050f3561a363725ac7d..4744a827f32fffd80e88d3824bfada3f081621f4 100644 (file)
@@ -154,8 +154,7 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
                PHPWRITE(body, strlen(body));
        }
        
-       switch (status)
-       {
+       switch (status) {
                case 301:       http_log(HTTP_G->log.redirect, "301-REDIRECT", header);                 break;
                case 302:       http_log(HTTP_G->log.redirect, "302-REDIRECT", header);                 break;
                case 303:       http_log(HTTP_G->log.redirect, "303-REDIRECT", header);                 break;
@@ -362,8 +361,7 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                );
                STR_FREE(tk); STR_FREE(tv);
 #endif
-               switch (st)
-               {
+               switch (st) {
                        case ST_QUOTE:
                        quote:
                                if (*c == '"') {
@@ -382,36 +380,34 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                                                st = ST_ADD;
                                        }
                                }
-                       break;
+                               break;
                                
                        case ST_VALUE:
-                               switch (*c)
-                               {
+                               switch (*c) {
                                        case '"':
                                                if (!val) {
                                                        st = ST_QUOTE;
                                                }
-                                       break;
+                                               break;
                                        
                                        case ' ':
-                                       break;
+                                               break;
                                        
                                        case ';':
                                        case '\0':
                                                goto add;
-                                       break;
+                                               break;
                                        
                                        default:
                                                if (!val) {
                                                        val = c;
                                                }
-                                       break;
+                                               break;
                                }
-                       break;
+                               break;
                                
                        case ST_KEY:
-                               switch (*c)
-                               {
+                               switch (*c) {
                                        case ',':
                                                if (allow_comma_sep) {
                                                        goto allow_comma;
@@ -422,7 +418,7 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                                        case '\013':
                                        case '\014':
                                                goto failure;
-                                       break;
+                                               break;
                                        
                                        case '=':
                                                if (key) {
@@ -431,14 +427,14 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                                                } else {
                                                        goto failure;
                                                }
-                                       break;
+                                               break;
                                        
                                        case ' ':
                                                if (key) {
                                                        keylen = c - key;
                                                        st = ST_ASSIGN;
                                                }
-                                       break;
+                                               break;
                                        
                                        case ';':
                                        case '\0':
@@ -447,15 +443,15 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                                                        keylen = c - key;
                                                        st = ST_ADD;
                                                }
-                                       break;
+                                               break;
                                        
                                        default:
                                                if (!key) {
                                                        key = c;
                                                }
-                                       break;
+                                               break;
                                }
-                       break;
+                               break;
                                
                        case ST_ASSIGN:
                                if (*c == '=') {
@@ -465,7 +461,7 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                                } else if (*c != ' ') {
                                        goto failure;
                                }
-                       break;
+                               break;
                                
                        case ST_ADD:
                        add:
@@ -484,7 +480,7 @@ PHP_HTTP_API STATUS _http_parse_params_ex(const char *param, int allow_comma_sep
                                st = ST_KEY;
                                key = val = NULL;
                                keylen = vallen = 0;
-                       break;
+                               break;
                }
                
                if (*c) {
index 9fce65059988eebaea0606b7c462e5b7ea17e665..7c748cc46023c73769fc5099bce37d003aed13bf 100644 (file)
@@ -63,8 +63,7 @@ PHP_HTTP_API time_t _http_last_modified(const void *data_ptr, http_send_mode dat
 {
        php_stream_statbuf ssb;
 
-       switch (data_mode)
-       {
+       switch (data_mode) {
                case SEND_DATA: return HTTP_GET_REQUEST_TIME();
                case SEND_RSRC: return php_stream_stat((php_stream *) data_ptr, &ssb) ? 0 : ssb.sb.st_mtime;
                default:                return php_stream_stat_path((char *) data_ptr, &ssb) ? 0 : ssb.sb.st_mtime;
index 89865a2bd543c437e4de80b24f1e3f29c17046bf..178c9925a34de64e760fa1aec9f715edef816c9c 100644 (file)
@@ -327,12 +327,10 @@ retry_raw_inflate:
                Z.next_in = (Bytef *) data;
                Z.avail_in = data_len;
                
-               switch (status = http_inflate_rounds(&Z, Z_NO_FLUSH, decoded, decoded_len))
-               {
+               switch (status = http_inflate_rounds(&Z, Z_NO_FLUSH, decoded, decoded_len)) {
                        case Z_OK:
                        case Z_STREAM_END:
                                return SUCCESS;
-                       break;
                        
                        case Z_DATA_ERROR:
                                /* raw deflated data? */
@@ -341,7 +339,6 @@ retry_raw_inflate:
                                        wbits = HTTP_WINDOW_BITS_RAW;
                                        goto retry_raw_inflate;
                                }
-                       break;
                }
                inflateEnd(&Z);
        }
@@ -432,8 +429,7 @@ PHP_HTTP_API STATUS _http_encoding_deflate_stream_update(http_encoding_stream *s
        s->stream.avail_out = *encoded_len;
        s->stream.next_out = (Bytef *) *encoded;
        
-       switch (status = deflate(&s->stream, HTTP_ENCODING_STREAM_FLUSH_FLAG(s->flags)))
-       {
+       switch (status = deflate(&s->stream, HTTP_ENCODING_STREAM_FLUSH_FLAG(s->flags))) {
                case Z_OK:
                case Z_STREAM_END:
                        /* cut processed chunk off the buffer */
@@ -448,7 +444,6 @@ PHP_HTTP_API STATUS _http_encoding_deflate_stream_update(http_encoding_stream *s
                        *encoded = erealloc_rel(*encoded, *encoded_len + 1);
                        (*encoded)[*encoded_len] = '\0';
                        return SUCCESS;
-               break;
        }
        
        STR_SET(*encoded, NULL);
@@ -470,8 +465,7 @@ retry_raw_inflate:
        s->stream.next_in = (Bytef *) PHPSTR_VAL(s->stream.opaque);
        s->stream.avail_in = PHPSTR_LEN(s->stream.opaque);
        
-       switch (status = http_inflate_rounds(&s->stream, HTTP_ENCODING_STREAM_FLUSH_FLAG(s->flags), decoded, decoded_len))
-       {
+       switch (status = http_inflate_rounds(&s->stream, HTTP_ENCODING_STREAM_FLUSH_FLAG(s->flags), decoded, decoded_len)) {
                case Z_OK:
                case Z_STREAM_END:
                        /* cut off */
@@ -481,7 +475,6 @@ retry_raw_inflate:
                                phpstr_reset(PHPSTR(s->stream.opaque));
                        }
                        return SUCCESS;
-               break;
                
                case Z_DATA_ERROR:
                        /* raw deflated data ? */
@@ -491,7 +484,6 @@ retry_raw_inflate:
                                inflateInit2(&s->stream, HTTP_WINDOW_BITS_RAW);
                                goto retry_raw_inflate;
                        }
-               break;
        }
        
        http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Failed to update inflate stream: %s", zError(status));
@@ -512,15 +504,13 @@ PHP_HTTP_API STATUS _http_encoding_deflate_stream_flush(http_encoding_stream *s,
        s->stream.avail_out = *encoded_len;
        s->stream.next_out = (Bytef *) *encoded;
        
-       switch (status = deflate(&s->stream, Z_FULL_FLUSH))
-       {
+       switch (status = deflate(&s->stream, Z_FULL_FLUSH)) {
                case Z_OK:
                case Z_STREAM_END:
                        *encoded_len = HTTP_DEFLATE_BUFFER_SIZE - s->stream.avail_out;
                        *encoded = erealloc_rel(*encoded, *encoded_len + 1);
                        (*encoded)[*encoded_len] = '\0';
                        return SUCCESS;
-               break;
        }
        
        STR_SET(*encoded, NULL);
@@ -675,19 +665,17 @@ void _http_ob_deflatehandler(char *output, uint output_len, char **handled_outpu
                
                HTTP_G->send.deflate.encoding = !0;
                
-               switch (http_encoding_response_start(0))
-               {
+               switch (http_encoding_response_start(0)) {
                        case HTTP_ENCODING_GZIP:
                                flags = HTTP_DEFLATE_TYPE_GZIP;
-                       break;
+                               break;
                        
                        case HTTP_ENCODING_DEFLATE:
                                flags = HTTP_DEFLATE_TYPE_ZLIB;
-                       break;
+                               break;
                        
                        default:
                                goto deflate_passthru_plain;
-                       break;
                }
                
                flags |= (HTTP_G->send.deflate.start_flags &~ 0xf0);
index 06d464ec10e1256f1ad77bc1d0857bf41f34a260..4cb0044227b8313ad3b1e3dc7658a1f9c0865759 100644 (file)
@@ -78,8 +78,7 @@ zend_class_entry *_http_exception_get_for_code(long code)
 {
        zend_class_entry *ex = http_exception_object_ce;
 
-       switch (code)
-       {
+       switch (code) {
                case HTTP_E_RUNTIME:                                    ex = HTTP_EX_CE(runtime);                                       break;
                case HTTP_E_INVALID_PARAM:                              ex = HTTP_EX_CE(invalid_param);                         break;
                case HTTP_E_HEADER:                                             ex = HTTP_EX_CE(header);                                        break;
index 6b58a0be45fb1c872464df02dc4074fa24476ed2..a6c740fa7e4b23694b73021b74bd654562973970 100644 (file)
@@ -492,8 +492,7 @@ static php_stream_filter *http_filter_create(const char *name, zval *params, int
                HTTP_FILTER_BUFFER(deflate) *b = NULL;
                
                if (params) {
-                       switch (Z_TYPE_P(params))
-                       {
+                       switch (Z_TYPE_P(params)) {
                                case IS_ARRAY:
                                case IS_OBJECT:
                                        if (SUCCESS != zend_hash_find(HASH_OF(params), "flags", sizeof("flags"), (void *) &tmp)) {
index 155a06f08491c1eaaa2ad36b64e92e71fc199025..ceac1a1eee4bbb3d9797e0c0df87149138fd4196 100644 (file)
@@ -781,20 +781,18 @@ PHP_FUNCTION(http_redirect)
                FREE_ZVAL(params);
        }
        
-       switch (status)
-       {
+       switch (status) {
                case 300:
                        RETVAL_SUCCESS(http_send_status_header(status, LOC));
                        efree(LOC);
                        return;
-               break;
                
                case HTTP_REDIRECT_PERM:
                case HTTP_REDIRECT_FOUND:
                case HTTP_REDIRECT_POST:
                case HTTP_REDIRECT_PROXY:
                case HTTP_REDIRECT_TEMP:
-               break;
+                       break;
                
                case 306:
                default:
@@ -807,7 +805,7 @@ PHP_FUNCTION(http_redirect)
                        } else {
                                status = HTTP_REDIRECT_FOUND;
                        }
-               break;
+                       break;
        }
        
        RETURN_SUCCESS(http_exit_ex(status, LOC, RED, 1));
@@ -1717,8 +1715,7 @@ PHP_FUNCTION(http_request_body_encode)
                RETURN_FALSE;
        }
        
-       switch (body.type)
-       {
+       switch (body.type) {
                case HTTP_REQUEST_BODY_CURLPOST:
                        if (CURLE_OK != (rc = Curl_getFormData(&data, body.data, &size))) {
                                http_error_ex(HE_WARNING, HTTP_E_RUNTIME, "Could not encode request body: %s", curl_easy_strerror(rc));
@@ -1749,16 +1746,16 @@ PHP_FUNCTION(http_request_body_encode)
                                }
                        }
                        http_request_body_dtor(&body);
-               break;
+                       break;
                
                case HTTP_REQUEST_BODY_CSTRING:
                        RETVAL_STRINGL(body.data, body.size, 0);
-               break;
+                       break;
                
                default:
                        http_request_body_dtor(&body);
                        RETVAL_FALSE;
-               break;
+                       break;
        }
 }
 #endif /* HTTP_HAVE_CURL */
@@ -1805,8 +1802,7 @@ PHP_FUNCTION(http_request_method_unregister)
                RETURN_FALSE;
        }
 
-       switch (Z_TYPE_P(method))
-       {
+       switch (Z_TYPE_P(method)) {
                case IS_OBJECT:
                        convert_to_string(method);
                case IS_STRING:
@@ -1845,8 +1841,7 @@ PHP_FUNCTION(http_request_method_exists)
                        RETURN_FALSE;
                }
 
-               switch (Z_TYPE_P(method))
-               {
+               switch (Z_TYPE_P(method)) {
                        case IS_OBJECT:
                                convert_to_string(method);
                        case IS_STRING:
index 70f36ce285052578b8df7acc1c4914d1054007f9..ce5f0518be22112252b5d91ae2da8ee92ceef8ac 100644 (file)
@@ -200,14 +200,13 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
        range += sizeof("bytes=") - 1;
 
        do {
-               switch (c = *(range++))
-               {
+               switch (c = *(range++)) {
                        case '0':
                                /* allow 000... - shall we? */
                                if (*ptr != -10) {
                                        *ptr *= 10;
                                }
-                       break;
+                               break;
 
                        case '1': case '2': case '3':
                        case '4': case '5': case '6':
@@ -229,23 +228,21 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
                                } else {
                                        *ptr = c - '0';
                                }
-                       break;
+                               break;
 
                        case '-':
                                ptr = &end;
-                       break;
+                               break;
 
                        case ' ':
-                               /* IE - ignore for now */
-                       break;
+                               break;
 
                        case 0:
                        case ',':
 
                                if (length) {
                                        /* validate ranges */
-                                       switch (begin)
-                                       {
+                                       switch (begin) {
                                                /* "0-12345" */
                                                case -10:
                                                        /* "0-" */
@@ -257,7 +254,7 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
                                                                return RANGE_ERR;
                                                        }
                                                        begin = 0;
-                                               break;
+                                                       break;
 
                                                /* "-12345" */
                                                case -1:
@@ -267,16 +264,14 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
                                                        }
                                                        begin = length - end;
                                                        end = length - 1;
-                                               break;
+                                                       break;
 
                                                /* "12345-(xxx)" */
                                                default:
-                                                       switch (end)
-                                                       {
+                                                       switch (end) {
                                                                /* "12345-0" */
                                                                case -10:
                                                                        return RANGE_ERR;
-                                                               break;
 
                                                                /* "12345-" */
                                                                case -1:
@@ -284,7 +279,7 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
                                                                                return RANGE_ERR;
                                                                        }
                                                                        end = length - 1;
-                                                               break;
+                                                                       break;
 
                                                                /* "12345-67890" */
                                                                default:
@@ -293,9 +288,9 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
                                                                                        (end    <  begin)) {
                                                                                return RANGE_ERR;
                                                                        }
-                                                               break;
+                                                                       break;
                                                        }
-                                               break;
+                                                       break;
                                        }
                                }
                                {
@@ -310,11 +305,10 @@ PHP_HTTP_API http_range_status _http_get_request_ranges(HashTable *ranges, size_
                                        end = -1;
                                        ptr = &begin;
                                }
-                       break;
+                               break;
 
                        default:
                                return RANGE_NO;
-                       break;
                }
        } while (c != 0);
 
@@ -339,13 +333,12 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header
        do {
                int value_len = 0;
                
-               switch (*line++)
-               {
+               switch (*line++) {
                        case ':':
                                if (!colon) {
                                        colon = line - 1;
                                }
-                       break;
+                               break;
                        
                        case 0:
                                --value_len; /* we don't have CR so value length is one char less */
@@ -419,7 +412,7 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header
                                        value_len = 0;
                                        header += line - header;
                                }
-                       break;
+                               break;
                }
        } while (MORE_HEADERS);
 
index 793acd11be56a941d88cc4a669c88726ef502695..0f22902bb2e020fcc8744280dc16c7f9cee1a55d 100644 (file)
@@ -23,35 +23,33 @@ PHP_HTTP_API void _http_info_default_callback(void **nothing, HashTable **header
        
        INIT_ZARR(array, *headers);
        
-       switch (info->type)
-       {
+       switch (info->type) {
                case IS_HTTP_REQUEST:
                        add_assoc_string(&array, "Request Method", HTTP_INFO(info).request.method, 1);
                        add_assoc_string(&array, "Request Url", HTTP_INFO(info).request.url, 1);
-               break;
+                       break;
                
                case IS_HTTP_RESPONSE:
                        add_assoc_long(&array, "Response Code", (long) HTTP_INFO(info).response.code);
                        add_assoc_string(&array, "Response Status", HTTP_INFO(info).response.status, 1);
-               break;
+                       break;
        }
 }
 
 PHP_HTTP_API void _http_info_dtor(http_info *i)
 {
-       switch (i->type)
-       {
+       switch (i->type) {
                case IS_HTTP_REQUEST:
                        STR_SET(HTTP_INFO(i).request.method, NULL);
                        STR_SET(HTTP_INFO(i).request.url, NULL);
-               break;
+                       break;
                
                case IS_HTTP_RESPONSE:
                        STR_SET(HTTP_INFO(i).response.status, NULL);
-               break;
+                       break;
                
                default:
-               break;
+                       break;
        }
 }
 
index 59fb327f25acc9276547b6270a7de834d5395b0d..b98db1709e2de2cc0c53df175a3b9b65dfc28ea3 100644 (file)
@@ -45,21 +45,20 @@ static inline void _http_message_init_type(http_message *message, http_message_t
 {
        message->http.version = .0;
        
-       switch (message->type = type)
-       {
+       switch (message->type = type) {
                case HTTP_MSG_RESPONSE:
                        message->http.info.response.code = 0;
                        message->http.info.response.status = NULL;
-               break;
+                       break;
 
                case HTTP_MSG_REQUEST:
                        message->http.info.request.method = NULL;
                        message->http.info.request.url = NULL;
-               break;
+                       break;
 
                case HTTP_MSG_NONE:
                default:
-               break;
+                       break;
        }
 }
 
@@ -84,19 +83,18 @@ PHP_HTTP_API void _http_message_set_type(http_message *message, http_message_typ
        if (type != message->type) {
 
                /* free request info */
-               switch (message->type)
-               {
+               switch (message->type) {
                        case HTTP_MSG_REQUEST:
                                STR_FREE(message->http.info.request.method);
                                STR_FREE(message->http.info.request.url);
-                       break;
+                               break;
                        
                        case HTTP_MSG_RESPONSE:
                                STR_FREE(message->http.info.response.status);
-                       break;
+                               break;
                        
                        default:
-                       break;
+                               break;
                }
 
                /* init */
@@ -108,20 +106,19 @@ PHP_HTTP_API void _http_message_set_info(http_message *message, http_info *info)
 {
        message->http.version = info->http.version;
        
-       switch (message->type = info->type)
-       {
+       switch (message->type = info->type) {
                case IS_HTTP_REQUEST:
                        HTTP_INFO(message).request.url = estrdup(HTTP_INFO(info).request.url);
                        STR_SET(HTTP_INFO(message).request.method, estrdup(HTTP_INFO(info).request.method));
-               break;
+                       break;
                
                case IS_HTTP_RESPONSE:
                        HTTP_INFO(message).response.code = HTTP_INFO(info).response.code;
                        STR_SET(HTTP_INFO(message).response.status, estrdup(HTTP_INFO(info).response.status));
-               break;
+                       break;
                
                default:
-               break;
+                       break;
        }
 }
 
@@ -295,14 +292,13 @@ PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
 
        phpstr_init_ex(&str, 4096, 0);
 
-       switch (msg->type)
-       {
+       switch (msg->type) {
                case HTTP_MSG_REQUEST:
                        phpstr_appendf(&str, "%s %s HTTP/%1.1f" HTTP_CRLF,
                                msg->http.info.request.method,
                                msg->http.info.request.url,
                                msg->http.version);
-               break;
+                       break;
 
                case HTTP_MSG_RESPONSE:
                        phpstr_appendf(&str, "HTTP/%1.1f %d%s%s" HTTP_CRLF,
@@ -310,22 +306,21 @@ PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
                                msg->http.info.response.code,
                                *msg->http.info.response.status ? " ":"",
                                msg->http.info.response.status);
-               break;
+                       break;
 
                case HTTP_MSG_NONE:
                default:
-               break;
+                       break;
        }
 
        FOREACH_HASH_KEYVAL(pos1, &msg->hdrs, key, idx, header) {
                if (key) {
                        zval **single_header;
 
-                       switch (Z_TYPE_PP(header))
-                       {
+                       switch (Z_TYPE_PP(header)) {
                                case IS_STRING:
                                        phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(header));
-                               break;
+                                       break;
 
                                case IS_ARRAY:
                                {
@@ -333,8 +328,8 @@ PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
                                        FOREACH_VAL(pos2, *header, single_header) {
                                                phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(single_header));
                                        }
+                                       break;
                                }
-                               break;
                        }
 
                        key = NULL;
@@ -481,8 +476,7 @@ PHP_HTTP_API STATUS _http_message_send(http_message *message TSRMLS_DC)
 {
        STATUS rs = FAILURE;
 
-       switch (message->type)
-       {
+       switch (message->type) {
                case HTTP_MSG_RESPONSE:
                {
                        char *key;
@@ -510,8 +504,8 @@ PHP_HTTP_API STATUS _http_message_send(http_message *message TSRMLS_DC)
                        rs =    SUCCESS == http_send_status(message->http.info.response.code) &&
                                        SUCCESS == http_send_data(PHPSTR_VAL(message), PHPSTR_LEN(message)) ?
                                        SUCCESS : FAILURE;
+                       break;
                }
-               break;
 
                case HTTP_MSG_REQUEST:
                {
@@ -567,13 +561,13 @@ PHP_HTTP_API STATUS _http_message_send(http_message *message TSRMLS_DC)
 #else
                        http_error(HE_WARNING, HTTP_E_RUNTIME, "HTTP requests not supported - ext/http was not linked against libcurl.");
 #endif
-               }
                break;
+               }
 
                case HTTP_MSG_NONE:
                default:
                        http_error(HE_WARNING, HTTP_E_MESSAGE_TYPE, "HttpMessage is neither of type HTTP_MSG_REQUEST nor HTTP_MSG_RESPONSE");
-               break;
+                       break;
        }
 
        return rs;
@@ -616,19 +610,18 @@ PHP_HTTP_API void _http_message_dtor(http_message *message)
                zend_hash_destroy(&message->hdrs);
                phpstr_dtor(PHPSTR(message));
                
-               switch (message->type)
-               {
+               switch (message->type) {
                        case HTTP_MSG_REQUEST:
                                STR_SET(message->http.info.request.method, NULL);
                                STR_SET(message->http.info.request.url, NULL);
-                       break;
+                               break;
                        
                        case HTTP_MSG_RESPONSE:
                                STR_SET(message->http.info.response.status, NULL);
-                       break;
+                               break;
                        
                        default:
-                       break;
+                               break;
                }
        }
 }
index 3c90c58d4162524684e1fe0c802684e1d69cd2cc..9a62af44a171bfa18bc7f5eb1fe96fb5dc85f4f8 100644 (file)
@@ -410,24 +410,24 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                case HTTP_MSG_PROPHASH_TYPE:
                case HTTP_MSG_CHILD_PROPHASH_TYPE:
                        RETVAL_LONG(msg->type);
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_HTTP_VERSION:
                case HTTP_MSG_CHILD_PROPHASH_HTTP_VERSION:
                        RETVAL_DOUBLE(msg->http.version);
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_BODY:
                case HTTP_MSG_CHILD_PROPHASH_BODY:
                        phpstr_fix(PHPSTR(msg));
                        RETVAL_PHPSTR(PHPSTR(msg), 0, 1);
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_HEADERS:
                case HTTP_MSG_CHILD_PROPHASH_HEADERS:
                        array_init(return_value);
                        zend_hash_copy(Z_ARRVAL_P(return_value), &msg->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_PARENT_MESSAGE:
                case HTTP_MSG_CHILD_PROPHASH_PARENT_MESSAGE:
@@ -436,7 +436,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                        } else {
                                RETVAL_NULL();
                        }
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_REQUEST_METHOD:
                case HTTP_MSG_CHILD_PROPHASH_REQUEST_METHOD:
@@ -445,7 +445,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                        } else {
                                RETVAL_NULL();
                        }
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_REQUEST_URL:
                case HTTP_MSG_CHILD_PROPHASH_REQUEST_URL:
@@ -454,7 +454,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                        } else {
                                RETVAL_NULL();
                        }
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_RESPONSE_CODE:
                case HTTP_MSG_CHILD_PROPHASH_RESPONSE_CODE:
@@ -463,7 +463,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                        } else {
                                RETVAL_NULL();
                        }
-               break;
+                       break;
                
                case HTTP_MSG_PROPHASH_RESPONSE_STATUS:
                case HTTP_MSG_CHILD_PROPHASH_RESPONSE_STATUS:
@@ -472,7 +472,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                        } else {
                                RETVAL_NULL();
                        }
-               break;
+                       break;
                
                default:
 #ifdef WONKY
@@ -480,7 +480,6 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
 #else
                        RETVAL_NULL();
 #endif
-               break;
        }
 
        return return_value;
@@ -514,27 +513,27 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                case HTTP_MSG_CHILD_PROPHASH_TYPE:
                        convert_to_long(cpy);
                        http_message_set_type(msg, Z_LVAL_P(cpy));
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_HTTP_VERSION:
                case HTTP_MSG_CHILD_PROPHASH_HTTP_VERSION:
                        convert_to_double(cpy);
                        msg->http.version = Z_DVAL_P(cpy);
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_BODY:
                case HTTP_MSG_CHILD_PROPHASH_BODY:
                        convert_to_string(cpy);
                        phpstr_dtor(PHPSTR(msg));
                        phpstr_from_string_ex(PHPSTR(msg), Z_STRVAL_P(cpy), Z_STRLEN_P(cpy));
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_HEADERS:
                case HTTP_MSG_CHILD_PROPHASH_HEADERS:
                        convert_to_array(cpy);
                        zend_hash_clean(&msg->hdrs);
                        zend_hash_copy(&msg->hdrs, Z_ARRVAL_P(cpy), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_PARENT_MESSAGE:
                case HTTP_MSG_CHILD_PROPHASH_PARENT_MESSAGE:
@@ -547,7 +546,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                                Z_OBJ_ADDREF_P(value);
                                obj->parent = value->value.obj;
                        }
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_REQUEST_METHOD:
                case HTTP_MSG_CHILD_PROPHASH_REQUEST_METHOD:
@@ -555,7 +554,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                                convert_to_string(cpy);
                                STR_SET(msg->http.info.request.method, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
                        }
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_REQUEST_URL:
                case HTTP_MSG_CHILD_PROPHASH_REQUEST_URL:
@@ -563,7 +562,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                                convert_to_string(cpy);
                                STR_SET(msg->http.info.request.url, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
                        }
-               break;
+                       break;
 
                case HTTP_MSG_PROPHASH_RESPONSE_CODE:
                case HTTP_MSG_CHILD_PROPHASH_RESPONSE_CODE:
@@ -571,7 +570,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                                convert_to_long(cpy);
                                msg->http.info.response.code = Z_LVAL_P(cpy);
                        }
-               break;
+                       break;
                
                case HTTP_MSG_PROPHASH_RESPONSE_STATUS:
                case HTTP_MSG_CHILD_PROPHASH_RESPONSE_STATUS:
@@ -579,13 +578,13 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
                                convert_to_string(cpy);
                                STR_SET(msg->http.info.response.status, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
                        }
-               break;
+                       break;
                
                default:
 #ifdef WONKY
                        zend_get_std_object_handlers()->write_property(object, member, value TSRMLS_CC);
 #endif
-               break;
+                       break;
        }
        zval_free(&cpy);
 }
@@ -621,21 +620,20 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC)
        ASSOC_PROP(array, long, "type", msg->type);
        ASSOC_PROP(array, double, "httpVersion", msg->http.version);
 
-       switch (msg->type)
-       {
+       switch (msg->type) {
                case HTTP_MSG_REQUEST:
                        ASSOC_PROP(array, long, "responseCode", 0);
                        ASSOC_STRINGL(array, "responseStatus", "", 0);
                        ASSOC_STRING(array, "requestMethod", msg->http.info.request.method);
                        ASSOC_STRING(array, "requestUrl", msg->http.info.request.url);
-               break;
+                       break;
 
                case HTTP_MSG_RESPONSE:
                        ASSOC_PROP(array, long, "responseCode", msg->http.info.response.code);
                        ASSOC_STRING(array, "responseStatus", msg->http.info.response.status);
                        ASSOC_STRINGL(array, "requestMethod", "", 0);
                        ASSOC_STRINGL(array, "requestUrl", "", 0);
-               break;
+                       break;
 
                case HTTP_MSG_NONE:
                default:
@@ -643,7 +641,7 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC)
                        ASSOC_STRINGL(array, "responseStatus", "", 0);
                        ASSOC_STRINGL(array, "requestMethod", "", 0);
                        ASSOC_STRINGL(array, "requestUrl", "", 0);
-               break;
+                       break;
        }
 
        MAKE_STD_ZVAL(headers);
@@ -1219,8 +1217,7 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
        if (return_value_used) {
                getObject(http_message_object, obj);
                
-               switch (obj->message->type)
-               {
+               switch (obj->message->type) {
                        case HTTP_MSG_REQUEST:
                        {
 #ifdef HTTP_HAVE_CURL
@@ -1263,8 +1260,8 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
 #else
                                http_error(HE_WARNING, HTTP_E_RUNTIME, "Cannot transform HttpMessage to HttpRequest (missing curl support)");
 #endif
+                               break;
                        }
-                       break;
                        
                        case HTTP_MSG_RESPONSE:
                        {
@@ -1288,8 +1285,7 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
                                                INIT_PZVAL(&zkey);
                                                ZVAL_STRINGL(&zkey, key, key_len, 0);
                                                
-                                               switch (Z_TYPE_PP(header))
-                                               {
+                                               switch (Z_TYPE_PP(header)) {
                                                        case IS_ARRAY:
                                                        case IS_OBJECT:
                                                                FOREACH_HASH_VAL(pos2, HASH_OF(*header), h) {
@@ -1297,13 +1293,13 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
                                                                        zend_call_method_with_2_params(&return_value, http_response_object_ce, NULL, "setheader", NULL, &zkey, *h);
                                                                        zval_ptr_dtor(h);
                                                                }
-                                                       break;
+                                                               break;
                                                        
                                                        default:
                                                                ZVAL_ADDREF(*header);
                                                                zend_call_method_with_2_params(&return_value, http_response_object_ce, NULL, "setheader", NULL, &zkey, *header);
                                                                zval_ptr_dtor(header);
-                                                       break;
+                                                               break;
                                                }
                                                key = NULL;
                                        }
@@ -1316,12 +1312,12 @@ PHP_METHOD(HttpMessage, toMessageTypeObject)
 #else
                                http_error(HE_WARNING, HTTP_E_RUNTIME, "Cannot transform HttpMessage to HttpResponse (need PHP 5.1+)");
 #endif
+                               break;
                        }
-                       break;
                        
                        default:
                                http_error(HE_WARNING, HTTP_E_MESSAGE_TYPE, "HttpMessage is neither of type HttpMessage::TYPE_REQUEST nor HttpMessage::TYPE_RESPONSE");
-                       break;
+                               break;
                }
        }
        SET_EH_NORMAL();
index 7db43decc0784f98142f245c18367f14723a9e09..d0eed53d14942490d5f43db6a464055b8930518b 100644 (file)
@@ -327,8 +327,7 @@ PHP_METHOD(HttpQueryString, get)
                                if (Z_TYPE_P(ztype) == IS_LONG) {
                                        type = Z_LVAL_P(ztype);
                                } else if(Z_TYPE_P(ztype) == IS_STRING) {
-                                       switch (Z_STRVAL_P(ztype)[0])
-                                       {
+                                       switch (Z_STRVAL_P(ztype)[0]) {
                                                case 'B': 
                                                case 'b':       type = HTTP_QUERYSTRING_TYPE_BOOL;              break;
                                                case 'I':
index b101558d54952b040e5b514234aa621a275e4e8a..1addfd96d0b418cd0a8d33a0e3ccc4a85aea57e4 100644 (file)
@@ -838,23 +838,22 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
        }
 
        /* request method */
-       switch (request->meth)
-       {
+       switch (request->meth) {
                case HTTP_GET:
                        HTTP_CURL_OPT(CURLOPT_HTTPGET, 1);
-               break;
+                       break;
 
                case HTTP_HEAD:
                        HTTP_CURL_OPT(CURLOPT_NOBODY, 1);
-               break;
+                       break;
 
                case HTTP_POST:
                        HTTP_CURL_OPT(CURLOPT_POST, 1);
-               break;
+                       break;
 
                case HTTP_PUT:
                        HTTP_CURL_OPT(CURLOPT_UPLOAD, 1);
-               break;
+                       break;
 
                default:
                        if (http_request_method_exists(0, request->meth, NULL)) {
@@ -863,20 +862,19 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
                                http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD, "Unsupported request method: %d (%s)", request->meth, request->url);
                                return FAILURE;
                        }
-               break;
+                       break;
        }
 
        /* attach request body */
        if (request->body && (request->meth != HTTP_GET) && (request->meth != HTTP_HEAD) && (request->meth != HTTP_OPTIONS)) {
-               switch (request->body->type)
-               {
+               switch (request->body->type) {
                        case HTTP_REQUEST_BODY_EMPTY:
                                /* nothing */
-                       break;
+                               break;
                        
                        case HTTP_REQUEST_BODY_CURLPOST:
                                HTTP_CURL_OPT(CURLOPT_HTTPPOST, (struct curl_httppost *) request->body->data);
-                       break;
+                               break;
 
                        case HTTP_REQUEST_BODY_CSTRING:
                                if (request->meth != HTTP_PUT) {
@@ -889,13 +887,12 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
                                HTTP_CURL_OPT(CURLOPT_IOCTLDATA, request);
                                HTTP_CURL_OPT(CURLOPT_READDATA, request);
                                HTTP_CURL_OPT(CURLOPT_INFILESIZE, request->body->size);
-                       break;
+                               break;
 
                        default:
                                /* shouldn't ever happen */
                                http_error_ex(HE_ERROR, 0, "Unknown request body type: %d (%s)", request->body->type, request->url);
                                return FAILURE;
-                       break;
                }
        }
 
@@ -961,8 +958,7 @@ static size_t http_curl_read_callback(void *data, size_t len, size_t n, void *ct
        TSRMLS_FETCH_FROM_CTX(request->tsrm_ls);
        
        if (request->body) {
-               switch (request->body->type)
-               {
+               switch (request->body->type) {
                        case HTTP_REQUEST_BODY_CSTRING:
                        {
                                size_t out = MIN(len * n, request->body->size - request->body->priv);
@@ -972,12 +968,11 @@ static size_t http_curl_read_callback(void *data, size_t len, size_t n, void *ct
                                        request->body->priv += out;
                                        return out;
                                }
+                               break;
                        }
-                       break;
                        
                        case HTTP_REQUEST_BODY_UPLOADFILE:
                                return php_stream_read((php_stream *) request->body->data, data, len * n);
-                       break;
                }
        }
        return 0;
@@ -1023,18 +1018,17 @@ static curlioerr http_curl_ioctl_callback(CURL *ch, curliocmd cmd, void *ctx)
        }
        
        if (request->body) {
-               switch (request->body->type)
-               {
+               switch (request->body->type) {
                        case HTTP_REQUEST_BODY_CSTRING:
                                request->body->priv = 0;
                                return CURLIOE_OK;
-                       break;
+                               break;
                                
                        case HTTP_REQUEST_BODY_UPLOADFILE:
                                if (SUCCESS == php_stream_rewind((php_stream *) request->body->data)) {
                                        return CURLIOE_OK;
                                }
-                       break;
+                               break;
                }
        }
        
@@ -1047,22 +1041,21 @@ static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size
 {
        http_request *request = (http_request *) ctx;
 
-       switch (type)
-       {
+       switch (type) {
                case CURLINFO_DATA_IN:
                        if (request->conv.last_type == CURLINFO_HEADER_IN) {
                                phpstr_appends(&request->conv.response, HTTP_CRLF);
                        }
                case CURLINFO_HEADER_IN:
                        phpstr_append(&request->conv.response, data, length);
-               break;
+                       break;
                case CURLINFO_DATA_OUT:
                        if (request->conv.last_type == CURLINFO_HEADER_OUT) {
                                phpstr_appends(&request->conv.request, HTTP_CRLF);
                        }
                case CURLINFO_HEADER_OUT:
                        phpstr_append(&request->conv.request, data, length);
-               break;
+                       break;
                default:
 #if 0
                        fprintf(stderr, "## ", type);
@@ -1082,7 +1075,7 @@ static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size
                                fprintf(stderr, "\n");
                        }
 #endif
-               break;
+                       break;
        }
 
        if (type) {
index fcaa635d00f54603a9ba1c820aa944e70427cef1..816e9c26abe778e3ea4352388cad4a545f87bb7f 100644 (file)
@@ -149,21 +149,20 @@ PHP_HTTP_API void _http_request_body_dtor(http_request_body *body TSRMLS_DC)
 {
        if (body) {
                if (body->free) {
-                       switch (body->type)
-                       {
+                       switch (body->type) {
                                case HTTP_REQUEST_BODY_CSTRING:
                                        if (body->data) {
                                                efree(body->data);
                                        }
-                               break;
+                                       break;
        
                                case HTTP_REQUEST_BODY_CURLPOST:
                                        curl_formfree(body->data);
-                               break;
+                                       break;
        
                                case HTTP_REQUEST_BODY_UPLOADFILE:
                                        php_stream_close(body->data);
-                               break;
+                                       break;
                        }
                }
                memset(body, 0, sizeof(http_request_body));
index 498dbe2f54b6644cc6fa0b9231c84dd4696fe35e..1d73ddda5b4a447acea1b2f7ea54ebdfe4d9485a 100644 (file)
@@ -190,12 +190,11 @@ PHP_HTTP_API int _http_request_method_register(const char *method_name, int meth
        method = emalloc(method_name_len + 1);
        mconst = emalloc(method_name_len + 1);
        for (i = 0; i < method_name_len; ++i) {
-               switch (method_name[i])
-               {
+               switch (method_name[i]) {
                        case '-':
                                method[i] = '-';
                                mconst[i] = '_';
-                       break;
+                               break;
                        
                        default:
                                if (!isalnum(method_name[i])) {
@@ -205,7 +204,7 @@ PHP_HTTP_API int _http_request_method_register(const char *method_name, int meth
                                        return 0;
                                }
                                mconst[i] = method[i] = toupper(method_name[i]);
-                       break;
+                               break;
                }
        }
        method[method_name_len] = '\0';
index 1c0f39a6b106774320dcb785e58b851a9b1e71c9..7fa8ead74710fc894fb3d1cc983ee8a0ce537fad 100644 (file)
@@ -524,7 +524,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
        {
                case HTTP_GET:
                case HTTP_HEAD:
-               break;
+                       break;
 
                case HTTP_PUT:
                {
@@ -544,8 +544,8 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
                                        status = FAILURE;
                                }
                        }
+                       break;
                }
-               break;
 
                case HTTP_POST:
                default:
@@ -571,8 +571,8 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
                                        }
                                }
                        }
+                       break;
                }
-               break;
        }
 
        if (status == SUCCESS) {
index 7d2f390c1644d96d0556d14b84dc2185c336b394..6f6cf4dab10bb503bf4074a5bcc670948af68cbb 100644 (file)
@@ -573,8 +573,8 @@ PHP_METHOD(HttpResponse, guessContentType)
                        {
                                zval *data = GET_STATIC_PROP(data);
                                ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(data), Z_STRLEN_P(data), SEND_DATA);
+                               break;
                        }
-                       break;
                        
                        case SEND_RSRC:
                        {
@@ -583,12 +583,12 @@ PHP_METHOD(HttpResponse, guessContentType)
                                z->type = IS_RESOURCE;
                                php_stream_from_zval(s, &z);
                                ct = http_guess_content_type(magic_file, magic_mode, s, 0, SEND_RSRC);
+                               break;
                        }
-                       break;
                        
                        default:
                                ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(GET_STATIC_PROP(file)), 0, -1);
-                       break;
+                               break;
                }
                if (ct) {
                        UPD_STATIC_PROP(string, contentType, ct);
@@ -1156,8 +1156,7 @@ PHP_METHOD(HttpResponse, send)
        php_start_ob_buffer(NULL, HTTP_G->send.buffer_size, 0 TSRMLS_CC);
 
        /* send */
-       switch (Z_LVAL_P(GET_STATIC_PROP(mode)))
-       {
+       switch (Z_LVAL_P(GET_STATIC_PROP(mode))) {
                case SEND_DATA:
                {
                        zval *zdata_p, *zdata = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(data), &zdata_p);
index 93271dbd68ac407689eb09bd9b3f50881ddae0a9..10b02f69663095feb7a7576edae547274cb99d44 100644 (file)
@@ -106,8 +106,7 @@ static inline void _http_send_response_data_fetch(void **buffer, const void *dat
        char *buf;
        long got, len = end - begin;
        
-       switch (mode)
-       {
+       switch (mode) {
                case SEND_RSRC:
                {
                        php_stream *s = (php_stream *) data;
@@ -123,8 +122,8 @@ static inline void _http_send_response_data_fetch(void **buffer, const void *dat
                                
                                efree(buf);
                        }
+                       break;
                }
-               break;
 
                case SEND_DATA:
                {
@@ -136,8 +135,8 @@ static inline void _http_send_response_data_fetch(void **buffer, const void *dat
                                len -= got;
                                buf += got;
                        }
+                       break;
                }
-               break;
 
                EMPTY_SWITCH_DEFAULT_CASE();
        }
@@ -314,8 +313,7 @@ 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);
 
-       switch (range_status)
-       {
+       switch (range_status) {
                case RANGE_ERR:
                {
                        zend_hash_destroy(&ranges);
@@ -493,8 +491,7 @@ PHP_HTTP_API char *_http_guess_content_type(const char *magicfile, long magicmod
                
                magic_setflags(magic, magicmode);
                
-               switch (data_mode)
-               {
+               switch (data_mode) {
                        case SEND_RSRC:
                        {
                                char *buffer;
@@ -503,17 +500,17 @@ PHP_HTTP_API char *_http_guess_content_type(const char *magicfile, long magicmod
                                b_len = php_stream_copy_to_mem(data_ptr, &buffer, 65536, 0);
                                ctype = magic_buffer(magic, buffer, b_len);
                                efree(buffer);
+                               break;
                        }
-                       break;
                        
                        case SEND_DATA:
                                ctype = magic_buffer(magic, data_ptr, data_len);
-                       break;
+                               break;
                        
                        default:
                                HTTP_CHECK_OPEN_BASEDIR(data_ptr, magic_close(magic); return NULL);
                                ctype = magic_file(magic, data_ptr);
-                       break;
+                               break;
                }
                
                if (ctype) {
index 827c7b6a2c5d6c1db62c459deb9af71ed7aaa011..65116ae0d4fe7e8028a3cfbe7b3ff570ee56461e 100644 (file)
@@ -105,10 +105,10 @@ PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_u
        if (!(flags & HTTP_URL_STRIP_PORT)) {
                url->port = (new_url&&new_url->port) ? new_url->port : ((old_url) ? old_url->port : 0);
        }
-       if ((!(flags & HTTP_URL_STRIP_AUTH)) && (!(flags & HTTP_URL_STRIP_USER))) {
+       if (!(flags & HTTP_URL_STRIP_USER)) {
                __URLCPY(user);
        }
-       if ((!(flags & HTTP_URL_STRIP_AUTH)) && (!(flags & HTTP_URL_STRIP_PASS))) {
+       if (!(flags & HTTP_URL_STRIP_PASS)) {
                __URLCPY(pass);
        }
        
@@ -160,19 +160,17 @@ PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_u
                zval *https = http_get_server_var("HTTPS");
                if (https && !strcasecmp(Z_STRVAL_P(https), "ON")) {
                        url->scheme = estrndup("https", lenof("https"));
-               } else
-               switch (url->port)
-               {
+               } else switch (url->port) {
                        case 443:
                                url->scheme = estrndup("https", lenof("https"));
-                       break;
+                               break;
 
 #ifndef HTTP_HAVE_NETDB
                        default:
 #endif
                        case 80:
                                url->scheme = estrndup("http", lenof("http"));
-                       break;
+                               break;
                        
 #ifdef HTTP_HAVE_NETDB
                        default:
@@ -181,7 +179,7 @@ PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_u
                                } else {
                                        url->scheme = estrndup("http", lenof("http"));
                                }
-                       break;
+                               break;
 #endif
                }
        }
@@ -229,15 +227,14 @@ PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_u
                char *ptr, *end = url->path + strlen(url->path) + 1;
                        
                for (ptr = strstr(url->path, "/."); ptr; ptr = strstr(ptr, "/.")) {
-                       switch (ptr[2])
-                       {
+                       switch (ptr[2]) {
                                case '\0':
                                        ptr[1] = '\0';
-                               break;
+                                       break;
                                
                                case '/':
                                        memmove(&ptr[1], &ptr[3], end - &ptr[3]);
-                               break;
+                                       break;
                                        
                                case '.':
                                        if (ptr[3] == '/') {
@@ -249,12 +246,12 @@ PHP_HTTP_API void _http_build_url(int flags, const php_url *old_url, const php_u
                                                }
                                                memmove(&ptr[1], pos, end - pos);
                                        }
-                               break;
+                                       break;
                                
                                default:
                                        /* something else */
                                        ++ptr;
-                               break;
+                                       break;
                        }
                }
        }
index ac56e9a295602976d8a6fe8c86ed060d2b8e2dcf..05b9a107ef79e7a80104faca9c988d7b947f88fd 100644 (file)
@@ -165,8 +165,7 @@ static inline const char *_http_locate_eol(const char *line, int *eol_len)
 static inline zval *_convert_to_type(int type, zval *z)
 {
        if (Z_TYPE_P(z) != type) {
-               switch (type)
-               {
+               switch (type) {
                        case IS_NULL:   convert_to_null(z);             break;
                        case IS_BOOL:   convert_to_boolean(z);  break;
                        case IS_LONG:   convert_to_long(z);             break;
@@ -183,8 +182,7 @@ static inline zval *_convert_to_type_ex(int type, zval *z, zval **p)
 {
        *p = z;
        if (Z_TYPE_P(z) != type) {
-               switch (type)
-               {
+               switch (type) {
                        case IS_NULL:   convert_to_null_ex(&z);         break;
                        case IS_BOOL:   convert_to_boolean_ex(&z);      break;
                        case IS_LONG:   convert_to_long_ex(&z);         break;
index fbb4ae1c991b020c74bda4a67975a1c532d88e44..4d5cb46059aa7457940fc15fc3199ad4b94a2d5d 100644 (file)
@@ -27,7 +27,7 @@ PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC);
 #define HTTP_URL_JOIN_QUERY            0x002
 #define HTTP_URL_STRIP_USER            0x004
 #define HTTP_URL_STRIP_PASS            0x008
-#define HTTP_URL_STRIP_AUTH            0x010
+#define HTTP_URL_STRIP_AUTH            (HTTP_URL_STRIP_USER|HTTP_URL_STRIP_PASS)
 #define HTTP_URL_STRIP_PORT            0x020
 #define HTTP_URL_STRIP_PATH            0x040
 #define HTTP_URL_STRIP_QUERY   0x080
@@ -108,8 +108,7 @@ static inline HashTable *_http_url_tostruct(php_url *url, zval *strct TSRMLS_DC)
        zval arr;
        
        if (strct) {
-               switch (Z_TYPE_P(strct))
-               {
+               switch (Z_TYPE_P(strct)) {
                        default:
                                zval_dtor(strct);
                                array_init(strct);