ruby-changes:28616
From: kosaki <ko1@a...>
Date: Sun, 12 May 2013 17:42:44 +0900 (JST)
Subject: [ruby-changes:28616] kosaki:r40668 (trunk): * file.c (rb_file_s_truncate): use correct type. chsize takes
kosaki 2013-05-12 17:42:30 +0900 (Sun, 12 May 2013) New Revision: 40668 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40668 Log: * file.c (rb_file_s_truncate): use correct type. chsize takes a long. Modified files: trunk/ChangeLog trunk/configure.in trunk/file.c Index: configure.in =================================================================== --- configure.in (revision 40667) +++ configure.in (revision 40668) @@ -1810,7 +1810,7 @@ AC_CHECK_FUNCS(telldir) https://github.com/ruby/ruby/blob/trunk/configure.in#L1810 AC_CHECK_FUNCS(timegm) AC_CHECK_FUNCS(times) AC_CHECK_FUNCS(truncate) -AC_CHECK_FUNCS(truncate64) +AC_CHECK_FUNCS(truncate64) # used for Win32 AC_CHECK_FUNCS(unsetenv) AC_CHECK_FUNCS(utimensat) AC_CHECK_FUNCS(utimes) Index: ChangeLog =================================================================== --- ChangeLog (revision 40667) +++ ChangeLog (revision 40668) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun May 12 17:25:46 2013 KOSAKI Motohiro <kosaki.motohiro@g...> + + * configure.in: removes AC_CHECK_FUNCS(truncate64) because it's + unused. + * file.c (rb_file_s_truncate): use correct type. chsize takes + a long. + Sun May 12 17:18:46 2013 KOSAKI Motohiro <kosaki.motohiro@g...> * process.c: move '#define SPAWNV 1' to win32/Makefile.sub. Index: file.c =================================================================== --- file.c (revision 40667) +++ file.c (revision 40668) @@ -4098,10 +4098,16 @@ rb_file_s_join(VALUE klass, VALUE args) https://github.com/ruby/ruby/blob/trunk/file.c#L4098 static VALUE rb_file_s_truncate(VALUE klass, VALUE path, VALUE len) { +#ifdef HAVE_TRUNCATE +#define NUM2POS(n) NUM2OFFT(n) off_t pos; +#else +#define NUM2POS(n) NUM2LONG(n) + long pos; +#endif rb_secure(2); - pos = NUM2OFFT(len); + pos = NUM2POS(len); FilePathValue(path); path = rb_str_encode_ospath(path); #ifdef HAVE_TRUNCATE @@ -4123,6 +4129,7 @@ rb_file_s_truncate(VALUE klass, VALUE pa https://github.com/ruby/ruby/blob/trunk/file.c#L4129 } #endif return INT2FIX(0); +#undef NUM2POS } #else #define rb_file_s_truncate rb_f_notimplement -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/