lib/ffi-icu/number_formatting.rb in ffi-icu-0.1.6 vs lib/ffi-icu/number_formatting.rb in ffi-icu-0.1.7
- old
+ new
@@ -79,11 +79,11 @@
end
when Bignum
needed_length = Lib.unum_format_int64(@f, number, out_ptr, needed_length, nil, error)
end
end
- out_ptr.string
+ out_ptr.string needed_length
rescue BufferOverflowError
raise BufferOverflowError, "needed: #{needed_length}" if retried
out_ptr = out_ptr.resized_to needed_length
retried = true
retry
@@ -113,10 +113,10 @@
retried = false
begin
Lib.check_error do |error|
- needed_length = Lib.unum_format_currency(@f, number, UCharPointer.from_string(currency, 3), out_ptr, needed_length, nil, error)
+ needed_length = Lib.unum_format_currency(@f, number, UCharPointer.from_string(currency, 4), out_ptr, needed_length, nil, error)
end
out_ptr.string
rescue BufferOverflowError
raise BufferOverflowError, "needed: #{needed_length}" if retried
out_ptr = out_ptr.resized_to needed_length