summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-05 20:23:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-08 23:01:07 +0900
commite2ccb316b437104cd1734c378970d34f5305966d (patch)
treee6544bb77416690a8e79d9ca925aaa877bfa60a7 /win32
parent55fef084dac843caf155f03077773704b36e139e (diff)
downloadruby-e2ccb316b437104cd1734c378970d34f5305966d.tar.gz
[Bug #5317] Use `rb_off_t` instead of `off_t`
Get rid of the conflict with system-provided small `off_t`.
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile.sub4
-rw-r--r--win32/win32.c16
2 files changed, 12 insertions, 8 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index e4b9a3cac8..0b1f41f70e 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -632,6 +632,10 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define ULL_TO_DOUBLE(n) ((double)(unsigned long)((n)>>32) * (1I64 << 32) + (unsigned long)(n))
!endif
#define HAVE_OFF_T 1
+#define rb_off_t __int64
+#define SIGNEDNESS_OF_OFF_T -1
+#define OFFT2NUM(v) LL2NUM(v)
+#define NUM2OFFT(v) NUM2LL(v)
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
diff --git a/win32/win32.c b/win32/win32.c
index edf89be4b1..480b7a6797 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5899,8 +5899,8 @@ rb_w32_lstati128(const char *path, struct stati128 *st)
}
/* License: Ruby's */
-off_t
-rb_w32_lseek(int fd, off_t ofs, int whence)
+rb_off_t
+rb_w32_lseek(int fd, rb_off_t ofs, int whence)
{
SOCKET sock = TO_SOCKET(fd);
if (is_socket(sock) || is_pipe(sock)) {
@@ -5941,7 +5941,7 @@ rb_w32_uaccess(const char *path, int mode)
/* License: Ruby's */
static int
-rb_chsize(HANDLE h, off_t size)
+rb_chsize(HANDLE h, rb_off_t size)
{
long upos, lpos, usize, lsize;
int ret = -1;
@@ -5970,7 +5970,7 @@ rb_chsize(HANDLE h, off_t size)
/* License: Ruby's */
static int
-w32_truncate(const char *path, off_t length, UINT cp)
+w32_truncate(const char *path, rb_off_t length, UINT cp)
{
HANDLE h;
int ret;
@@ -5992,21 +5992,21 @@ w32_truncate(const char *path, off_t length, UINT cp)
/* License: Ruby's */
int
-rb_w32_utruncate(const char *path, off_t length)
+rb_w32_utruncate(const char *path, rb_off_t length)
{
return w32_truncate(path, length, CP_UTF8);
}
/* License: Ruby's */
int
-rb_w32_truncate(const char *path, off_t length)
+rb_w32_truncate(const char *path, rb_off_t length)
{
return w32_truncate(path, length, filecp());
}
/* License: Ruby's */
int
-rb_w32_ftruncate(int fd, off_t length)
+rb_w32_ftruncate(int fd, rb_off_t length)
{
HANDLE h;
@@ -8214,7 +8214,7 @@ VALUE (*const rb_f_notimplement_)(int, const VALUE *, VALUE, VALUE) = rb_f_notim
#endif
void *
-rb_w32_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
+rb_w32_mmap(void *addr, size_t len, int prot, int flags, int fd, rb_off_t offset)
{
void *ptr;
//DWORD protect = 0;