diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-02-10 10:45:07 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-02-10 10:45:07 +0000 |
commit | 8d94472903d973b0edc957a0fb31f272c2225846 (patch) | |
tree | 50872b8392c07f3da0d57f71421d4f60813e8a54 /pjlib-util/src/pjlib-util/http_client.c | |
parent | b144802c32088741a340a85101e734dc4603995a (diff) |
More ticket #1018: fixed some more warnings about pointer conversions, or errors if the library is compiled in C++ mode (thanks Atik Khan for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3095 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/src/pjlib-util/http_client.c')
-rw-r--r-- | pjlib-util/src/pjlib-util/http_client.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pjlib-util/src/pjlib-util/http_client.c b/pjlib-util/src/pjlib-util/http_client.c index 2b7585d5..bff68e2a 100644 --- a/pjlib-util/src/pjlib-util/http_client.c +++ b/pjlib-util/src/pjlib-util/http_client.c @@ -56,7 +56,7 @@ enum http_protocol PROTOCOL_HTTPS }; -static char *http_protocol_names[NUM_PROTOCOL] = +static const char *http_protocol_names[NUM_PROTOCOL] = { "HTTP", "HTTPS" @@ -75,7 +75,7 @@ enum http_method HTTP_DELETE }; -static char *http_method_names[3] = +static const char *http_method_names[3] = { "GET", "PUT", @@ -155,7 +155,7 @@ static pj_uint16_t get_http_default_port(const pj_str_t *protocol) return 0; } -static char * get_protocol(const pj_str_t *protocol) +static const char * get_protocol(const pj_str_t *protocol) { int i; @@ -469,7 +469,7 @@ static pj_status_t http_response_parse(pj_pool_t *pool, { pj_size_t i; char *cptr; - void *newdata; + char *newdata; pj_scanner scanner; pj_str_t s; pj_status_t status; @@ -501,7 +501,7 @@ static pj_status_t http_response_parse(pj_pool_t *pool, pj_bzero(response, sizeof(response)); response->content_length = -1; - newdata = pj_pool_alloc(pool, i); + newdata = (char*) pj_pool_alloc(pool, i); pj_memcpy(newdata, data, i); /* Parse the status-line. */ @@ -523,7 +523,7 @@ static pj_status_t http_response_parse(pj_pool_t *pool, PJ_END; /* Parse the response headers. */ - size = i - 2 - (scanner.curptr - (char *)newdata); + size = i - 2 - (scanner.curptr - newdata); if (size > 0) { status = http_headers_parse(scanner.curptr + 1, size, &response->headers); @@ -604,8 +604,8 @@ PJ_DEF(void) pj_http_req_param_default(pj_http_req_param *param) pj_assert(param); pj_bzero(param, sizeof(*param)); param->addr_family = pj_AF_INET(); - pj_strset2(¶m->method, http_method_names[HTTP_GET]); - pj_strset2(¶m->version, HTTP_1_0); + pj_strset2(¶m->method, (char*)http_method_names[HTTP_GET]); + pj_strset2(¶m->version, (char*)HTTP_1_0); param->timeout.msec = PJ_HTTP_DEFAULT_TIMEOUT; pj_time_val_normalize(¶m->timeout); } @@ -630,9 +630,11 @@ PJ_DEF(pj_status_t) pj_http_req_parse_url(const pj_str_t *url, /* Parse the protocol */ pj_scan_get_until_ch(&scanner, ':', &s); if (!pj_stricmp2(&s, http_protocol_names[PROTOCOL_HTTP])) { - pj_strset2(&hurl->protocol, http_protocol_names[PROTOCOL_HTTP]); + pj_strset2(&hurl->protocol, + (char*)http_protocol_names[PROTOCOL_HTTP]); } else if (!pj_stricmp2(&s, http_protocol_names[PROTOCOL_HTTPS])) { - pj_strset2(&hurl->protocol, http_protocol_names[PROTOCOL_HTTPS]); + pj_strset2(&hurl->protocol, + (char*)http_protocol_names[PROTOCOL_HTTPS]); } else { PJ_THROW(PJ_ENOTSUP); // unsupported protocol } @@ -912,7 +914,7 @@ static pj_status_t http_req_start_sending(pj_http_req *hreq) pkt.ptr[pkt.slen] = 0; TRACE_((THIS_FILE, "%s", pkt.ptr)); } else { - pkt.ptr = hreq->param.reqdata.data; + pkt.ptr = (char*)hreq->param.reqdata.data; pkt.slen = hreq->param.reqdata.size; } |