Skip to content

Commit

Permalink
Fix conversion loses int precision using SIZET2NUM. (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsimnujhawj authored Apr 21, 2023
1 parent fbd65ff commit e7c0073
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ext/nio4r/bytebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static VALUE NIO_ByteBuffer_read_from(VALUE self, VALUE io)

buffer->position += bytes_read;

return INT2NUM(bytes_read);
return SIZET2NUM(bytes_read);
}

static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io)
Expand Down Expand Up @@ -335,7 +335,7 @@ static VALUE NIO_ByteBuffer_write_to(VALUE self, VALUE io)

buffer->position += bytes_written;

return INT2NUM(bytes_written);
return SIZET2NUM(bytes_written);
}

static VALUE NIO_ByteBuffer_flip(VALUE self)
Expand Down
4 changes: 2 additions & 2 deletions ext/nio4r/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand All @@ -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"));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/nio/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module NIO
VERSION = "2.5.9"
VERSION = "2.6.0"
end

0 comments on commit e7c0073

Please sign in to comment.