mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sprintf.c (rb_enc_vsprintf): can be used for ASCII compatible
encodings only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6b1bae9641
commit
23b4c10dd8
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Jan 13 18:41:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* sprintf.c (rb_enc_vsprintf): can be used for ASCII compatible
|
||||
encodings only.
|
||||
|
||||
Fri Jan 13 18:29:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* thread.c (rb_mutex_unlock_th): simplified.
|
||||
|
|
|
@ -1168,7 +1168,13 @@ rb_enc_vsprintf(rb_encoding *enc, const char *fmt, va_list ap)
|
|||
f._bf._size = 0;
|
||||
f._w = 120;
|
||||
result = rb_str_buf_new(f._w);
|
||||
if (enc) rb_enc_associate(result, enc);
|
||||
if (enc) {
|
||||
if (!rb_enc_asciicompat(enc)) {
|
||||
rb_raise(rb_eArgError, "cannot construct ASCII-incompatible encoding string: %s",
|
||||
rb_enc_name(enc));
|
||||
}
|
||||
rb_enc_associate(result, enc);
|
||||
}
|
||||
f._bf._base = (unsigned char *)result;
|
||||
f._p = (unsigned char *)RSTRING_PTR(result);
|
||||
RBASIC(result)->klass = 0;
|
||||
|
|
Loading…
Reference in a new issue