Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conversion loses int precision #297

Merged
merged 3 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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