Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.
Reviewed By: mcslee
Test Plan: git diff -b
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/hs/src/TBinaryProtocol.hs b/lib/hs/src/TBinaryProtocol.hs
index dd5212d..e02a0ee 100644
--- a/lib/hs/src/TBinaryProtocol.hs
+++ b/lib/hs/src/TBinaryProtocol.hs
@@ -11,11 +11,11 @@
version_mask = 0xffff0000
version_1 = 0x80010000;
-
+
getByte i b= 255 .&. (shiftR i (8*b))
getBytes i 0 = []
getBytes i n = (toEnum (getByte i (n-1)) :: Char):(getBytes i (n-1))
-
+
floatBits :: Double -> Word64
floatBits (D# d#) = W64# (unsafeCoerce# d#)
@@ -44,7 +44,7 @@
twrite tr s
writeBinary = writeString
writeMessageBegin (TBinaryProtocol tr) (n,t,s) = do writeI32 (TBinaryProtocol tr) (version_1 .|. (fromEnum t))
- writeString (TBinaryProtocol tr) n
+ writeString (TBinaryProtocol tr) n
writeI32 (TBinaryProtocol tr) s
writeMessageEnd (TBinaryProtocol tr) = return ()
writeStructBegin (TBinaryProtocol tr) s = return ()
@@ -81,7 +81,7 @@
if (ver .&. version_mask /= version_1) then
throwDyn (ProtocolExn PE_BAD_VERSION "Missing version identifier")
else do
- s <- readString (TBinaryProtocol tr)
+ s <- readString (TBinaryProtocol tr)
sz <- readI32 (TBinaryProtocol tr)
return (s,toEnum (ver .&. 0xFF) :: Message_type,fromIntegral sz :: Int)
readMessageEnd (TBinaryProtocol tr) = return ()
@@ -106,5 +106,5 @@
readSetEnd = readListEnd
pflush (TBinaryProtocol tr) = tflush tr
-
+
diff --git a/lib/hs/src/TChannelTransport.hs b/lib/hs/src/TChannelTransport.hs
index df1aedc..bf2e8a6 100644
--- a/lib/hs/src/TChannelTransport.hs
+++ b/lib/hs/src/TChannelTransport.hs
@@ -10,7 +10,7 @@
topen a = return a
tclose a = return a
tread a 0 = return []
- tread (TChannelTrans h) i = Prelude.catch
+ tread (TChannelTrans h) i = Prelude.catch
(do c <- hGetChar h
t <- tread (TChannelTrans h) (i-1)
return $ c:t)
diff --git a/lib/hs/src/TServer.hs b/lib/hs/src/TServer.hs
index 83a6ee3..4676fc1 100644
--- a/lib/hs/src/TServer.hs
+++ b/lib/hs/src/TServer.hs
@@ -11,19 +11,19 @@
if v then proc_loop hand proc ps
else return ()
-accept_loop accepter hand sock proc transgen iprotgen oprotgen =
+accept_loop accepter hand sock proc transgen iprotgen oprotgen =
do (h,hn,_) <- accepter sock
- let t = transgen h
+ let t = transgen h
let ip = iprotgen t
let op = oprotgen t
forkIO (handle (\e -> return ()) (proc_loop hand proc (ip,op)))
accept_loop accepter hand sock proc transgen iprotgen oprotgen
-
-run_threaded_server accepter listener hand proc port transgen iprotgen oprotgen =
+
+run_threaded_server accepter listener hand proc port transgen iprotgen oprotgen =
do sock <- listener
accept_loop accepter hand sock proc transgen iprotgen oprotgen
return ()
-
+
-- A basic threaded binary protocol socket server.
run_basic_server hand proc port = run_threaded_server accept (listenOn (PortNumber port)) hand proc port TChannelTrans TBinaryProtocol TBinaryProtocol
diff --git a/lib/hs/src/TSocket.hs b/lib/hs/src/TSocket.hs
index 7e72878..ea23345 100644
--- a/lib/hs/src/TSocket.hs
+++ b/lib/hs/src/TSocket.hs
@@ -11,15 +11,15 @@
Just _ -> True
Nothing -> False
topen a = do h <- connectTo (host a) (PortNumber (port a))
- return $ (a{chan = Just h})
- tclose a = case chan a of
+ return $ (a{chan = Just h})
+ tclose a = case chan a of
Just h -> do hClose h
return $ a{chan=Nothing}
Nothing -> return a
tread a 0 = return []
- tread a n = case chan a of
+ tread a n = case chan a of
Just h -> handle (\e -> throwDyn (TransportExn "TSocket: Could not read." TE_UNKNOWN))
- (do c <- hGetChar h
+ (do c <- hGetChar h
l <- tread a (n-1)
return $ c:l)
Nothing -> return []
diff --git a/lib/hs/src/Thrift.hs b/lib/hs/src/Thrift.hs
index 4087b2b..6b94626 100644
--- a/lib/hs/src/Thrift.hs
+++ b/lib/hs/src/Thrift.hs
@@ -33,25 +33,25 @@
return ret
else do r <- treadAll a (len-rl)
return (ret++r)
-
-
- data T_type = T_STOP
- | T_VOID
+
+
+ data T_type = T_STOP
+ | T_VOID
| T_BOOL
| T_BYTE
- | T_I08
- | T_I16
- | T_I32
- | T_U64
- | T_I64
- | T_DOUBLE
- | T_STRING
- | T_UTF7
- | T_STRUCT
- | T_MAP
- | T_SET
- | T_LIST
- | T_UTF8
+ | T_I08
+ | T_I16
+ | T_I32
+ | T_U64
+ | T_I64
+ | T_DOUBLE
+ | T_STRING
+ | T_UTF7
+ | T_STRUCT
+ | T_MAP
+ | T_SET
+ | T_LIST
+ | T_UTF8
| T_UTF16
| T_UNKNOWN
deriving (Eq)
@@ -75,49 +75,49 @@
T_LIST -> 15
T_UTF8 -> 16
T_UTF16 -> 17
- T_UNKNOWN -> -1
- toEnum t = case t of
- 0 -> T_STOP
- 1 -> T_VOID
+ T_UNKNOWN -> -1
+ toEnum t = case t of
+ 0 -> T_STOP
+ 1 -> T_VOID
2 -> T_BOOL
3 -> T_BYTE
- 6-> T_I16
- 8 -> T_I32
- 9 -> T_U64
- 10 -> T_I64
- 4 -> T_DOUBLE
+ 6-> T_I16
+ 8 -> T_I32
+ 9 -> T_U64
+ 10 -> T_I64
+ 4 -> T_DOUBLE
11 -> T_STRING
12 -> T_STRUCT
- 13 -> T_MAP
- 14 -> T_SET
- 15 -> T_LIST
- 16 -> T_UTF8
+ 13 -> T_MAP
+ 14 -> T_SET
+ 15 -> T_LIST
+ 16 -> T_UTF8
17 -> T_UTF16
_ -> T_UNKNOWN
-
-
+
+
data Message_type = M_CALL
| M_REPLY
| M_EXCEPTION
| M_UNKNOWN
deriving Eq
instance Enum Message_type where
-
+
fromEnum t = case t of
M_CALL -> 1
M_REPLY -> 2
M_EXCEPTION -> 3
M_UNKNOWN -> -1
-
+
toEnum t = case t of
1 -> M_CALL
2 -> M_REPLY
3 -> M_EXCEPTION
_ -> M_UNKNOWN
-
-
-
-
+
+
+
+
class Protocol a where
pflush :: a -> IO ()
writeMessageBegin :: a -> ([Char],Message_type,Int) -> IO ()
@@ -221,9 +221,9 @@
T_UTF8 -> return ()
T_UTF16 -> return ()
T_UNKNOWN -> return ()
-
-
- data PE_type = PE_UNKNOWN
+
+
+ data PE_type = PE_UNKNOWN
| PE_INVALID_DATA
| PE_NEGATIVE_SIZE
| PE_SIZE_LIMIT
@@ -231,7 +231,7 @@
deriving (Eq, Data, Typeable)
data ProtocolExn = ProtocolExn PE_type [Char] deriving (Typeable, Data)
-
+
data AE_type = AE_UNKNOWN
| AE_UNKNOWN_METHOD
| AE_INVALID_MESSAGE_TYPE
@@ -239,7 +239,7 @@
| AE_BAD_SEQUENCE_ID
| AE_MISSING_RESULT
deriving (Eq, Data, Typeable)
-
+
instance Enum AE_type where
toEnum i = case i of
0 -> AE_UNKNOWN
@@ -256,9 +256,9 @@
AE_WRONG_METHOD_NAME -> 3
AE_BAD_SEQUENCE_ID -> 4
AE_MISSING_RESULT -> 5
-
+
data AppExn = AppExn {ae_type :: AE_type, ae_message :: [Char]} deriving (Typeable, Data)
-
+
readAppExnFields pt rec = do (n,ft,id) <- readFieldBegin pt
if ft == T_STOP then return rec
else
@@ -276,13 +276,13 @@
_ -> do skip pt ft
readFieldEnd pt
readAppExnFields pt rec
-
+
readAppExn pt = do readStructBegin pt
rec <- readAppExnFields pt (AppExn {ae_type = undefined, ae_message = undefined})
readStructEnd pt
return rec
-
-
+
+
writeAppExn pt ae = do writeStructBegin pt "TApplicationException"
if ae_message ae /= "" then
do writeFieldBegin pt ("message",T_STRING,1)
@@ -295,4 +295,4 @@
writeFieldStop pt
writeStructEnd pt
-
+