Skip to content

Commit e7c0073

Browse files
authored
Fix conversion loses int precision using SIZET2NUM. (#297)
1 parent fbd65ff commit e7c0073

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ext/nio4r/bytebuffer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static VALUE NIO_ByteBuffer_read_from(VALUE self, VALUE io)
305305

306306
buffer->position += bytes_read;
307307

308-
return INT2NUM(bytes_read);
308+
return SIZET2NUM(bytes_read);
309309
}
310310

311311
static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io)
@@ -335,7 +335,7 @@ static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io)
335335

336336
buffer->position += bytes_written;
337337

338-
return INT2NUM(bytes_written);
338+
return SIZET2NUM(bytes_written);
339339
}
340340

341341
static VALUE NIO_ByteBuffer_flip(VALUE self)

ext/nio4r/monitor.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static VALUE NIO_Monitor_add_interest(VALUE self, VALUE interest)
182182
Data_Get_Struct(self, struct NIO_Monitor, monitor);
183183

184184
interest = monitor->interests | NIO_Monitor_symbol2interest(interest);
185-
NIO_Monitor_update_interests(self, interest);
185+
NIO_Monitor_update_interests(self, (int)interest);
186186

187187
return rb_ivar_get(self, rb_intern("interests"));
188188
}
@@ -193,7 +193,7 @@ static VALUE NIO_Monitor_remove_interest(VALUE self, VALUE interest)
193193
Data_Get_Struct(self, struct NIO_Monitor, monitor);
194194

195195
interest = monitor->interests & ~NIO_Monitor_symbol2interest(interest);
196-
NIO_Monitor_update_interests(self, interest);
196+
NIO_Monitor_update_interests(self, (int)interest);
197197

198198
return rb_ivar_get(self, rb_intern("interests"));
199199
}

lib/nio/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module NIO
4-
VERSION = "2.5.9"
4+
VERSION = "2.6.0"
55
end

0 commit comments

Comments
 (0)