Changeset 5377


Ignore:
Timestamp:
Jul 5, 2016 1:21:31 PM (3 years ago)
Author:
nanang
Message:

Misc (re #1928): Reverted back some dirty changes in r5376 about address info indexing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c

    r5376 r5377  
    187187 
    188188    /* Enumerate each item in the result */ 
    189     rc = 0; 
    190189    for (i=0; i<*count && res; res=res->ai_next) { 
    191190        /* Ignore unwanted address families */ 
     
    195194        /* Store canonical name (possibly truncating the name) */ 
    196195        if (res->ai_canonname) { 
    197             pj_ansi_strncpy(ai[rc].ai_canonname, res->ai_canonname, 
    198                             sizeof(ai[rc].ai_canonname)); 
    199             ai[rc].ai_canonname[sizeof(ai[rc].ai_canonname)-1] = '\0'; 
     196            pj_ansi_strncpy(ai[i].ai_canonname, res->ai_canonname, 
     197                            sizeof(ai[i].ai_canonname)); 
     198            ai[i].ai_canonname[sizeof(ai[i].ai_canonname)-1] = '\0'; 
    200199        } else { 
    201             pj_ansi_strcpy(ai[rc].ai_canonname, nodecopy); 
     200            pj_ansi_strcpy(ai[i].ai_canonname, nodecopy); 
    202201        } 
    203202 
    204203        /* Store address */ 
    205204        PJ_ASSERT_ON_FAIL(res->ai_addrlen <= sizeof(pj_sockaddr), continue); 
    206         pj_memcpy(&ai[rc].ai_addr, res->ai_addr, res->ai_addrlen); 
    207         PJ_SOCKADDR_RESET_LEN(&ai[rc].ai_addr); 
     205        pj_memcpy(&ai[i].ai_addr, res->ai_addr, res->ai_addrlen); 
     206        PJ_SOCKADDR_RESET_LEN(&ai[i].ai_addr); 
    208207 
    209208        /* Next slot */ 
    210         ++rc; 
    211     } 
    212  
    213     *count = rc; 
     209        ++i; 
     210    } 
     211 
     212    *count = i; 
    214213 
    215214    freeaddrinfo(orig_res); 
Note: See TracChangeset for help on using the changeset viewer.