mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/iconv/iconv.c (Iconv::BrokenLibrary): exception when detected a
bug of underlying library. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aa6ece9fc6
commit
c93bf465dd
2 changed files with 21 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Nov 6 23:39:13 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/iconv/iconv.c (Iconv::BrokenLibrary): exception when detected a
|
||||
bug of underlying library.
|
||||
|
||||
Sun Nov 6 21:46:59 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* ext/tk/stubs.c (ruby_tcl_create_ip_and_stubs_init): should touch
|
||||
|
|
|
@ -88,6 +88,7 @@ static VALUE rb_eIconvFailure;
|
|||
static VALUE rb_eIconvIllegalSeq;
|
||||
static VALUE rb_eIconvInvalidChar;
|
||||
static VALUE rb_eIconvOutOfRange;
|
||||
static VALUE rb_eIconvBrokenLibrary;
|
||||
|
||||
static ID rb_success, rb_failed;
|
||||
static VALUE iconv_fail _((VALUE error, VALUE success, VALUE failed, struct iconv_env_t* env, const char *mesg));
|
||||
|
@ -248,7 +249,10 @@ iconv_try
|
|||
#else
|
||||
#define ICONV_INPTR_CAST (char **)
|
||||
#endif
|
||||
size_t ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
|
||||
size_t ret;
|
||||
|
||||
errno = 0;
|
||||
ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
|
||||
if (ret == (size_t)-1) {
|
||||
if (!*inlen)
|
||||
return Qfalse;
|
||||
|
@ -260,6 +264,8 @@ iconv_try
|
|||
return rb_eIconvIllegalSeq;
|
||||
case EINVAL:
|
||||
return rb_eIconvInvalidChar;
|
||||
case 0:
|
||||
return rb_eIconvBrokenLibrary;
|
||||
default:
|
||||
rb_sys_fail("iconv");
|
||||
}
|
||||
|
@ -857,6 +863,13 @@ iconv_failure_inspect
|
|||
* Iconv library internal error. Must not occur.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Document-class: Iconv::BrokenLibrary
|
||||
*
|
||||
* Detected a bug of underlying iconv(3) libray.
|
||||
* * returns an error without setting errno properly
|
||||
*/
|
||||
|
||||
void
|
||||
Init_iconv _((void))
|
||||
{
|
||||
|
@ -880,10 +893,12 @@ Init_iconv _((void))
|
|||
rb_eIconvIllegalSeq = rb_define_class_under(rb_cIconv, "IllegalSequence", rb_eArgError);
|
||||
rb_eIconvInvalidChar = rb_define_class_under(rb_cIconv, "InvalidCharacter", rb_eArgError);
|
||||
rb_eIconvOutOfRange = rb_define_class_under(rb_cIconv, "OutOfRange", rb_eRuntimeError);
|
||||
rb_eIconvBrokenLibrary = rb_define_class_under(rb_cIconv, "BrokenLibrary", rb_eRuntimeError);
|
||||
rb_include_module(rb_eIconvInvalidEncoding, rb_eIconvFailure);
|
||||
rb_include_module(rb_eIconvIllegalSeq, rb_eIconvFailure);
|
||||
rb_include_module(rb_eIconvInvalidChar, rb_eIconvFailure);
|
||||
rb_include_module(rb_eIconvOutOfRange, rb_eIconvFailure);
|
||||
rb_include_module(rb_eIconvBrokenLibrary, rb_eIconvFailure);
|
||||
|
||||
rb_success = rb_intern("success");
|
||||
rb_failed = rb_intern("failed");
|
||||
|
|
Loading…
Add table
Reference in a new issue