Changeset 3095


Ignore:
Timestamp:
Feb 10, 2010 10:45:07 AM (11 years ago)
Author:
bennylp
Message:

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)

Location:
pjproject/trunk/pjlib-util/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util-test/http_client.c

    r3089 r3095  
    6868 
    6969    while (!thread_quit) { 
    70         char *pkt = pj_pool_alloc(pool, srv->buf_size); 
     70        char *pkt = (char*)pj_pool_alloc(pool, srv->buf_size); 
    7171        pj_ssize_t pkt_len; 
    7272        int rc; 
     
    155155    send_size += sendsz; 
    156156 
    157     sdata = pj_pool_alloc(pool, sendsz); 
     157    sdata = (char*)pj_pool_alloc(pool, sendsz); 
    158158    pj_create_random_string(sdata, sendsz); 
    159159    pj_ansi_sprintf(sdata, "\nSegment #%d\n", ++counter); 
     
    419419#endif 
    420420 
    421     pj_http_headers_add_elmt2(&param.headers, "Accept",  
    422                               "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"); 
    423     pj_http_headers_add_elmt2(&param.headers, "Accept-Language", "en-sg"); 
    424     pj_http_headers_add_elmt2(&param.headers, "User-Agent",  
    425                               "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)"); 
     421    pj_http_headers_add_elmt2(&param.headers, (char*)"Accept", 
     422                             (char*)"image/gif, image/x-xbitmap, image/jpeg, " 
     423                                    "image/pjpeg, application/x-ms-application," 
     424                                    " application/vnd.ms-xpsdocument, " 
     425                                    "application/xaml+xml, " 
     426                                    "application/x-ms-xbap, " 
     427                                    "application/x-shockwave-flash, " 
     428                                    "application/vnd.ms-excel, " 
     429                                    "application/vnd.ms-powerpoint, " 
     430                                    "application/msword, */*"); 
     431    pj_http_headers_add_elmt2(&param.headers, (char*)"Accept-Language", 
     432                              (char*)"en-sg"); 
     433    pj_http_headers_add_elmt2(&param.headers, (char*)"User-Agent", 
     434                              (char*)"Mozilla/4.0 (compatible; MSIE 7.0; " 
     435                                     "Windows NT 6.0; SLCC1; " 
     436                                     ".NET CLR 2.0.50727; " 
     437                                     ".NET CLR 3.0.04506)"); 
    426438    if (pj_http_req_create(pool, &url, timer_heap, ioqueue,  
    427439                           &param, &hcb, &http_req)) 
     
    523535 
    524536    pj_http_req_param_default(&param); 
    525     pj_strset2(&param.method, "PUT"); 
    526     data = pj_pool_alloc(pool, length); 
     537    pj_strset2(&param.method, (char*)"PUT"); 
     538    data = (char*)pj_pool_alloc(pool, length); 
    527539    pj_create_random_string(data, length); 
    528540    pj_ansi_sprintf(data, "PUT test\n"); 
     
    613625 
    614626    pj_http_req_param_default(&param); 
    615     pj_strset2(&param.method, "PUT"); 
     627    pj_strset2(&param.method, (char*)"PUT"); 
    616628    total_size = 15383; 
    617629    send_size = 0; 
     
    694706 
    695707    pj_http_req_param_default(&param); 
    696     pj_strset2(&param.method, "DELETE"); 
     708    pj_strset2(&param.method, (char*)"DELETE"); 
    697709    if (pj_http_req_create(pool, &url, timer_heap, ioqueue,  
    698710                           &param, &hcb, &http_req)) 
  • pjproject/trunk/pjlib-util/src/pjlib-util/http_client.c

    r3092 r3095  
    5757}; 
    5858 
    59 static char *http_protocol_names[NUM_PROTOCOL] = 
     59static const char *http_protocol_names[NUM_PROTOCOL] = 
    6060{ 
    6161    "HTTP", 
     
    7676}; 
    7777 
    78 static char *http_method_names[3] = 
     78static const char *http_method_names[3] = 
    7979{ 
    8080    "GET", 
     
    156156} 
    157157 
    158 static char * get_protocol(const pj_str_t *protocol) 
     158static const char * get_protocol(const pj_str_t *protocol) 
    159159{ 
    160160    int i; 
     
    470470    pj_size_t i; 
    471471    char *cptr; 
    472     void *newdata; 
     472    char *newdata; 
    473473    pj_scanner scanner; 
    474474    pj_str_t s; 
     
    502502    response->content_length = -1; 
    503503 
    504     newdata = pj_pool_alloc(pool, i); 
     504    newdata = (char*) pj_pool_alloc(pool, i); 
    505505    pj_memcpy(newdata, data, i); 
    506506 
     
    524524 
    525525    /* Parse the response headers. */ 
    526     size = i - 2 - (scanner.curptr - (char *)newdata); 
     526    size = i - 2 - (scanner.curptr - newdata); 
    527527    if (size > 0) { 
    528528        status = http_headers_parse(scanner.curptr + 1, size,  
     
    605605    pj_bzero(param, sizeof(*param)); 
    606606    param->addr_family = pj_AF_INET(); 
    607     pj_strset2(&param->method, http_method_names[HTTP_GET]); 
    608     pj_strset2(&param->version, HTTP_1_0); 
     607    pj_strset2(&param->method, (char*)http_method_names[HTTP_GET]); 
     608    pj_strset2(&param->version, (char*)HTTP_1_0); 
    609609    param->timeout.msec = PJ_HTTP_DEFAULT_TIMEOUT; 
    610610    pj_time_val_normalize(&param->timeout); 
     
    631631        pj_scan_get_until_ch(&scanner, ':', &s); 
    632632        if (!pj_stricmp2(&s, http_protocol_names[PROTOCOL_HTTP])) { 
    633             pj_strset2(&hurl->protocol, http_protocol_names[PROTOCOL_HTTP]); 
     633            pj_strset2(&hurl->protocol, 
     634                       (char*)http_protocol_names[PROTOCOL_HTTP]); 
    634635        } else if (!pj_stricmp2(&s, http_protocol_names[PROTOCOL_HTTPS])) { 
    635             pj_strset2(&hurl->protocol, http_protocol_names[PROTOCOL_HTTPS]); 
     636            pj_strset2(&hurl->protocol, 
     637                       (char*)http_protocol_names[PROTOCOL_HTTPS]); 
    636638        } else { 
    637639            PJ_THROW(PJ_ENOTSUP); // unsupported protocol 
     
    913915        TRACE_((THIS_FILE, "%s", pkt.ptr)); 
    914916    } else { 
    915         pkt.ptr = hreq->param.reqdata.data; 
     917        pkt.ptr = (char*)hreq->param.reqdata.data; 
    916918        pkt.slen = hreq->param.reqdata.size; 
    917919    } 
Note: See TracChangeset for help on using the changeset viewer.