mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]
* string.c (rb_str_times): fix broken case. [ruby-dev:33826] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8fd2fabbe
commit
8dd8dfce21
3 changed files with 16 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Feb 17 21:38:21 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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@fsij.org>
|
||||
|
||||
* re.c (rb_reg_prepare_re): add enable_warning parameter.
|
||||
|
|
|
@ -56,13 +56,12 @@
|
|||
#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 { \
|
||||
|
|
5
string.c
5
string.c
|
@ -758,6 +758,7 @@ rb_str_times(VALUE str, VALUE times)
|
|||
{
|
||||
VALUE str2;
|
||||
long n, len;
|
||||
int cr;
|
||||
|
||||
len = NUM2LONG(times);
|
||||
if (len < 0) {
|
||||
|
@ -779,7 +780,9 @@ rb_str_times(VALUE str, VALUE times)
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue