summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-16 06:26:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-16 06:26:33 +0000
commitdb26a9b105f0e2b4850c45554c1e77aa35973ef4 (patch)
tree33bed36b99a8590dd8868b286423a8937419679d /io.c
parent2402ecabb064525651667374a0f758321bbc7f65 (diff)
* load.c (rb_feature_p): get rid of unlimited alloca.
* object.c (rb_cstr_to_dbl): ditto. * io.c (mode_enc): fixed uninitialized variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/io.c b/io.c
index 75c1fa3025..f1ce12e865 100644
--- a/io.c
+++ b/io.c
@@ -3192,14 +3192,15 @@ mode_enc(rb_io_t *fptr, const char *estr)
enc2name = ALLOCA_N(char, n+1);
memcpy(enc2name, estr, n);
enc2name[n] = '\0';
+ estr = enc2name;
idx2 = rb_enc_find_index(enc2name);
}
if (idx2 < 0) {
- rb_warn("Unsupported encoding %s ignored", enc2name);
+ rb_warn("Unsupported encoding %.*s ignored", n, estr);
}
else if (idx2 == idx) {
- rb_warn("Ignoring internal encoding %s: it is identical to external encoding %s",
- enc2name, p1);
+ rb_warn("Ignoring internal encoding %.*s: it is identical to external encoding %s",
+ n, estr, p1);
}
else {
fptr->enc2 = rb_enc_from_index(idx2);