Explorar el Código

Cast len to unsigned

On Windows the length to getnameinfo is a DWORD and socklen_t is an
integer. This results in sign conversion. On POSIX socklen_t is an
unsigned integer. Let's cast to unsigned to make both sides happy.
Matt Clarkson hace 10 años
padre
commit
4ce8508133
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/civetweb.c

+ 2 - 2
src/civetweb.c

@@ -1454,12 +1454,12 @@ static void sockaddr_to_string(char *buf, size_t len, const union usa *usa)
 
 	if (usa->sa.sa_family == AF_INET) {
 		getnameinfo(
-		    &usa->sa, sizeof(usa->sin), buf, (socklen_t)len, NULL, 0, NI_NUMERICHOST);
+		    &usa->sa, sizeof(usa->sin), buf, (unsigned)len, NULL, 0, NI_NUMERICHOST);
 	}
 #if defined(USE_IPV6)
 	else if (usa->sa.sa_family == AF_INET6) {
 		getnameinfo(
-		    &usa->sa, sizeof(usa->sin6), buf, (socklen_t)len, NULL, 0, NI_NUMERICHOST);
+		    &usa->sa, sizeof(usa->sin6), buf, (unsigned)len, NULL, 0, NI_NUMERICHOST);
 	}
 #endif