iconara / cql-rb

Cassandra CQL 3 binary protocol driver for Ruby
106 stars 31 forks source link

Fixing varint and decimal encoding/decoding #118

Closed ahisbrook closed 10 years ago

ahisbrook commented 10 years ago

Found several numbers which were encoding/decoding incorrectly. The issue was in append_varint.

Example: append_varint(1042342234234); read_varint returns -57169393542

Also made a small change to read_decimal which would occasionally fail to decode decimals between -1 and 0.

Example: append_decimal(-0.031108612692221094); read_decimal returns 0.0

iconara commented 10 years ago

Thanks for hunting down these bugs, I'll merge this in the morning and push up a new gem.

iconara commented 10 years ago

Merged through 31d5520dcedc49bfd80cb83e3c69c33cfa477b7c. v2.0.3 is up on RubyGems.