[前][次][番号順一覧][スレッド一覧]

ruby-changes:29116

From: akr <ko1@a...>
Date: Sat, 8 Jun 2013 16:01:32 +0900 (JST)
Subject: [ruby-changes:29116] akr:r41168 (trunk): * random.c (rand_init): Add a cast to fix clang compile error:

akr	2013-06-08 16:01:19 +0900 (Sat, 08 Jun 2013)

  New Revision: 41168

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41168

  Log:
    * random.c (rand_init): Add a cast to fix clang compile error:
      random.c:410:32: error: implicit conversion loses integer precision:
      'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
      This cast doesn't cause a problem because len is not bigger than
      MT_MAX_STATE.

  Modified files:
    trunk/ChangeLog
    trunk/random.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41167)
+++ ChangeLog	(revision 41168)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jun  8 15:58:18 2013  Tanaka Akira  <akr@f...>
+
+	* random.c (rand_init): Add a cast to fix clang compile error:
+	  random.c:410:32: error: implicit conversion loses integer precision:
+	  'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
+	  This cast doesn't cause a problem because len is not bigger than
+	  MT_MAX_STATE.
+
 Sat Jun  8 15:30:03 2013  Tanaka Akira  <akr@f...>
 
 	* random.c (rand_init): Use rb_integer_pack.
Index: random.c
===================================================================
--- random.c	(revision 41167)
+++ random.c	(revision 41168)
@@ -407,7 +407,7 @@ rand_init(struct MT *mt, VALUE vseed) https://github.com/ruby/ruby/blob/trunk/random.c#L407
     else {
         if (sign != 2 && buf[len-1] == 1) /* remove leading-zero-guard */
             len--;
-        init_by_array(mt, buf, len);
+        init_by_array(mt, buf, (int)len);
     }
     if (buf != buf0) xfree(buf);
     return seed;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]