From 35a8cfbfd30ebc588ca904c111e87e27723ee385 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 8 Oct 2021 07:14:28 -0700 Subject: ffi: C++ upkeep. * ffi.c (sock_opt, sock_set_opt): Fix a few integer conversions to use convert (mapping to static_cast) rather than coerce (reinterpret_cast). --- ffi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ffi.c b/ffi.c index a77c48a4..cf628de8 100644 --- a/ffi.c +++ b/ffi.c @@ -6633,7 +6633,7 @@ static val sock_opt(val sock, val level, val option, val type_opt) uw_throwf(socket_error_s, lit("~a: cannot get option on ~s"), self, sock, nao); } else { - socklen_t size = coerce(socklen_t, tft->size); + socklen_t size = convert(socklen_t, tft->size); mem_t *data = coerce(mem_t *, zalloca(size)); if (getsockopt(c_num(sfd, self), lvl, opt, data, &size) != 0) uw_ethrowf(socket_error_s, lit("~a failed on ~s: ~d/~s"), @@ -6644,7 +6644,7 @@ static val sock_opt(val sock, val level, val option, val type_opt) * (Or perhaps add an optional argument following type_opt * specifying the requested length of the value, presumably of type * carray.) */ - if (size != coerce(socklen_t, tft->size)) + if (size != convert(socklen_t, tft->size)) uw_throwf(socket_error_s, lit("~a: variable-size option on ~s"), self, sock, nao); return tft->get(tft, data, self); @@ -6665,7 +6665,7 @@ static val sock_set_opt(val sock, val level, val option, val value, uw_throwf(socket_error_s, lit("~a: cannot set option on ~s"), self, sock, nao); } else { - socklen_t size = coerce(socklen_t, tft->size); + socklen_t size = convert(socklen_t, tft->size); mem_t *data = coerce(mem_t *, zalloca(size)); tft->put(tft, value, data, self); if (setsockopt(c_num(sfd, self), lvl, opt, data, size) != 0) -- cgit v1.2.3