libBF 0.6.1 → 0.6.2
raw patch · 3 files changed
+8/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- libBF.cabal +1/−1
- src/LibBF/Mutable.hsc +2/−7
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for libBF-hs +## 0.6.2 -- 2021-02-19++* Fix a bug related to incorrect marshalling of String to C in+ `setString` and `bfFromString`.+ ## 0.6.1 -- 2021-02-16 * Fix a linker issue on Windows when loading via the GHC dynamic linker.
libBF.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: libBF-version: 0.6.1+version: 0.6.2 synopsis: A binding to the libBF library. description: LibBF is a C library for working with arbitray precision IEEE 754 floating point numbers.
src/LibBF/Mutable.hsc view
@@ -75,8 +75,6 @@ import Data.Hashable import Data.List(unfoldr) import Control.Monad(foldM,when)-import Control.Exception(bracket)-import GHC.IO.Encoding(getForeignEncoding,setForeignEncoding,char8) import Foreign.Storable @@ -525,14 +523,11 @@ setString radix (BFOpts prec flags) inStr = bf1 \bfPtr -> alloca \nextPtr ->- bracket (getForeignEncoding >>= \e -> setForeignEncoding char8 >> pure e)- setForeignEncoding- \_enc ->- withCStringLen inStr \(strPtr,len) ->+ withCAString inStr \strPtr -> do stat <- bf_atof bfPtr strPtr nextPtr (fromIntegral radix) prec flags next <- peek nextPtr let consumed = next `minusPtr` strPtr- usedAll = len == consumed+ usedAll = length inStr == consumed consumed `seq` usedAll `seq` pure (Status stat, consumed, usedAll)