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 70705be..d4feac0 100644
--- a/lib/hs/src/Thrift/Transport/Framed.hs
+++ b/lib/hs/src/Thrift/Transport/Framed.hs
@@ -27,6 +27,7 @@
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 @@
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 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