summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-07 08:49:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-07 08:49:34 +0000
commit0fbcc455bd4601ed39919379058fc63f44923cfb (patch)
treecec682023960c6e1bd246e0b5d8ea0c4c8308c71
parent9dc29ddfd78c9bfb68161d1da922089ab859cbae (diff)
* string.c (rb_str_ord): extract lower byte. fixed: [ruby-dev:28980]
* lib/jcode.rb (String#succ!): fix for 1.9. fixed: [ruby-dev:28979] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/jcode.rb7
-rw-r--r--string.c2
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d96c8e5169f..e1f046a5244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jul 7 17:49:16 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_ord): extract lower byte. fixed: [ruby-dev:28980]
+
+ * lib/jcode.rb (String#succ!): fix for 1.9. fixed: [ruby-dev:28979]
+
Fri Jul 7 14:05:03 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/Makefile.sub (config.h): define FUNC_STDCALL/FUNC_CDECL.
diff --git a/lib/jcode.rb b/lib/jcode.rb
index fcf4f047309..6b123a839b6 100644
--- a/lib/jcode.rb
+++ b/lib/jcode.rb
@@ -79,9 +79,12 @@ class String
reg = end_regexp
if self =~ reg
succ_table = SUCC[$KCODE[0,1].downcase]
+ last1 = self[-1].ord
+ last2 = self[-2].ord
begin
- self[-1] += succ_table[self[-1]]
- self[-2] += 1 if self[-1] == 0
+ last1 += succ_table[last1]
+ last2 += 1 if last1 == 0
+ self[-2..-1] = [last2, last1].pack("C*")
end while self !~ reg
self
else
diff --git a/string.c b/string.c
index d5112970890..bcd75a229af 100644
--- a/string.c
+++ b/string.c
@@ -4070,7 +4070,7 @@ rb_str_ord(VALUE s)
"expacted a characer, but string of size %d given",
RSTRING(s)->len);
}
- c = RSTRING(s)->ptr[0];
+ c = RSTRING(s)->ptr[0] & 0xff;
return INT2NUM(c);
}
/*