ruby-changes:3240
From: ko1@a...
Date: 27 Dec 2007 15:28:06 +0900
Subject: [ruby-changes:3240] akr - Ruby:r14733 (trunk): * encoding.c (rb_enc_codelen): show codepoint in error message.
akr 2007-12-27 15:27:39 +0900 (Thu, 27 Dec 2007) New Revision: 14733 Modified files: trunk/ChangeLog trunk/encoding.c trunk/include/ruby/encoding.h trunk/string.c Log: * encoding.c (rb_enc_codelen): show codepoint in error message. * include/ruby/encoding.h (rb_enc_codelen): comment it returns positive integer. * string.c (rb_str_concat): rb_enc_codelen doesn't return 0. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14733&r2=14732 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14733&r2=14732 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/encoding.h?r1=14733&r2=14732 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/encoding.c?r1=14733&r2=14732 Index: encoding.c =================================================================== --- encoding.c (revision 14732) +++ encoding.c (revision 14733) @@ -680,7 +680,7 @@ { int n = ONIGENC_CODE_TO_MBCLEN(enc,c); if (n == 0) { - rb_raise(rb_eArgError, "invalid codepoint"); + rb_raise(rb_eArgError, "invalid codepoint 0x%x", c); } return n; } Index: include/ruby/encoding.h =================================================================== --- include/ruby/encoding.h (revision 14732) +++ include/ruby/encoding.h (revision 14733) @@ -87,7 +87,7 @@ int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc); #define rb_enc_mbc_to_codepoint(p, e, enc) ONIGENC_MBC_TO_CODE(enc,(UChar*)(p),(UChar*)(e)) -/* -> codelen or raise exception */ +/* -> codelen>0 or raise exception */ int rb_enc_codelen(int code, rb_encoding *enc); /* code,ptr,encoding -> write buf */ Index: ChangeLog =================================================================== --- ChangeLog (revision 14732) +++ ChangeLog (revision 14733) @@ -1,3 +1,12 @@ +Thu Dec 27 15:25:16 2007 Tanaka Akira <akr@f...> + + * encoding.c (rb_enc_codelen): show codepoint in error message. + + * include/ruby/encoding.h (rb_enc_codelen): comment it returns + positive integer. + + * string.c (rb_str_concat): rb_enc_codelen doesn't return 0. + Thu Dec 27 15:18:44 2007 Tanaka Akira <akr@f...> * encoding.c (rb_enc_codelen): error message refined. Index: string.c =================================================================== --- string.c (revision 14732) +++ string.c (revision 14733) @@ -1104,9 +1104,6 @@ int pos = RSTRING_LEN(str1); int len = rb_enc_codelen(c, enc); - if (len == 0) { - rb_raise(rb_eArgError, "invalid codepoint 0x%x", c); - } rb_str_resize(str1, pos+len); rb_enc_mbcput(c, RSTRING_PTR(str1)+pos, enc); return str1; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml