summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--bignum.c5
-rw-r--r--encoding.c2
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2361f805dd..810828b8b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Jul 18 12:59:50 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * encoding.c (load_encoding): explicit cast to suppress warning.
+ Though the cast truncates some bits, from heuristic analysis I
+ believe it is OK to do so here.
+
+ * bignum.c (rb_cstr_to_inum): ditto.
+
Wed Jul 18 12:55:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
* lib/benchmark.rb: Fix Benchmark.benchmark output with an empty
diff --git a/bignum.c b/bignum.c
index 30e1e8a8e9..e98648af24 100644
--- a/bignum.c
+++ b/bignum.c
@@ -731,7 +731,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (badcheck) goto bad;
break;
}
- nondigit = c;
+ nondigit = (char) c;
continue;
}
else if ((c = conv_digit(c)) < 0) {
@@ -1036,7 +1036,8 @@ big2str_find_n1(VALUE x, int base)
bits = BITSPERDIG*RBIGNUM_LEN(x);
}
- return (long)ceil(bits/log_2[base - 2]);
+ /* @shyouhei note: vvvvvvvvvvvvv this cast is suspicious. But I believe it is OK, because if that cast loses data, this x value is too big, and should have raised RangeError. */
+ return (long)ceil(((double)bits)/log_2[base - 2]);
}
static long
diff --git a/encoding.c b/encoding.c
index 38e28c837d..ae62d67486 100644
--- a/encoding.c
+++ b/encoding.c
@@ -582,7 +582,7 @@ load_encoding(const char *name)
while (s < e) {
if (!ISALNUM(*s)) *s = '_';
- else if (ISUPPER(*s)) *s = TOLOWER(*s);
+ else if (ISUPPER(*s)) *s = (char)TOLOWER(*s);
++s;
}
FL_UNSET(enclib, FL_TAINT|FL_UNTRUSTED);