Changeset 50457 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Feb 14, 2014 2:36:48 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/socket.cpp
r48935 r50457 783 783 { 784 784 struct sockaddr_in const *pgrSa = (struct sockaddr_in const *)pgrResult->ai_addr; 785 pbDummy = (uint8_t const *)&pgrSa->sin_addr; 786 cchIpAddress = RTStrPrintf(szIpAddress, sizeof(szIpAddress), "%u.%u.%u.%u", 787 pbDummy[0], pbDummy[1], pbDummy[2], pbDummy[3]); 785 cchIpAddress = RTStrPrintf(szIpAddress, sizeof(szIpAddress), 786 "%RTnaipv4", pgrSa->sin_addr.s_addr); 788 787 Assert(cchIpAddress >= 7 && cchIpAddress < sizeof(szIpAddress) - 1); 789 788 enmAddrType = RTNETADDRTYPE_IPV4; … … 793 792 { 794 793 struct sockaddr_in6 const *pgrSa6 = (struct sockaddr_in6 const *)pgrResult->ai_addr; 795 pbDummy = (uint8_t const *) &pgrSa6->sin6_addr; 796 char szTmp[32+1]; 797 size_t cchTmp = RTStrPrintf(szTmp, sizeof(szTmp), 798 "%02x%02x%02x%02x" 799 "%02x%02x%02x%02x" 800 "%02x%02x%02x%02x" 801 "%02x%02x%02x%02x", 802 pbDummy[0], pbDummy[1], pbDummy[2], pbDummy[3], 803 pbDummy[4], pbDummy[5], pbDummy[6], pbDummy[7], 804 pbDummy[8], pbDummy[9], pbDummy[10], pbDummy[11], 805 pbDummy[12], pbDummy[13], pbDummy[14], pbDummy[15]); 806 Assert(cchTmp == 32); 807 rc = rtStrToIpAddr6Str(szTmp, szIpAddress, sizeof(szIpAddress), NULL, 0, true); 808 if (RT_SUCCESS(rc)) 809 cchIpAddress = strlen(szIpAddress); 810 else 811 { 812 szIpAddress[0] = '\0'; 813 cchIpAddress = 0; 814 } 794 cchIpAddress = RTStrPrintf(szIpAddress, sizeof(szIpAddress), 795 "%RTnaipv6", (PRTNETADDRIPV6)&pgrSa6->sin6_addr); 815 796 enmAddrType = RTNETADDRTYPE_IPV6; 797 rc = VINF_SUCCESS; 816 798 } 817 799 else
Note:
See TracChangeset
for help on using the changeset viewer.