From bb6e6903ca7ab0d833c2c243287be6123c8b15bd Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 17 Jan 2010 05:23:25 +0000 Subject: * ext/iconv/iconv.c (iconv_convert): suppress a warning. * lib/mkmf.rb (check_signedness): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/iconv/extconf.rb | 1 + ext/iconv/iconv.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/iconv') diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb index 9632bf4db9..c4a57c80d6 100644 --- a/ext/iconv/extconf.rb +++ b/ext/iconv/extconf.rb @@ -7,6 +7,7 @@ conf = with_config("config-charset", enable_config("config-charset", conf)) if have_func("iconv", "iconv.h") or have_library("iconv", "iconv", "iconv.h") + check_signedness("size_t") if checking_for("const of iconv() 2nd argument") do create_tmpsrc(cpp_include("iconv.h") + "---> iconv(cd,0,0,0,0) <---") src = xpopen(cpp_command("")) {|f|f.read} diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index c4c6fd8124..cf77ee3e2c 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -464,7 +464,11 @@ iconv_convert(iconv_t cd, VALUE str, long start, long length, int toidx, struct errmsg[0] = 0; error = iconv_try(cd, &inptr, &inlen, &outptr, &outlen); - if (0 <= outlen && outlen <= sizeof(buffer)) { + if ( +#if SIGNEDNESS_OF_SIZE_T < 0 + 0 <= outlen && +#endif + outlen <= sizeof(buffer)) { outlen = sizeof(buffer) - outlen; if (NIL_P(error) || /* something converted */ outlen > (size_t)(inptr - tmpstart) || /* input can't contain output */ -- cgit v1.2.3