X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FC%2FString.hs;h=8a23c6b772fb4af2d1e56b3143aa056d215f3e4d;hb=d71aee821935e29a3569bc4b401f695536209c85;hp=03826dd4384d60b4315a72ab009132193363aab8;hpb=aaf764b3ad8b1816d68b5f27299eac125f08e1a5;p=haskell-directory.git diff --git a/Foreign/C/String.hs b/Foreign/C/String.hs index 03826dd..8a23c6b 100644 --- a/Foreign/C/String.hs +++ b/Foreign/C/String.hs @@ -168,10 +168,8 @@ newCStringLen = newCAStringLen withCString :: String -> (CString -> IO a) -> IO a withCString = withCAString --- | Marshal a Haskell string into a NUL terminated C string using temporary --- storage. --- --- * the Haskell string may /not/ contain any NUL characters +-- | Marshal a Haskell string into a C string (ie, character array) +-- in temporary storage, with explicit length information. -- -- * the memory is freed when the subcomputation terminates (either -- normally or via an exception), so the pointer to the temporary @@ -309,10 +307,8 @@ withCAString str f = f ptr #endif --- | Marshal a Haskell string into a NUL terminated C string using temporary --- storage. --- --- * the Haskell string may /not/ contain any NUL characters +-- | Marshal a Haskell string into a C string (ie, character array) +-- in temporary storage, with explicit length information. -- -- * the memory is freed when the subcomputation terminates (either -- normally or via an exception), so the pointer to the temporary @@ -444,7 +440,7 @@ wNUL = 0 cWcharsToChars :: [CWchar] -> [Char] charsToCWchars :: [Char] -> [CWchar] -#ifdef mingw32_TARGET_OS +#ifdef mingw32_HOST_OS -- On Windows, wchar_t is 16 bits wide and CWString uses the UTF-16 encoding. @@ -465,7 +461,7 @@ charsToCWchars = foldr utf16Char [] . map ord fromIntegral (c' `div` 0x400 + 0xd800) : fromIntegral (c' `mod` 0x400 + 0xdc00) : wcs -#else /* !mingw32_TARGET_OS */ +#else /* !mingw32_HOST_OS */ cWcharsToChars xs = map castCWcharToChar xs charsToCWchars xs = map castCharToCWchar xs @@ -479,4 +475,4 @@ castCWcharToChar ch = chr (fromIntegral ch ) castCharToCWchar :: Char -> CWchar castCharToCWchar ch = fromIntegral (ord ch) -#endif /* !mingw32_TARGET_OS */ +#endif /* !mingw32_HOST_OS */