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

ruby-changes:23515

From: naruse <ko1@a...>
Date: Mon, 7 May 2012 20:25:57 +0900 (JST)
Subject: [ruby-changes:23515] naruse:r35566 (ruby_1_9_3): merge revision(s) 35545,35564,35565:

naruse	2012-05-07 20:25:45 +0900 (Mon, 07 May 2012)

  New Revision: 35566

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

  Log:
    merge revision(s) 35545,35564,35565:
    
    * lib/securerandom.rb: show actual read length in an error message.
    
    * lib/securerandom.rb (random_bytes): call to_int method for the
      argument at first.

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/lib/securerandom.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 35565)
+++ ruby_1_9_3/ChangeLog	(revision 35566)
@@ -1,3 +1,12 @@
+Mon May  7 20:23:29 2012  Tanaka Akira  <akr@f...>
+
+	* lib/securerandom.rb (random_bytes): call to_int method for the
+	  argument at first.
+
+Mon May  7 20:23:29 2012  Tanaka Akira  <akr@f...>
+
+	* lib/securerandom.rb: show actual read length in an error message.
+
 Mon May  7 11:09:20 2012  NARUSE, Yui  <naruse@r...>
 
 	* ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before
Index: ruby_1_9_3/lib/securerandom.rb
===================================================================
--- ruby_1_9_3/lib/securerandom.rb	(revision 35565)
+++ ruby_1_9_3/lib/securerandom.rb	(revision 35566)
@@ -54,7 +54,7 @@
   # If secure random number generator is not available,
   # NotImplementedError is raised.
   def self.random_bytes(n=nil)
-    n ||= 16
+    n = n ? n.to_int : 16
 
     if defined? OpenSSL::Random
       @pid = 0 if !defined?(@pid)
@@ -80,7 +80,7 @@
           @has_urandom = true
           ret = f.readpartial(n)
           if ret.length != n
-            raise NotImplementedError, "Unexpected partial read from random device"
+            raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
           end
           return ret
         }
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 35565)
+++ ruby_1_9_3/version.h	(revision 35566)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 205
+#define RUBY_PATCHLEVEL 206
 
 #define RUBY_RELEASE_DATE "2012-05-07"
 #define RUBY_RELEASE_YEAR 2012

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

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