mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in: removes AC_CHECK_FUNC(ftruncate64).
* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating NUM2OFFT. * file.c (rb_file_truncate): use correct type. chsize() take a long. * include/ruby/ruby.h (NUM2OFFT): use a definition created by a configure script by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e79f790798
commit
05628d3b6d
4 changed files with 25 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
|||
Sun May 12 16:31:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* configure.in: adds RUBY_REPLACE_TYPE(off_t) for creating
|
||||
NUM2OFFT.
|
||||
* file.c (rb_file_truncate): use correct type. chsize() take
|
||||
a long.
|
||||
* include/ruby/ruby.h (NUM2OFFT): use a definition created by
|
||||
a configure script by default.
|
||||
|
||||
Sun May 12 16:03:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* configure.in: removes AC_CHECK_FUNC(fseeko, fseeko64, ftello,
|
||||
|
|
|
@ -1246,6 +1246,7 @@ RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [
|
|||
@%:@endif
|
||||
@%:@include <sys/resource.h>
|
||||
])
|
||||
RUBY_REPLACE_TYPE(off_t, [], OFFT)
|
||||
|
||||
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
|
||||
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
|
||||
|
@ -1745,7 +1746,7 @@ AC_CHECK_FUNCS(fmod)
|
|||
AC_CHECK_FUNCS(fork)
|
||||
AC_CHECK_FUNCS(fsync)
|
||||
AC_CHECK_FUNCS(ftruncate)
|
||||
AC_CHECK_FUNCS(ftruncate64)
|
||||
AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform
|
||||
AC_CHECK_FUNCS(getcwd)
|
||||
AC_CHECK_FUNCS(getgrnam_r)
|
||||
AC_CHECK_FUNCS(getgroups)
|
||||
|
|
9
file.c
9
file.c
|
@ -4147,10 +4147,16 @@ static VALUE
|
|||
rb_file_truncate(VALUE obj, VALUE len)
|
||||
{
|
||||
rb_io_t *fptr;
|
||||
#if defined(HAVE_FTRUNCATE)
|
||||
#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);
|
||||
GetOpenFile(obj, fptr);
|
||||
if (!(fptr->mode & FMODE_WRITABLE)) {
|
||||
rb_raise(rb_eIOError, "not opened for writing");
|
||||
|
@ -4164,6 +4170,7 @@ rb_file_truncate(VALUE obj, VALUE len)
|
|||
rb_sys_fail_path(fptr->pathv);
|
||||
#endif
|
||||
return INT2FIX(0);
|
||||
#undef NUM2POS
|
||||
}
|
||||
#else
|
||||
#define rb_file_truncate rb_f_notimplement
|
||||
|
|
|
@ -641,10 +641,12 @@ rb_num2ll_inline(VALUE x)
|
|||
# define NUM2ULL(x) rb_num2ull(x)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
|
||||
# define NUM2OFFT(x) ((off_t)NUM2LL(x))
|
||||
#else
|
||||
# define NUM2OFFT(x) NUM2LONG(x)
|
||||
#if !defined(NUM2OFFT)
|
||||
# if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
|
||||
# define NUM2OFFT(x) ((off_t)NUM2LL(x))
|
||||
# else
|
||||
# define NUM2OFFT(x) NUM2LONG(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG
|
||||
|
|
Loading…
Reference in a new issue