[commit: packages/binary] master: Bug fix isolate; use correct offset in error message (d99097a)
git at git.haskell.org
git at git.haskell.org
Sun Dec 14 17:54:51 UTC 2014
Repository : ssh://git@git.haskell.org/binary
On branch : master
Link : http://git.haskell.org/packages/binary.git/commitdiff/d99097a008c1bc41331da48756485bbc9edb3fe9
>---------------------------------------------------------------
commit d99097a008c1bc41331da48756485bbc9edb3fe9
Author: Lennart Kolmodin <kolmodin at gmail.com>
Date: Sun May 11 13:22:12 2014 +0400
Bug fix isolate; use correct offset in error message
When a isolate decoder fails, it includes information about the
offsets of how far in the decoding it got in the error message.
With this change the offset is now correct.
>---------------------------------------------------------------
d99097a008c1bc41331da48756485bbc9edb3fe9
src/Data/Binary/Get/Internal.hs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs
index 7d9a518..84ae199 100644
--- a/src/Data/Binary/Get/Internal.hs
+++ b/src/Data/Binary/Get/Internal.hs
@@ -197,8 +197,8 @@ isolate n0 act
| n == 0 && B.null left = return x
| otherwise = do
pushFront left
- let consumed = n0 - n
- fail $ "isolate: decoder consumed " ++ show consumed ++
+ let consumed = n0 - n - B.length left
+ fail $ "isolate: the decoder consumed " ++ show consumed ++ " bytes" ++
" which is less than the expected " ++ show n0 ++ " bytes"
go 0 (Partial resume) = go 0 (resume Nothing)
go n (Partial resume) = do
More information about the ghc-commits
mailing list