on master help sign in
documentation changes.
643e0ecaslatter
Data/UUID.hs+1−1
@@ -156,7 +156,7 @@ toStringUpper = toStringWrap c_show_upper
156
156
157-- |The passed in function /f/ is given a the raw UUID data
157-- |The passed in function /f/ is given a the raw UUID data
158-- and a 37-byte buffer to fill with the textual representation
158-- and a 37-byte buffer to fill with the textual representation
159−-- of the UUID. The buffer is expected to be null-terminated
159+-- of the UUID. The buffer is expected to contain a null-terminator
160-- after /f/ is finished.
160-- after /f/ is finished.
161toStringWrap :: (C_UUID -> CString -> IO ()) -> UUID -> String
161toStringWrap :: (C_UUID -> CString -> IO ()) -> UUID -> String
162toStringWrap f (U fp) = unsafePerformIO $
162toStringWrap f (U fp) = unsafePerformIO $
Data/UUID/Internal.hs+8−4
@@ -40,7 +40,7 @@ fromBytes xs = if length xs == 16
40 else error "Data.UUID.Internal.fromBytes: passed in list of bytes must be of length 16."
40 else error "Data.UUID.Internal.fromBytes: passed in list of bytes must be of length 16."
41
41
42-- |Creates a UUID out of a list of bytes.
42-- |Creates a UUID out of a list of bytes.
43−-- Does not perform a length check.
43+-- Does not perform a length check on the passed in list.
44-- Behavior is undefined for lists not of length 16.
44-- Behavior is undefined for lists not of length 16.
45unsafeFromBytes :: [Word8] -> UUID
45unsafeFromBytes :: [Word8] -> UUID
46unsafeFromBytes xs = U $ castForeignPtr $ unsafePerformIO $ do
46unsafeFromBytes xs = U $ castForeignPtr $ unsafePerformIO $ do
@@ -48,12 +48,16 @@ unsafeFromBytes xs = U $ castForeignPtr $ unsafePerformIO $ do
48 withForeignPtr p $ flip pokeArray xs
48 withForeignPtr p $ flip pokeArray xs
49 return p
49 return p
50
50
51+-- |Unsafe.
52+--
51−-- |Given a UUID, returns a pointer to the 16 bytes
53+-- Given a UUID, returns a pointer to the 16 bytes
52-- of memory that make up the UUID.
54-- of memory that make up the UUID.
53toForeignPtr :: UUID -> ForeignPtr CChar
55toForeignPtr :: UUID -> ForeignPtr CChar
54toForeignPtr (U p) = p
56toForeignPtr (U p) = p
55
57
58+-- |Unsafe.
59+--
56−-- |The passed in pointer is treated as if it were a pointer
60+-- The passed in pointer is treated as if it were a pointer
57−-- to 16 bytes of memory. You're in trouble if it isn't.
61+-- to 16 bytes of memory, which is then returned as a UUID.
58fromForeignPtr :: ForeignPtr CChar -> UUID
62fromForeignPtr :: ForeignPtr CChar -> UUID
59fromForeignPtr = U
63fromForeignPtr = U