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

ruby-changes:53105

From: mame <ko1@a...>
Date: Tue, 23 Oct 2018 21:23:10 +0900 (JST)
Subject: [ruby-changes:53105] mame:r65319 (trunk): file.c: use correct integer-conversion function

mame	2018-10-23 21:23:04 +0900 (Tue, 23 Oct 2018)

  New Revision: 65319

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

  Log:
    file.c: use correct integer-conversion function
    
    The return value of major() and minor() is unsigned int, not dev_t.
    So, UINT2NUM() is a better choice than DEVT2NUM().

  Modified files:
    trunk/file.c
Index: file.c
===================================================================
--- file.c	(revision 65318)
+++ file.c	(revision 65319)
@@ -572,7 +572,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/file.c#L572
 rb_stat_dev_major(VALUE self)
 {
 #if defined(major)
-    return DEVT2NUM(major(get_stat(self)->st_dev));
+    return UINT2NUM(major(get_stat(self)->st_dev));
 #else
     return Qnil;
 #endif
@@ -593,7 +593,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/file.c#L593
 rb_stat_dev_minor(VALUE self)
 {
 #if defined(minor)
-    return DEVT2NUM(minor(get_stat(self)->st_dev));
+    return UINT2NUM(minor(get_stat(self)->st_dev));
 #else
     return Qnil;
 #endif
@@ -731,7 +731,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/file.c#L731
 rb_stat_rdev_major(VALUE self)
 {
 #if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(major)
-    return DEVT2NUM(major(get_stat(self)->st_rdev));
+    return UINT2NUM(major(get_stat(self)->st_rdev));
 #else
     return Qnil;
 #endif
@@ -752,7 +752,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/file.c#L752
 rb_stat_rdev_minor(VALUE self)
 {
 #if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(minor)
-    return DEVT2NUM(minor(get_stat(self)->st_rdev));
+    return UINT2NUM(minor(get_stat(self)->st_rdev));
 #else
     return Qnil;
 #endif

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

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