From bcfce506d1f035459b496dfccd5232bf7bcf5872 Mon Sep 17 00:00:00 2001 From: Lyle Johnson Date: Sat, 14 Aug 2004 17:33:18 +0000 Subject: [PATCH] Added a varin typemap for char[] (Ruby). Fixes broken test case arrays_global.i. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6098 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/ruby/ruby.swg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/ruby/ruby.swg b/Lib/ruby/ruby.swg index 04b2cc9ab..a047385fa 100644 --- a/Lib/ruby/ruby.swg +++ b/Lib/ruby/ruby.swg @@ -277,7 +277,11 @@ } /* Special case for string array variables */ -%typemap(varin) char [ANY] "strncpy($1,StringValuePtr($input),$1_dim0);"; +%typemap(varin) char[] { + size_t size = sizeof($1); + strncpy($1,StringValuePtr($input),size); +} +%typemap(varin) char[ANY] "strncpy($1,StringValuePtr($input),$1_dim0);"; /* Typemaps for pointers. Note: the SWIG run-time type checker works