fixed bug where 4 bytes of data would be written with only 3 expected.
This commit is contained in:
parent
1abcc9b425
commit
e6bef92ab7
1 changed files with 5 additions and 1 deletions
6
thing.rb
6
thing.rb
|
@ -390,6 +390,10 @@ if $0 == __FILE__
|
|||
else
|
||||
bits = Math.log(node_count, 2).ceil
|
||||
bytes = (bits / 8).ceil
|
||||
if bytes == 3
|
||||
# must write this as a 32-bit int
|
||||
bytes = 4
|
||||
end
|
||||
file.write([128 + bytes].pack("C"))
|
||||
|
||||
# get the correct integer directive for pack()
|
||||
|
@ -400,7 +404,7 @@ if $0 == __FILE__
|
|||
when 2
|
||||
# 16-bit unsigned big-endian
|
||||
directive = "n"
|
||||
when 3..4
|
||||
when 4
|
||||
# 32-bit unsigned big-endian
|
||||
directive = "N"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue