You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by cl...@apache.org on 2011/02/20 19:59:33 UTC
svn commit: r1072684 - /thrift/trunk/lib/hs/src/Thrift/Transport/Framed.hs
Author: clavoie
Date: Sun Feb 20 18:59:33 2011
New Revision: 1072684
URL: http://svn.apache.org/viewvc?rev=1072684&view=rev
Log:
Fix small bug in THRIFT-538 commit: use int32s instead of in64s to encode lengths.
Modified:
thrift/trunk/lib/hs/src/Thrift/Transport/Framed.hs
Modified: thrift/trunk/lib/hs/src/Thrift/Transport/Framed.hs
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/hs/src/Thrift/Transport/Framed.hs?rev=1072684&r1=1072683&r2=1072684&view=diff
==============================================================================
--- thrift/trunk/lib/hs/src/Thrift/Transport/Framed.hs (original)
+++ thrift/trunk/lib/hs/src/Thrift/Transport/Framed.hs Sun Feb 20 18:59:33 2011
@@ -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 (Frame
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 => FramedTransp
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