on master help sign in
documentation changes.
commit643e0ecb4ef020e9ffd6c4fe516bccce1221f080 authoraslatter <aslatter@gmail.com> dateSun 23 Mar 2008, 18:52 (19 years ago) parent094d69f
2 files changed+9−5
Data/UUID.hs+1−1 Data/UUID/Internal.hs+8−4
Data/UUID.hs+1−1
@@ -156,7 +156,7 @@ toStringUpper = toStringWrap c_show_upper
156156
157157-- |The passed in function /f/ is given a the raw UUID data
158158-- 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
160160-- after /f/ is finished.
161161toStringWrap :: (C_UUID -> CString -> IO ()) -> UUID -> String
162162toStringWrap f (U fp) = unsafePerformIO $
Data/UUID/Internal.hs+8−4
@@ -40,7 +40,7 @@ fromBytes xs = if length xs == 16
4040 else error "Data.UUID.Internal.fromBytes: passed in list of bytes must be of length 16."
4141
4242-- |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.
4444-- Behavior is undefined for lists not of length 16.
4545unsafeFromBytes :: [Word8] -> UUID
4646unsafeFromBytes xs = U $ castForeignPtr $ unsafePerformIO $ do
@@ -48,12 +48,16 @@ unsafeFromBytes xs = U $ castForeignPtr $ unsafePerformIO $ do
4848 withForeignPtr p $ flip pokeArray xs
4949 return p
5050
51−-- |Given a UUID, returns a pointer to the 16 bytes
51+-- |Unsafe.
52+--
53+-- Given a UUID, returns a pointer to the 16 bytes
5254-- of memory that make up the UUID.
5355toForeignPtr :: UUID -> ForeignPtr CChar
5456toForeignPtr (U p) = p
5557
56−-- |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.
58+-- |Unsafe.
59+--
60+-- The passed in pointer is treated as if it were a pointer
61+-- to 16 bytes of memory, which is then returned as a UUID.
5862fromForeignPtr :: ForeignPtr CChar -> UUID
5963fromForeignPtr = U