From: Christian Lavoie Date: Sun, 20 Feb 2011 18:59:33 +0000 (+0000) Subject: Fix small bug in THRIFT-538 commit: use int32s instead of in64s to encode lengths. X-Git-Tag: 0.7.0~181 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=cd2ee9ae6ea85335b4c9c3db3a421f27f583f417;p=common%2Fthrift.git Fix small bug in THRIFT-538 commit: use int32s instead of in64s to encode lengths. git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1072684 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/hs/src/Thrift/Transport/Framed.hs b/lib/hs/src/Thrift/Transport/Framed.hs index 70705be7..d4feac03 100644 --- a/lib/hs/src/Thrift/Transport/Framed.hs +++ b/lib/hs/src/Thrift/Transport/Framed.hs @@ -27,6 +27,7 @@ module Thrift.Transport.Framed import Thrift.Transport import Control.Monad (liftM) +import Data.Int (Int32) import Data.Monoid (mappend, mempty) import Control.Concurrent.MVar import qualified Data.Binary as B @@ -69,7 +70,7 @@ instance Transport t => Transport (FramedTransport t) where tFlush trans = do bs <- flushBuf (writeBuffer trans) - let szBs = B.encode $ LBS.length bs + let szBs = B.encode $ (fromIntegral $ LBS.length bs :: Int32) tWrite (wrappedTrans trans) szBs tWrite (wrappedTrans trans) bs tFlush (wrappedTrans trans) @@ -80,7 +81,7 @@ readFrame :: Transport t => FramedTransport t -> IO Int readFrame trans = do -- Read and decode the frame size. szBs <- tRead (wrappedTrans trans) 4 - let sz = B.decode szBs + let sz = fromIntegral (B.decode szBs :: Int32) -- Read the frame and stuff it into the read buffer. bs <- tRead (wrappedTrans trans) sz