From: sof Date: Thu, 11 Sep 2003 05:05:34 +0000 (+0000) Subject: [project @ 2003-09-11 05:05:34 by sof] X-Git-Tag: Approx_11550_changesets_converted~473 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=b960cef538f6744d047dc04e7bc73c1fbd3bf41b;p=ghc-hetmet.git [project @ 2003-09-11 05:05:34 by sof] hGetStringBuffer: open file in binary mode --- diff --git a/ghc/compiler/utils/StringBuffer.lhs b/ghc/compiler/utils/StringBuffer.lhs index 16218fd..b12745f 100644 --- a/ghc/compiler/utils/StringBuffer.lhs +++ b/ghc/compiler/utils/StringBuffer.lhs @@ -47,6 +47,11 @@ import GHC.IO ( slurpFile ) #endif import IO ( openFile, hFileSize, IOMode(ReadMode) ) +#if __GLASGOW_HASKELL__ >= 601 +import System.IO ( openBinaryFile ) +#else +import IOExts ( openFileEx, IOModeEx(..) ) +#endif #if __GLASGOW_HASKELL__ < 503 import IArray ( listArray ) @@ -62,6 +67,9 @@ import Data.Array.IO ( IOArray, hGetArray ) import Char ( ord ) +#if __GLASGOW_HASKELL__ < 601 +openBinaryFile fp mode = openFileEx fp (BinaryMode mode) +#endif -- ----------------------------------------------------------------------------- -- The StringBuffer type @@ -82,7 +90,7 @@ instance Show StringBuffer where hGetStringBuffer :: FilePath -> IO StringBuffer hGetStringBuffer fname = do - h <- openFile fname ReadMode + h <- openBinaryFile fname ReadMode size <- hFileSize h let size_i@(I# sz#) = fromIntegral size #if __GLASGOW_HASKELL__ < 503