diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-17 05:23:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-17 05:23:25 +0000 |
commit | bb6e6903ca7ab0d833c2c243287be6123c8b15bd (patch) | |
tree | 39c12c52164ca7fc6ba474a221f01dd50ffa5e3d /ext | |
parent | 37db97c0e12b39c912d37b6adccbcf1112ce75ba (diff) | |
download | ruby-bb6e6903ca7ab0d833c2c243287be6123c8b15bd.tar.gz |
* 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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/iconv/extconf.rb | 1 | ||||
-rw-r--r-- | ext/iconv/iconv.c | 6 |
2 files changed, 6 insertions, 1 deletions
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 */ |