* ext/iconv/iconv.c (iconv_convert): append unchanged portion
after overflow. [ruby-dev:21006] * ext/iconv/extconf.rb: check if iconv() 2nd argument is const. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
252df14e6b
commit
5172e595c9
@ -1,3 +1,10 @@
|
|||||||
|
Wed Jul 30 10:31:37 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
|
* ext/iconv/iconv.c (iconv_convert): append unchanged portion
|
||||||
|
after overflow. [ruby-dev:21006]
|
||||||
|
|
||||||
|
* ext/iconv/extconf.rb: check if iconv() 2nd argument is const.
|
||||||
|
|
||||||
Wed Jul 30 09:31:55 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Wed Jul 30 09:31:55 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* configure.in (os2-emx): renamed from os2_emx, add flags to
|
* configure.in (os2-emx): renamed from os2_emx, add flags to
|
||||||
|
@ -6,6 +6,20 @@ conf = File.exist?(File.join($srcdir, "config.charset"))
|
|||||||
conf = with_config("config-charset", enable_config("config-charset", conf))
|
conf = with_config("config-charset", enable_config("config-charset", conf))
|
||||||
|
|
||||||
if have_header("iconv.h")
|
if have_header("iconv.h")
|
||||||
|
if !try_compile("", "-Werror") or checking_for("iconv() 2nd argument is const") do
|
||||||
|
!try_compile('
|
||||||
|
#include <iconv.h>
|
||||||
|
size_t
|
||||||
|
test(iconv_t cd, char **inptr, size_t *inlen, char **outptr, size_t *outlen)
|
||||||
|
{
|
||||||
|
return iconv(cd, inptr, inlen, outptr, outlen);
|
||||||
|
}
|
||||||
|
', "-Werror")
|
||||||
|
end
|
||||||
|
$defs.push('-DICONV_INPTR_CAST=""')
|
||||||
|
else
|
||||||
|
$defs.push('-DICONV_INPTR_CAST="(char **)"')
|
||||||
|
end
|
||||||
have_library("iconv")
|
have_library("iconv")
|
||||||
if conf
|
if conf
|
||||||
prefix = '$(srcdir)'
|
prefix = '$(srcdir)'
|
||||||
|
@ -209,7 +209,7 @@ iconv_try
|
|||||||
size_t *outlen;
|
size_t *outlen;
|
||||||
#endif /* HAVE_PROTOTYPES */
|
#endif /* HAVE_PROTOTYPES */
|
||||||
{
|
{
|
||||||
if (iconv(cd, (char **)inptr, inlen, outptr, outlen) == (size_t)-1) {
|
if (iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen) == (size_t)-1) {
|
||||||
if (!*inlen)
|
if (!*inlen)
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
@ -401,6 +401,8 @@ iconv_convert
|
|||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = rb_str_derive(str, instart, inptr - instart);
|
ret = rb_str_derive(str, instart, inptr - instart);
|
||||||
|
else if (inptr > instart)
|
||||||
|
rb_str_cat(ret, instart, inptr - instart);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user