Just as Ian called it...
Thu Jun 12 13:57:19 BST 2008 Eric Kow <[EMAIL PROTECTED]>
* Resolve issue913: Use Data.Bytestring for IO, not Data.Bytestring.Char8
This solution comes from Ian Lynagh, who points out that the
difference between the two is:
Data.Bytestring.Char8
---------------------
writeFile :: FilePath -> ByteString -> IO ()
writeFile f txt = bracket (openFile f WriteMode) hClose
(\h -> hPut h txt)
Data.Bytestring
---------------
writeFile :: FilePath -> ByteString -> IO ()
writeFile f txt = bracket (openBinaryFile f WriteMode) hClose
(\h -> hPut h txt)
We want this change because, as the System.IO docs say:
On Windows, reading a file in text mode (which is the default) will
translate CRLF to LF, and writing will translate LF to CRLF. This is
usually what you want with text files. With binary files this is
undesirable; also, as usual under Microsoft operating systems, text
mode treats control-Z as EOF. Binary mode turns off all special
treatment of end-of-line and end-of-file characters.
New patches:
[Resolve issue913: Use Data.Bytestring for IO, not Data.Bytestring.Char8
Eric Kow <[EMAIL PROTECTED]>**20080612125719
This solution comes from Ian Lynagh, who points out that the
difference between the two is:
Data.Bytestring.Char8
---------------------
writeFile :: FilePath -> ByteString -> IO ()
writeFile f txt = bracket (openFile f WriteMode) hClose
(\h -> hPut h txt)
Data.Bytestring
---------------
writeFile :: FilePath -> ByteString -> IO ()
writeFile f txt = bracket (openBinaryFile f WriteMode) hClose
(\h -> hPut h txt)
We want this change because, as the System.IO docs say:
On Windows, reading a file in text mode (which is the default) will
translate CRLF to LF, and writing will translate LF to CRLF. This is
usually what you want with text files. With binary files this is
undesirable; also, as usual under Microsoft operating systems, text
mode treats control-Z as EOF. Binary mode turns off all special
treatment of end-of-line and end-of-file characters.
] replace ./src/FastPackedString.hs [A-Za-z_0-9] B BC
hunk ./src/FastPackedString.hs 128
import Foreign.ForeignPtr ( addForeignPtrFinalizer )
import Foreign.Ptr ( FunPtr )
#endif
+import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString.Internal as BI
import qualified Data.ByteString.Unsafe as BU
hunk ./src/FastPackedString.hs 464
-- be in the ISO-8859-1 encoding. In other words, only the least signficant
-- byte is taken from each character in the 'PackedString'.
hPutPS :: Handle -> PackedString -> IO ()
-hPutPS = BC.hPut
+hPutPS = B.hPut
-- -----------------------------------------------------------------------------
-- hGetPS
hunk ./src/FastPackedString.hs 476
-- NOTE: as with 'hPutPS', the string representation in the file is
-- assumed to be ISO-8859-1.
hGetPS :: Handle -> Int -> IO PackedString
-hGetPS = BC.hGet
+hGetPS = B.hGet
-- -----------------------------------------------------------------------------
-- hGetContentsPS
hunk ./src/FastPackedString.hs 487
-- NOTE: as with 'hGetPS', the string representation in the file is
-- assumed to be ISO-8859-1.
hGetContentsPS :: Handle -> IO PackedString
-hGetContentsPS = BC.hGetContents -- ratify hGetContents: just a Data.ByteString import
+hGetContentsPS = B.hGetContents -- ratify hGetContents: just a Data.ByteString import
-- -----------------------------------------------------------------------------
-- readFilePS
hunk ./src/FastPackedString.hs 501
-- assumed to be ISO-8859-1.
readFilePS :: FilePath -> IO PackedString
-readFilePS = BC.readFile -- ratify readFile: just a Data.ByteString import
+readFilePS = B.readFile -- ratify readFile: just a Data.ByteString import
-- -----------------------------------------------------------------------------
-- writeFilePS
hunk ./src/FastPackedString.hs 509
-- | Write a 'PackedString' to a file.
writeFilePS :: FilePath -> PackedString -> IO ()
-writeFilePS = BC.writeFile
+writeFilePS = B.writeFile
-- -----------------------------------------------------------------------------
-- gzReadFilePS
Context:
[fix OPTLLIBS filtering
Karel Gardas <[EMAIL PROTECTED]>**20080607210701]
[Darcs.Repository.Prefs: +boring filters for MS Visual Studio (see -users discussion)
[EMAIL PROTECTED]
[Demonstrate 'hidden conflicts' bug (old format).
Eric Kow <[EMAIL PROTECTED]>**20080606151534]
[fix regression introduced by using Data.List.isInfixOf.
David Roundy <[EMAIL PROTECTED]>**20080606102519]
[fix bug in test when there's a space in test directory.
David Roundy <[EMAIL PROTECTED]>**20080605151104]
[translate pull.pl into shell.
David Roundy <[EMAIL PROTECTED]>**20080605124106]
[make test suite smarter about cleaning up test directories.
David Roundy <[EMAIL PROTECTED]>**20080605124025]
[darcs put now support --{no-,}set-default.
Nicolas Pouillard <[EMAIL PROTECTED]>**20080604214551]
[fix regression in index.html.in.
David Roundy <[EMAIL PROTECTED]>**20080605114356]
[resolve issue783: propose 'edit' as a default Windows editor
Eric Kow <[EMAIL PROTECTED]>**20080605165812
I think every Windows box has this. Advantages over notepad are that
- it's a console app
- it appears to support Unix newlines
]
[Makefile: prefix -optl only on $(LIBS) that start with '-'
Eric Kow <[EMAIL PROTECTED]>**20080605105539
Otherwise, on Windows, if you try to build --with-static-libs, the
linker will be passed /usr/local/lib/libcurl.a as an argument, which
makes gcc complain.
]
[resolve issue770: catch 'does not exist' when running external programs
Eric Kow <[EMAIL PROTECTED]>**20080604143100
Convert these errors into ExitCode 127 (for Windows)
]
[TAG 2.0.1rc1
David Roundy <[EMAIL PROTECTED]>**20080603124331]
Patch bundle hash:
d77e3437a297b87a98ddaa6ce91882ff4a181877
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users