VALUE bdata = rb_ary_new();
int i;
for (i = 0; i < length; i++) {
- rb_ary_push(bdata, INT2NUM(buf[i]));
+ rb_ary_push(bdata, INT2NUM((unsigned char) buf[i]));
}
val = rb_funcall(rb_path2class("EJDBBinary"), rb_intern("new"), 1, bdata);
for (i = 0; i < length; i++) {
VALUE byte = rb_ary_entry(bdata, i);
if (NUM2INT(byte) > 255 || NUM2INT(byte) < 0) {
- rb_raise(rb_eRuntimeError, "Invalid value in binary array for EJDBBinary");
+ rb_raise(rb_eRuntimeError, "Invalid value in binary array for EJDBBinary: %d", NUM2INT(byte));
}
}
:true => true,
:false => false,
:symbol => :symbol,
- :binary => EJDBBinary.new([1, 1, 1]),
+ :binary => EJDBBinary.new([1, 0, 255]),
:time => Time.now
})
assert !obj["false"]
assert obj["symbol"].is_a? Symbol
assert_equal(:symbol, obj["symbol"])
- assert_equal([1, 1, 1], obj["binary"].to_a)
+ assert_equal([1, 0, 255], obj["binary"].to_a)
assert obj["time"].is_a? Time
#puts $jb.find("monsters").to_a.to_s