VirtualBox

Changeset 43213 in vbox for trunk/src/VBox/ExtPacks/VNC


Ignore:
Timestamp:
Sep 6, 2012 8:37:56 AM (12 years ago)
Author:
vboxsync
Message:

RTSocketGetAddrInfo -> RTSocketQueryAddressStr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ExtPacks/VNC/VBoxVNC.cpp

    r43171 r43213  
    337337    uint32_t cbOut = 0;
    338338    size_t resSize = 0;
    339     RTNETADDRTYPE iAddrType = RTNETADDRTYPE_INVALID;
     339    RTNETADDRTYPE enmAddrType;
    340340    char *pszTCPAddress = NULL;
    341341    char *pszTCPPort = NULL;
     
    346346    char *pszServerAddress4 = NULL;
    347347    char *pszServerAddress6 = NULL;
    348     char *pszGetAddrInfo4 = NULL; // used to store the result of RTSocketGetAddrInfo()
    349     char *pszGetAddrInfo6 = NULL; // used to store the result of RTSocketGetAddrInfo()
     348    char *pszGetAddrInfo4 = NULL; // used to store the result of RTSocketQueryAddressStr()
     349    char *pszGetAddrInfo6 = NULL; // used to store the result of RTSocketQueryAddressStr()
    350350
    351351    // get address
     
    383383    pVRDEFeature->u32ClientId = 0;
    384384
     385    /** @todo r=bird: I believe this code is more than a little of confused
     386     *        about how to use RTStrCopy...  The 2nd parameter is the size of the
     387     *        destination buffer, not the size of the source string!!   */
    385388    RTStrCopy(pVRDEFeature->achInfo, 19, "Property/TCP/Ports");
    386389
     
    404407    const uint32_t lVNCAddress4FeatureSize = sizeof(VRDEFEATURE) + 24;
    405408
    406     pszVNCAddress4 = (char *) RTMemTmpAlloc(24);
    407     memset(pszVNCAddress4,'\0',24);
     409    pszVNCAddress4 = (char *) RTMemTmpAllocZ(24);
    408410
    409411    pVRDEFeature->u32ClientId = 0;
     
    454456    rc = -1;
    455457
    456     pszVNCAddress6 = (char *) RTMemTmpAlloc(VNC_ADDRESS_OPTION_MAX);
    457     memset(pszVNCAddress6,'\0',VNC_ADDRESS_OPTION_MAX);
     458    pszVNCAddress6 = (char *) RTMemTmpAllocZ(VNC_ADDRESS_OPTION_MAX);
    458459
    459460    pVRDEFeature->u32ClientId = 0;
     
    476477
    477478    // VNCPort6
    478     pszVNCPort6 = (char *) RTMemTmpAlloc(6);
    479     memset(pszVNCPort6,'\0', 6);
     479    pszVNCPort6 = (char *) RTMemTmpAllocZ(6);
    480480
    481481    pVRDEFeature->u32ClientId = 0;
     
    573573    {
    574574        // here we go, we prefer IPv6 over IPv4;
    575         pszGetAddrInfo6 = (char *) RTMemTmpAlloc(42);
    576         memset(pszGetAddrInfo6, '\0', 42);
    577575        resSize = 42;
    578         iAddrType = RTNETADDRTYPE_IPV6;
    579 
    580         rc = RTSocketGetAddrInfo(pszTCPAddress, pszGetAddrInfo6, &resSize, &iAddrType);
     576        pszGetAddrInfo6 = (char *) RTMemTmpAllocZ(resSize);
     577        enmAddrType = RTNETADDRTYPE_IPV6;
     578
     579        rc = RTSocketQueryAddressStr(pszTCPAddress, pszGetAddrInfo6, &resSize, &enmAddrType);
    581580
    582581        if (RT_SUCCESS(rc))
     
    593592        if (!pszServerAddress6)
    594593        {
    595             pszGetAddrInfo4 = (char *) RTMemTmpAlloc(16);
    596             memset(pszGetAddrInfo4,'\0',16);
    597594            resSize = 16;
    598             iAddrType = RTNETADDRTYPE_IPV4;
    599 
    600             rc = RTSocketGetAddrInfo(pszTCPAddress, pszGetAddrInfo4, &resSize, &iAddrType);
     595            pszGetAddrInfo4 = (char *) RTMemTmpAllocZ(resSize);
     596            enmAddrType = RTNETADDRTYPE_IPV4;
     597
     598            rc = RTSocketQueryAddressStr(pszTCPAddress, pszGetAddrInfo4, &resSize, &enmAddrType);
    601599
    602600            if (RT_SUCCESS(rc))
     
    614612    if (!pszServerAddress4 && strlen(pszVNCAddress4) > 0)
    615613    {
    616         pszGetAddrInfo4 = (char *) RTMemTmpAlloc(16);
    617         memset(pszGetAddrInfo4,'\0',16);
    618614        resSize = 16;
    619         iAddrType = RTNETADDRTYPE_IPV4;
    620 
    621         rc = RTSocketGetAddrInfo(pszVNCAddress4, pszGetAddrInfo4, &resSize, &iAddrType);
     615        pszGetAddrInfo4 = (char *) RTMemTmpAllocZ(resSize);
     616        enmAddrType = RTNETADDRTYPE_IPV4;
     617
     618        rc = RTSocketQueryAddressStr(pszVNCAddress4, pszGetAddrInfo4, &resSize, &enmAddrType);
    622619
    623620        if (RT_SUCCESS(rc))
     
    628625    if (!pszServerAddress6 && strlen(pszVNCAddress6) > 0)
    629626    {
    630         pszGetAddrInfo6 = (char *) RTMemTmpAlloc(42);
    631         memset(pszGetAddrInfo6, '\0', 42);
    632627        resSize = 42;
    633         iAddrType = RTNETADDRTYPE_IPV6;
    634 
    635         rc = RTSocketGetAddrInfo(pszVNCAddress6, pszGetAddrInfo6, &resSize, &iAddrType);
     628        pszGetAddrInfo6 = (char *) RTMemTmpAllocZ(resSize);
     629        enmAddrType = RTNETADDRTYPE_IPV6;
     630
     631        rc = RTSocketQueryAddressStr(pszVNCAddress6, pszGetAddrInfo6, &resSize, &enmAddrType);
    636632
    637633        if (RT_SUCCESS(rc))
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette