for undefined conversions.
* transcode_data_iso_8859.c: Changed from character constants ('\xC2') to integer contants (0xC2) for shorter files and better readability; eliminated duplicated tables; changed from -1 offset to actual UNDEF entry (not yet distinguishing UNDEF and ILLEGAL correctly). * test/ruby/test_transcode.rb: added a test for UNDEF conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b7beb63b0b
commit
5c4cf9bfdf
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
Sun Dec 16 17:07:35 2007 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
|
* transcode.c (transcode_loop): removed special case (-1)
|
||||||
|
for undefined conversions.
|
||||||
|
|
||||||
|
* transcode_data_iso_8859.c: Changed from character constants
|
||||||
|
('\xC2') to integer contants (0xC2) for shorter files and
|
||||||
|
better readability; eliminated duplicated tables; changed
|
||||||
|
from -1 offset to actual UNDEF entry (not yet distinguishing
|
||||||
|
UNDEF and ILLEGAL correctly).
|
||||||
|
|
||||||
|
* test/ruby/test_transcode.rb: added a test for UNDEF conversion.
|
||||||
|
|
||||||
Sun Dec 16 14:51:59 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Dec 16 14:51:59 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in (MAKEFILES): should be enc/Makefile, not GNUmakefile.
|
* configure.in (MAKEFILES): should be enc/Makefile, not GNUmakefile.
|
||||||
|
@ -27,6 +27,7 @@ class TestTranscode < Test::Unit::TestCase
|
|||||||
assert_raise(ArgumentError) { 'abc'.encode!('foo', 'bar') }
|
assert_raise(ArgumentError) { 'abc'.encode!('foo', 'bar') }
|
||||||
assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode('foo') }
|
assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode('foo') }
|
||||||
assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode!('foo') }
|
assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode!('foo') }
|
||||||
|
assert_raise(RuntimeError) { "\xA5".encode('utf-8','iso-8859-3') }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_arguments
|
def test_arguments
|
||||||
|
@ -191,7 +191,6 @@ transcode_loop(char **in_pos, char **out_pos,
|
|||||||
next_byte = (unsigned char)*in_p++;
|
next_byte = (unsigned char)*in_p++;
|
||||||
follow_byte:
|
follow_byte:
|
||||||
next_offset = next_table->base[next_byte];
|
next_offset = next_table->base[next_byte];
|
||||||
if (next_offset == (base_element)-1) goto illegal;
|
|
||||||
next_info = (VALUE)next_table->info[next_offset];
|
next_info = (VALUE)next_table->info[next_offset];
|
||||||
switch (next_info & 0x1F) {
|
switch (next_info & 0x1F) {
|
||||||
case NOMAP:
|
case NOMAP:
|
||||||
@ -234,7 +233,7 @@ transcode_loop(char **in_pos, char **out_pos,
|
|||||||
goto illegal;
|
goto illegal;
|
||||||
case UNDEF:
|
case UNDEF:
|
||||||
/* todo: add code for alternative behaviors */
|
/* todo: add code for alternative behaviors */
|
||||||
rb_raise(rb_eRuntimeError /*@@@change exception*/, "conversion undefined for byte sequence");
|
rb_raise(rb_eRuntimeError /*@@@change exception*/, "conversion undefined for byte sequence (maybe illegal byte sequence)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
#define RUBY_VERSION "1.9.0"
|
#define RUBY_VERSION "1.9.0"
|
||||||
#define RUBY_RELEASE_DATE "2007-12-16"
|
#define RUBY_RELEASE_DATE "2007-12-17"
|
||||||
#define RUBY_VERSION_CODE 190
|
#define RUBY_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20071216
|
#define RUBY_RELEASE_CODE 20071217
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 12
|
#define RUBY_RELEASE_MONTH 12
|
||||||
#define RUBY_RELEASE_DAY 16
|
#define RUBY_RELEASE_DAY 17
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user