diff options
author | Benjamin Barenblat <bbaren@google.com> | 2018-08-31 17:16:59 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2018-08-31 17:16:59 -0400 |
commit | c9eb11a8b685dffa9035f324ca11a727cd16a128 (patch) | |
tree | 1d2974aa79a7dd87b353a0fc435f605712ddefe6 /src/BTLS/Buffer.hs | |
parent | b1639dda870f22a78136b26295f98585e503fa98 (diff) |
Replace `unsafeCoerce' with `castPtr'
Diffstat (limited to 'src/BTLS/Buffer.hs')
-rw-r--r-- | src/BTLS/Buffer.hs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/BTLS/Buffer.hs b/src/BTLS/Buffer.hs index 186054f..1a334e9 100644 --- a/src/BTLS/Buffer.hs +++ b/src/BTLS/Buffer.hs @@ -22,7 +22,6 @@ import qualified Data.ByteString as ByteString import qualified Data.ByteString.Unsafe as ByteString import Foreign (Ptr, castPtr) import Foreign.C.Types -import Unsafe.Coerce (unsafeCoerce) unsafeUseAsCBuffer :: ByteString -> ((Ptr a, CULong) -> IO b) -> IO b unsafeUseAsCBuffer bs f = @@ -31,7 +30,4 @@ unsafeUseAsCBuffer bs f = packCUStringLen :: Integral n => (Ptr CUChar, n) -> IO ByteString packCUStringLen (pStr, len) = - ByteString.packCStringLen (asCCharBuf pStr, fromIntegral len) - -asCCharBuf :: Ptr CUChar -> Ptr CChar -asCCharBuf = unsafeCoerce + ByteString.packCStringLen (castPtr pStr, fromIntegral len) |