jmorrill opened a new pull request #4306: Fix incorrect call to Unicode Win32 
InetPton
URL: https://github.com/apache/incubator-tvm/pull/4306
 
 
   The recent commit for https://github.com/apache/incubator-tvm/pull/4281 is 
calling the Win32 MACRO InetPton.  If the Visual studio project is set to "Use 
Unicode Character Set", (which tvm.dll seems to be) this calls InetPtonW, which 
uses wchar_t* (aka PCWSTR).  This causes a build error as the "addr_buf" is a 
char*.
   
   From [InetPton 
](https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-inetptonw)docs:
   
   > When UNICODE or _UNICODE is defined, InetPton is defined to InetPtonW, the 
Unicode version of this function. The pszAddrString parameter is defined to the 
PCWSTR data type.
   > 
   > When UNICODE or _UNICODE is not defined, InetPton is defined to InetPtonA, 
the ANSI version of this function. The ANSI version of this function is always 
defined as inet_pton. The pszAddrString parameter is defined to the PCSTR data 
type.
   
   This can be fixed by directly calling InetPtonA, which is safe as the tvm 
function always uses a char* for add_str and InetPtonA always takes a char* 
(aka PCSTR)
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to