ruby-changes:4035
From: ko1@a...
Date: Sun, 17 Feb 2008 22:02:08 +0900 (JST)
Subject: [ruby-changes:4035] naruse - Ruby:r15525 (trunk): * encoding.c (ENC_CODERANGE_AND): fix broken case.
naruse 2008-02-17 22:01:52 +0900 (Sun, 17 Feb 2008)
New Revision: 15525
Modified files:
trunk/ChangeLog
trunk/include/ruby/encoding.h
trunk/string.c
Log:
* encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]
* string.c (rb_str_times): fix broken case. [ruby-dev:33826]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=15525&r2=15524&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15525&r2=15524&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/encoding.h?r1=15525&r2=15524&diff_format=u
Index: include/ruby/encoding.h
===================================================================
--- include/ruby/encoding.h (revision 15524)
+++ include/ruby/encoding.h (revision 15525)
@@ -56,14 +56,13 @@
#define ENC_CODERANGE_SET(obj,cr) (RBASIC(obj)->flags = \
(RBASIC(obj)->flags & ~ENC_CODERANGE_MASK) | (cr))
#define ENC_CODERANGE_CLEAR(obj) ENC_CODERANGE_SET(obj,0)
-#define ENC_CODERANGE_AND(a, b) (\
- (a == b) ? a : \
- (a == ENC_CODERANGE_BROKEN) ? ENC_CODERANGE_BROKEN : \
- (b == ENC_CODERANGE_BROKEN) ? ENC_CODERANGE_BROKEN : \
- (a == ENC_CODERANGE_UNKNOWN) ? ENC_CODERANGE_UNKNOWN : \
- (b == ENC_CODERANGE_UNKNOWN) ? ENC_CODERANGE_UNKNOWN : \
- ENC_CODERANGE_VALID)
+/* assumed ASCII compatiblity */
+#define ENC_CODERANGE_AND(a, b) \
+ (a == ENC_CODERANGE_7BIT ? b : \
+ a == ENC_CODERANGE_VALID ? (b == ENC_CODERANGE_7BIT ? ENC_CODERANGE_VALID : b) : \
+ ENC_CODERANGE_UNKNOWN)
+
#define ENCODING_CODERANGE_SET(obj, encindex, cr) \
do { \
VALUE rb_encoding_coderange_obj = (obj); \
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15524)
+++ ChangeLog (revision 15525)
@@ -1,3 +1,9 @@
+Sun Feb 17 21:38:21 2008 NARUSE, Yui <naruse@r...>
+
+ * encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]
+
+ * string.c (rb_str_times): fix broken case. [ruby-dev:33826]
+
Sun Feb 17 20:45:10 2008 Tanaka Akira <akr@f...>
* re.c (rb_reg_prepare_re): add enable_warning parameter.
Index: string.c
===================================================================
--- string.c (revision 15524)
+++ string.c (revision 15525)
@@ -758,6 +758,7 @@
{
VALUE str2;
long n, len;
+ int cr;
len = NUM2LONG(times);
if (len < 0) {
@@ -779,7 +780,9 @@
}
RSTRING_PTR(str2)[RSTRING_LEN(str2)] = '\0';
OBJ_INFECT(str2, str);
- ENCODING_CODERANGE_SET(str2, rb_enc_get_index(str), ENC_CODERANGE(str));
+ cr = ENC_CODERANGE(str);
+ if (cr == ENC_CODERANGE_BROKEN) cr = ENC_CODERANGE_UNKNOWN;
+ ENCODING_CODERANGE_SET(str2, rb_enc_get_index(str), cr);
return str2;
}
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/