[PATCH] Silence warning about socklen_t/int sign.

Christian Vogel vogelchr at vogel.cx
Fri May 25 09:02:43 UTC 2012


rtl_tcp.c:457:57: warning: pointer types point to integer types
	with different sign passing 'int *', expected
	'socklen_t *' [-Wpointer-sign]
---
 src/rtl_tcp.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/rtl_tcp.c b/src/rtl_tcp.c
index 8b2cf44..849192b 100644
--- a/src/rtl_tcp.c
+++ b/src/rtl_tcp.c
@@ -42,6 +42,9 @@
 
 #ifdef _WIN32
 #pragma comment(lib, "ws2_32.lib")
+
+typedef int socklen_t;
+
 #else
 #define closesocket close
 #define SOCKADDR struct sockaddr
@@ -453,8 +456,10 @@ int main(int argc, char **argv)
 			if(do_exit) {
 				goto out;
 			} else if(r) {
-				r=sizeof(remote);
-				s = accept(listensocket,(struct sockaddr *)&remote, &r);
+				socklen_t rlen;
+
+				rlen=sizeof(remote);
+				s = accept(listensocket,(struct sockaddr *)&remote, &rlen);
 				break;
 			}
 		}
-- 
1.7.0.4


--Nq2Wo0NMKNjxTN9z--




More information about the osmocom-sdr mailing list