зеркало из https://github.com/github/ruby.git
* file.c (rb_file_s_truncate): use correct type. chsize takes
a long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
93d061a8fd
Коммит
96ffcf557b
|
@ -1,3 +1,10 @@
|
|||
Sun May 12 17:25:46 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* 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@gmail.com>
|
||||
|
||||
* process.c: move '#define SPAWNV 1' to win32/Makefile.sub.
|
||||
|
|
|
@ -1810,7 +1810,7 @@ AC_CHECK_FUNCS(telldir)
|
|||
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)
|
||||
|
|
9
file.c
9
file.c
|
@ -4098,10 +4098,16 @@ rb_file_s_join(VALUE klass, VALUE args)
|
|||
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 path, VALUE len)
|
|||
}
|
||||
#endif
|
||||
return INT2FIX(0);
|
||||
#undef NUM2POS
|
||||
}
|
||||
#else
|
||||
#define rb_file_s_truncate rb_f_notimplement
|
||||
|
|
Загрузка…
Ссылка в новой задаче