Correct the required length for json string building
This commit is contained in:
parent
e79864aa0d
commit
dafb1bb37f
2 changed files with 4 additions and 1 deletions
|
@ -9,6 +9,7 @@ to ease the migration process.
|
|||
|
||||
* Fix `doubleDec`, which was encoding small numbers incorrectly.
|
||||
* Add `runByteString` for producing `ByteString` from bounded builders.
|
||||
* Correct the required length calculation for json string encoding.
|
||||
|
||||
## 0.3.7.0 -- 2020-11-06
|
||||
|
||||
|
|
|
@ -669,7 +669,9 @@ slicedUtf8TextJson !src# !soff0# !slen0# = fromFunction reqLen $ \dst doff0 -> d
|
|||
pure (doffRes + 1)
|
||||
where
|
||||
slen0 = I# slen0#
|
||||
reqLen = (2 * slen0) + 2
|
||||
-- We multiply by 6 because, in the worst case, everything might be in the
|
||||
-- unprintable ASCII range. The plus 2 is for the quotes on the ends.
|
||||
reqLen = (6 * slen0) + 2
|
||||
|
||||
-- | Constructor for 'Builder' that works on a function with lifted
|
||||
-- arguments instead of unlifted ones. This is just as unsafe as the
|
||||
|
|
Loading…
Reference in a new issue