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

ruby-changes:35508

From: nobu <ko1@a...>
Date: Mon, 15 Sep 2014 09:43:21 +0900 (JST)
Subject: [ruby-changes:35508] nobu:r47590 (trunk): fiddle/import.rb: fix typo

nobu	2014-09-15 09:43:14 +0900 (Mon, 15 Sep 2014)

  New Revision: 47590

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

  Log:
    fiddle/import.rb: fix typo
    
    * ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
      SIZEOF_LONG_LON.  [Fix GH-714]

  Modified files:
    trunk/ChangeLog
    trunk/ext/fiddle/lib/fiddle/import.rb
    trunk/test/fiddle/test_import.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47589)
+++ ChangeLog	(revision 47590)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Sep 15 09:43:18 2014  Sho Hashimoto  <sho.hsmt@g...>
+
+	* ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
+	  SIZEOF_LONG_LON.  [Fix GH-714]
+
 Mon Sep 15 08:13:40 2014  Matthew Draper  <matthew@t...>
 
 	* sprintf.c (rb_str_format): rational 'f' format works for more
Index: ext/fiddle/lib/fiddle/import.rb
===================================================================
--- ext/fiddle/lib/fiddle/import.rb	(revision 47589)
+++ ext/fiddle/lib/fiddle/import.rb	(revision 47590)
@@ -112,7 +112,7 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/ext/fiddle/lib/fiddle/import.rb#L112
         when TYPE_LONG
           return SIZEOF_LONG
         when TYPE_LONG_LONG
-          return SIZEOF_LONG_LON
+          return SIZEOF_LONG_LONG
         when TYPE_FLOAT
           return SIZEOF_FLOAT
         when TYPE_DOUBLE
Index: test/fiddle/test_import.rb
===================================================================
--- test/fiddle/test_import.rb	(revision 47589)
+++ test/fiddle/test_import.rb	(revision 47590)
@@ -65,6 +65,15 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_import.rb#L65
       assert_equal(LIBC::MyStruct.size(), LIBC.sizeof(LIBC::MyStruct.malloc()))
     end
 
+    Fiddle.constants.grep(/\ATYPE_(?!VOID\z)(.*)/) do
+      type = $&
+      size = Fiddle.const_get("SIZEOF_#{$1}")
+      name = $1.sub(/P\z/,"*").gsub(/_(?!T\z)/, " ").downcase
+      define_method("test_sizeof_#{name}") do
+        assert_equal(size, Fiddle::Importer.sizeof(name), type)
+      end
+    end
+
     def test_unsigned_result()
       d = (2 ** 31) + 1
 

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

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