From c6c29f8f5f359b08b9ec69f74cda2cf2fd07a619 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 23 Apr 2003 10:27:53 +0000 Subject: [PATCH] [project @ 2003-04-23 10:27:53 by simonmar] hGetArray/hPutArray with a count argument of zero now just return doing nothing. This brings them into line with hGetBuf/hPutBuf and fixes a bug in Data.PackedString.hPutPS which fails on an empty string. --- Data/Array/IO.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Data/Array/IO.hs b/Data/Array/IO.hs index 34e9584..bc82e2d 100644 --- a/Data/Array/IO.hs +++ b/Data/Array/IO.hs @@ -141,7 +141,9 @@ hGetArray -- if the end of file was reached. hGetArray handle (IOUArray (STUArray l u ptr)) count - | count <= 0 || count > rangeSize (l,u) + | count == 0 + = return 0 + | count < 0 || count > rangeSize (l,u) = illegalBufferSize handle "hGetArray" count | otherwise = do wantReadableHandle "hGetArray" handle $ @@ -191,7 +193,9 @@ hPutArray -> IO () hPutArray handle (IOUArray (STUArray l u raw)) count - | count <= 0 || count > rangeSize (l,u) + | count == 0 + = return () + | count < 0 || count > rangeSize (l,u) = illegalBufferSize handle "hPutArray" count | otherwise = do wantWritableHandle "hPutArray" handle $ -- 1.7.10.4