From d2ace0ce5f764a5bfb2c82975a2614c97d569cd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 21 Aug 2018 05:09:24 +0000 Subject: [PATCH] cmd/cgo: perform explicit conversion in _GoStringLen _GoStringLen performs an implicit conversion from intgo to size_t. Explicitly cast to size_t. This change avoids warnings when using cgo with CFLAGS: -Wconversion. Change-Id: I58f75a35e17f669a67f9805061c041b03eddbb5c GitHub-Last-Rev: b5df1ac0c3c90360fa1d22c069e0f126e9f894d8 GitHub-Pull-Request: golang/go#27092 Reviewed-on: https://go-review.googlesource.com/129820 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/cmd/cgo/out.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 89598c96e8..6217bb17a3 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -1432,7 +1432,7 @@ void *CBytes(_GoBytes_); void *_CMalloc(size_t); __attribute__ ((unused)) -static size_t _GoStringLen(_GoString_ s) { return s.n; } +static size_t _GoStringLen(_GoString_ s) { return (size_t)s.n; } __attribute__ ((unused)) static const char *_GoStringPtr(_GoString_ s) { return s.p; } -- 2.48.1