compiling bytebuffer.c
bytebuffer.c:308:20: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
return INT2NUM(bytes_read);
~~~~~~~ ^~~~~~~~~~
bytebuffer.c:338:20: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
return INT2NUM(bytes_written);
~~~~~~~ ^~~~~~~~~~~~~
Getting this error on gem install nio4r using an Apple M1 computer with Ruby 3.0.6
The value of a long type is being assigned to an int type, which may result in the loss of data. By casting the bytes_read and bytes_written variable to an int type, this will ensure that the bytes_read and bytes_written value is truncated to fit in the range of an int type, and prevent any loss of data, which fixes this error.
Locally, I was able to install this gem on my Apple M1 with Ruby 3.0.6 with these changes.
For: https://github.com/socketry/nio4r/issues/298
Getting this error on
gem install nio4r
using an Apple M1 computer with Ruby 3.0.6The value of a
long
type is being assigned to anint
type, which may result in the loss of data. By casting thebytes_read
andbytes_written
variable to anint
type, this will ensure that thebytes_read
andbytes_written
value is truncated to fit in the range of anint
type, and prevent any loss of data, which fixes this error.Locally, I was able to install this gem on my Apple M1 with Ruby 3.0.6 with these changes.
I'm not a C programmer, so please scrutinize.
Types of Changes
Contribution