From 525fcb6b85f02112027e18ed1f8ecb9207a2bdde Mon Sep 17 00:00:00 2001 From: Tsimnuj Hawj Date: Wed, 19 Apr 2023 11:43:05 -0500 Subject: [PATCH 1/3] add int cast to bytes_read --- ext/nio4r/bytebuffer.c | 2 +- lib/nio/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/nio4r/bytebuffer.c b/ext/nio4r/bytebuffer.c index 2bd7635..5c1d95d 100644 --- a/ext/nio4r/bytebuffer.c +++ b/ext/nio4r/bytebuffer.c @@ -305,7 +305,7 @@ static VALUE NIO_ByteBuffer_read_from(VALUE self, VALUE io) buffer->position += bytes_read; - return INT2NUM(bytes_read); + return INT2NUM((int)bytes_read); } static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io) diff --git a/lib/nio/version.rb b/lib/nio/version.rb index a82f86f..e6531ef 100644 --- a/lib/nio/version.rb +++ b/lib/nio/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module NIO - VERSION = "2.5.9" + VERSION = "2.6.0" end From fd58571e8162c116262a8984d6336daff5eef5ae Mon Sep 17 00:00:00 2001 From: Tsimnuj Hawj Date: Wed, 19 Apr 2023 11:53:36 -0500 Subject: [PATCH 2/3] more type casting --- ext/nio4r/bytebuffer.c | 2 +- ext/nio4r/monitor.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/nio4r/bytebuffer.c b/ext/nio4r/bytebuffer.c index 5c1d95d..5e0e9e5 100644 --- a/ext/nio4r/bytebuffer.c +++ b/ext/nio4r/bytebuffer.c @@ -335,7 +335,7 @@ static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io) buffer->position += bytes_written; - return INT2NUM(bytes_written); + return INT2NUM((int)bytes_written); } static VALUE NIO_ByteBuffer_flip(VALUE self) diff --git a/ext/nio4r/monitor.c b/ext/nio4r/monitor.c index 2958aa3..cf9074f 100644 --- a/ext/nio4r/monitor.c +++ b/ext/nio4r/monitor.c @@ -182,7 +182,7 @@ static VALUE NIO_Monitor_add_interest(VALUE self, VALUE interest) Data_Get_Struct(self, struct NIO_Monitor, monitor); interest = monitor->interests | NIO_Monitor_symbol2interest(interest); - NIO_Monitor_update_interests(self, interest); + NIO_Monitor_update_interests(self, (int)interest); return rb_ivar_get(self, rb_intern("interests")); } @@ -193,7 +193,7 @@ static VALUE NIO_Monitor_remove_interest(VALUE self, VALUE interest) Data_Get_Struct(self, struct NIO_Monitor, monitor); interest = monitor->interests & ~NIO_Monitor_symbol2interest(interest); - NIO_Monitor_update_interests(self, interest); + NIO_Monitor_update_interests(self, (int)interest); return rb_ivar_get(self, rb_intern("interests")); } From 8d02af393c595735edcad19ee86ecc750542e91f Mon Sep 17 00:00:00 2001 From: Tsimnuj Hawj Date: Thu, 20 Apr 2023 06:56:08 -0500 Subject: [PATCH 3/3] replace cast with SIZET2NUM --- ext/nio4r/bytebuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/nio4r/bytebuffer.c b/ext/nio4r/bytebuffer.c index 5e0e9e5..e3462c0 100644 --- a/ext/nio4r/bytebuffer.c +++ b/ext/nio4r/bytebuffer.c @@ -305,7 +305,7 @@ static VALUE NIO_ByteBuffer_read_from(VALUE self, VALUE io) buffer->position += bytes_read; - return INT2NUM((int)bytes_read); + return SIZET2NUM(bytes_read); } static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io) @@ -335,7 +335,7 @@ static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io) buffer->position += bytes_written; - return INT2NUM((int)bytes_written); + return SIZET2NUM(bytes_written); } static VALUE NIO_ByteBuffer_flip(VALUE self)