[commit: haskeline] encoding: Use the CAString functions whenever we expect an ASCII string (1dde2b6)
Max Bolingbroke
batterseapower at hotmail.com
Tue Apr 5 10:04:13 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/haskeline
On branch : encoding
http://hackage.haskell.org/trac/ghc/changeset/1dde2b6d97b11b379f29bef54f16ed4fef2f9a1b
>---------------------------------------------------------------
commit 1dde2b6d97b11b379f29bef54f16ed4fef2f9a1b
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date: Tue Apr 5 08:12:58 2011 +0100
Use the CAString functions whenever we expect an ASCII string
>---------------------------------------------------------------
System/Console/Haskeline/Backend/IConv.hsc | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/System/Console/Haskeline/Backend/IConv.hsc b/System/Console/Haskeline/Backend/IConv.hsc
index 5544143..ccc572b 100644
--- a/System/Console/Haskeline/Backend/IConv.hsc
+++ b/System/Console/Haskeline/Backend/IConv.hsc
@@ -65,19 +65,19 @@ openPartialDecoder codeset = do
foreign import ccall "setlocale" c_setlocale :: CInt -> CString -> IO CString
setLocale :: Maybe String -> IO (Maybe String)
-setLocale oldLocale = (maybeWith withCString) oldLocale $ \loc_p -> do
- c_setlocale (#const LC_CTYPE) loc_p >>= maybePeek peekCString
+setLocale oldLocale = (maybeWith withCAString) oldLocale $ \loc_p -> do
+ c_setlocale (#const LC_CTYPE) loc_p >>= maybePeek peekCAString
-----------------
-- Getting the encoding
type NLItem = #type nl_item
-foreign import ccall nl_langinfo :: NLItem -> IO CString
+foreign import ccall nl_langinfo :: NLItem -> IO CAString
getCodeset :: IO String
getCodeset = do
- str <- nl_langinfo (#const CODESET) >>= peekCString
+ str <- nl_langinfo (#const CODESET) >>= peekCAString
-- check for codesets which may be returned by Solaris, but not understood
-- by GNU iconv.
if str `elem` ["","646"]
@@ -95,8 +95,8 @@ foreign import ccall "h_iconv_open" iconv_open
:: CString -> CString -> IO IConvTPtr
iconvOpen :: String -> String -> IO IConvT
-iconvOpen destName srcName = withCString destName $ \dest ->
- withCString srcName $ \src -> do
+iconvOpen destName srcName = withCAString destName $ \dest ->
+ withCAString srcName $ \src -> do
res <- iconv_open dest src
if res == nullPtr `plusPtr` (-1)
then throwErrno $ "iconvOpen "
More information about the Cvs-libraries
mailing list