X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FHandle.hs;h=f3008c437a636f097453b90d8ac4780125ca93f9;hb=002864325037f03891f46044319ed2ccc372f240;hp=056e2af9bec073998c7a7994ef55a7f39ab7129e;hpb=d95bc90db44a12ac85e71d570735410eb27f6e30;p=ghc-base.git diff --git a/GHC/Handle.hs b/GHC/Handle.hs index 056e2af..f3008c4 100644 --- a/GHC/Handle.hs +++ b/GHC/Handle.hs @@ -76,6 +76,9 @@ import GHC.Enum import GHC.Num ( Integer(..), Num(..) ) import GHC.Show import GHC.Real ( toInteger ) +#if defined(DEBUG_DUMP) +import GHC.Pack +#endif import GHC.Conc @@ -512,7 +515,7 @@ fillReadBufferWithoutBlocking fd is_stream -- buffer better be empty: assert (r == 0 && w == 0) $ do #ifdef DEBUG_DUMP - puts ("fillReadBufferLoopNoBlock: bytes = " ++ show bytes ++ "\n") + puts ("fillReadBufferLoopNoBlock: bytes = " ++ show size ++ "\n") #endif res <- readRawBufferNoBlock "fillReadBuffer" fd is_stream b 0 (fromIntegral size) @@ -1208,6 +1211,8 @@ hSetBuffering handle mode = -- 'raw' mode under win32 is a bit too specialised (and troublesome -- for most common uses), so simply disable its use here. NoBuffering -> setCooked (haFD handle_) False +#else + NoBuffering -> return () #endif _ -> setCooked (haFD handle_) True @@ -1628,10 +1633,10 @@ showHandle' filepath is_duplex h = -- --------------------------------------------------------------------------- -- debugging -#ifdef DEBUG_DUMP +#if defined(DEBUG_DUMP) puts :: String -> IO () -puts s = withCString s $ \cstr -> do write_rawBuffer 1 False cstr 0 (fromIntegral (length s)) - return () +puts s = do write_rawBuffer 1 (unsafeCoerce# (packCString# s)) 0 (fromIntegral (length s)) + return () #endif -- -----------------------------------------------------------------------------