protocol-buffers 2.4.13 → 2.4.14
raw patch · 4 files changed
+115/−110 lines, 4 filessetup-changed
Files
- Changes +4/−0
- Setup.hs +1/−1
- Text/ProtocolBuffers/Get.hs +90/−90
- protocol-buffers.cabal +20/−19
Changes view
@@ -1,5 +1,9 @@ Newest at the top. +2.4.14++- Issue #89 defaultUserHooks in Setup.hs is deprecated+ 2.4.13 - Fix build for GHC-8.8
Setup.hs view
@@ -1,2 +1,2 @@ import Distribution.Simple-main = defaultMainWithHooks defaultUserHooks+main = defaultMainWithHooks simpleUserHooks
Text/ProtocolBuffers/Get.hs view
@@ -131,77 +131,77 @@ let (TU'OK x i) = unsafePerformIO $ withForeignPtr fp $ \ptr0 -> do if ptr0 == nullPtr || len < 1 then error "Get.decode7unrolled: ByteString invariant failed" else do- let ok :: s -> Int -> IO (TU s)- ok x0 i0 = return (TU'OK x0 i0)- more,err :: IO (TU s)- more = return (TU'OK 0 0) -- decode7- err = return (TU'OK 0 (-1)) -- throwError- {-# INLINE ok #-}- {-# INLINE more #-}- {-# INLINE err #-}+ let ok :: s -> Int -> IO (TU s)+ ok x0 i0 = return (TU'OK x0 i0)+ more,err :: IO (TU s)+ more = return (TU'OK 0 0) -- decode7+ err = return (TU'OK 0 (-1)) -- throwError+ {-# INLINE ok #-}+ {-# INLINE more #-}+ {-# INLINE err #-} --- -- Next line is segfault fix for null bytestrings from Nathan Howell <nhowell@alphaheavy.com>--- if ptr0 == nullPtr then more else do+ -- -- Next line is segfault fix for null bytestrings from Nathan Howell <nhowell@alphaheavy.com>+ -- if ptr0 == nullPtr then more else do - let start = ptr0 `plusPtr` off :: Ptr Word8- b'1 <- peek start- if b'1 < 128 then ok (fromIntegral b'1) 1 else do- let !val'1 = fromIntegral (b'1 .&. 0x7F)- !end = start `plusPtr` len- !ptr2 = start `plusPtr` 1 :: Ptr Word8- if ptr2 >= end then more else do+ let start = ptr0 `plusPtr` off :: Ptr Word8+ b'1 <- peek start+ if b'1 < 128 then ok (fromIntegral b'1) 1 else do+ let !val'1 = fromIntegral (b'1 .&. 0x7F)+ !end = start `plusPtr` len+ !ptr2 = start `plusPtr` 1 :: Ptr Word8+ if ptr2 >= end then more else do - b'2 <- peek ptr2- if b'2 < 128 then ok (val'1 .|. (fromIntegral b'2 `shiftL` 7)) 2 else do- let !val'2 = (val'1 .|. (fromIntegral (b'2 .&. 0x7F) `shiftL` 7))- !ptr3 = ptr2 `plusPtr` 1- if ptr3 >= end then more else do+ b'2 <- peek ptr2+ if b'2 < 128 then ok (val'1 .|. (fromIntegral b'2 `shiftL` 7)) 2 else do+ let !val'2 = (val'1 .|. (fromIntegral (b'2 .&. 0x7F) `shiftL` 7))+ !ptr3 = ptr2 `plusPtr` 1+ if ptr3 >= end then more else do - b'3::Word8 <- peek ptr3- if b'3 < 128 then ok (val'2 .|. (fromIntegral b'3 `shiftL` 14)) 3 else do- let !val'3 = (val'2 .|. (fromIntegral (b'3 .&. 0x7F) `shiftL` 14))- !ptr4 = ptr3 `plusPtr` 1- if ptr4 >= end then more else do+ b'3::Word8 <- peek ptr3+ if b'3 < 128 then ok (val'2 .|. (fromIntegral b'3 `shiftL` 14)) 3 else do+ let !val'3 = (val'2 .|. (fromIntegral (b'3 .&. 0x7F) `shiftL` 14))+ !ptr4 = ptr3 `plusPtr` 1+ if ptr4 >= end then more else do - b'4::Word8 <- peek ptr4- if b'4 < 128 then ok (val'3 .|. (fromIntegral b'4 `shiftL` 21)) 4 else do- let !val'4 = (val'3 .|. (fromIntegral (b'4 .&. 0x7F) `shiftL` 21))- !ptr5 = ptr4 `plusPtr` 1- if ptr5 >= end then more else do+ b'4::Word8 <- peek ptr4+ if b'4 < 128 then ok (val'3 .|. (fromIntegral b'4 `shiftL` 21)) 4 else do+ let !val'4 = (val'3 .|. (fromIntegral (b'4 .&. 0x7F) `shiftL` 21))+ !ptr5 = ptr4 `plusPtr` 1+ if ptr5 >= end then more else do - b'5::Word8 <- peek ptr5- if b'5 < 128 then ok (val'4 .|. (fromIntegral b'5 `shiftL` 28)) 5 else do- let !val'5 = (val'4 .|. (fromIntegral (b'5 .&. 0x7F) `shiftL` 28))- !ptr6 = ptr5 `plusPtr` 1- if ptr6 >= end then more else do+ b'5::Word8 <- peek ptr5+ if b'5 < 128 then ok (val'4 .|. (fromIntegral b'5 `shiftL` 28)) 5 else do+ let !val'5 = (val'4 .|. (fromIntegral (b'5 .&. 0x7F) `shiftL` 28))+ !ptr6 = ptr5 `plusPtr` 1+ if ptr6 >= end then more else do - b'6::Word8 <- peek ptr6- if b'6 < 128 then ok (val'5 .|. (fromIntegral b'6 `shiftL` 35)) 6 else do- let !val'6 = (val'5 .|. (fromIntegral (b'6 .&. 0x7F) `shiftL` 35))- !ptr7 = ptr6 `plusPtr` 1- if ptr7 >= end then more else do+ b'6::Word8 <- peek ptr6+ if b'6 < 128 then ok (val'5 .|. (fromIntegral b'6 `shiftL` 35)) 6 else do+ let !val'6 = (val'5 .|. (fromIntegral (b'6 .&. 0x7F) `shiftL` 35))+ !ptr7 = ptr6 `plusPtr` 1+ if ptr7 >= end then more else do - b'7::Word8 <- peek ptr7- if b'7 < 128 then ok (val'6 .|. (fromIntegral b'7 `shiftL` 42)) 7 else do- let !val'7 = (val'6 .|. (fromIntegral (b'7 .&. 0x7F) `shiftL` 42))- !ptr8 = ptr7 `plusPtr` 1- if ptr8 >= end then more else do+ b'7::Word8 <- peek ptr7+ if b'7 < 128 then ok (val'6 .|. (fromIntegral b'7 `shiftL` 42)) 7 else do+ let !val'7 = (val'6 .|. (fromIntegral (b'7 .&. 0x7F) `shiftL` 42))+ !ptr8 = ptr7 `plusPtr` 1+ if ptr8 >= end then more else do - b'8::Word8 <- peek ptr8- if b'8 < 128 then ok (val'7 .|. (fromIntegral b'8 `shiftL` 49)) 8 else do- let !val'8 = (val'7 .|. (fromIntegral (b'8 .&. 0x7F) `shiftL` 49))- !ptr9 = ptr8 `plusPtr` 1- if ptr9 >= end then more else do+ b'8::Word8 <- peek ptr8+ if b'8 < 128 then ok (val'7 .|. (fromIntegral b'8 `shiftL` 49)) 8 else do+ let !val'8 = (val'7 .|. (fromIntegral (b'8 .&. 0x7F) `shiftL` 49))+ !ptr9 = ptr8 `plusPtr` 1+ if ptr9 >= end then more else do - b'9::Word8 <- peek ptr9- if b'9 < 128 then ok (val'8 .|. (fromIntegral b'9 `shiftL` 56)) 9 else do- let !val'9 = (val'8 .|. (fromIntegral (b'9 .&. 0x7F) `shiftL` 56))- !ptrA = ptr9 `plusPtr` 1- if ptrA >= end then more else do+ b'9::Word8 <- peek ptr9+ if b'9 < 128 then ok (val'8 .|. (fromIntegral b'9 `shiftL` 56)) 9 else do+ let !val'9 = (val'8 .|. (fromIntegral (b'9 .&. 0x7F) `shiftL` 56))+ !ptrA = ptr9 `plusPtr` 1+ if ptrA >= end then more else do - b'A::Word8 <- peek ptrA- if b'A < 128 then ok (val'9 .|. (fromIntegral b'A `shiftL` 63)) 10 else do- err+ b'A::Word8 <- peek ptrA+ if b'A < 128 then ok (val'9 .|. (fromIntegral b'A `shiftL` 63)) 10 else do+ err in if i > 0 then let ss' = (S.unsafeDrop i ss)@@ -233,44 +233,44 @@ | ptr < end = do w <- peek ptr trace ("w: " ++ show w) $ do- if (128>) w- then return $ T3 (succ (ptr `minusPtr` start) ) -- length of capture- (s .|. ((fromIntegral w) `shiftL` shift)) -- put the last bits into high position- (-1) -- negative shift indicates satisfied- else inner (ptr `plusPtr` 1) -- loop on next byte- (s .|. ((fromIntegral (w .&. 0x7F)) `shiftL` shift)) -- put the new bits into high position- (shift+7) -- increase high position for next loop+ if (128>) w+ then return $ T3 (succ (ptr `minusPtr` start) ) -- length of capture+ (s .|. ((fromIntegral w) `shiftL` shift)) -- put the last bits into high position+ (-1) -- negative shift indicates satisfied+ else inner (ptr `plusPtr` 1) -- loop on next byte+ (s .|. ((fromIntegral (w .&. 0x7F)) `shiftL` shift)) -- put the new bits into high position+ (shift+7) -- increase high position for next loop | otherwise = return $ T3 (ptr `minusPtr` start) -- length so far (ptr past end-of-string so no succ) s -- value so far shift -- next shift to use inner start s1 shift1 (S ss bs n) <- getFull trace ("getFull says: "++ show ((S.length ss,ss),(L.length bs),n)) $ do- if S.null ss- then do- continue <- suspend- if continue- then go s1 shift1- else fail "Get.decode7: Zero length input" -- XXX can be triggered!- else do- let (T3 i sOut shiftOut) = unsafePerformIO $ scanner ss- t = S.unsafeDrop i ss -- Warning: 't' may be mempty- n' = n + fromIntegral i- trace ("scanner says "++show ((i,toInteger sOut,shiftOut),(S.length t,n'))) $ do- if 0 <= shiftOut- then do- putFull_unsafe (make_state bs n')- if L.null bs+ if S.null ss+ then do+ continue <- suspend+ if continue+ then go s1 shift1+ else fail "Get.decode7: Zero length input" -- XXX can be triggered!+ else do+ let (T3 i sOut shiftOut) = unsafePerformIO $ scanner ss+ t = S.unsafeDrop i ss -- Warning: 't' may be mempty+ n' = n + fromIntegral i+ trace ("scanner says "++show ((i,toInteger sOut,shiftOut),(S.length t,n'))) $ do+ if 0 <= shiftOut then do- continue <- suspend- if continue- then go sOut shiftOut- else return sOut+ putFull_unsafe (make_state bs n')+ if L.null bs+ then do+ continue <- suspend+ if continue+ then go sOut shiftOut+ else return sOut+ else do+ go sOut shiftOut else do- go sOut shiftOut- else do- putFull_safe (S t bs n') -- bs from getFull is still valid- return sOut+ putFull_safe (S t bs n') -- bs from getFull is still valid+ return sOut data T2 = T2 !Int64 !Bool
protocol-buffers.cabal view
@@ -1,6 +1,6 @@ name: protocol-buffers-version: 2.4.13-cabal-version: >= 1.6+version: 2.4.14+cabal-version: >= 1.10 build-type: Simple license: BSD3 license-file: LICENSE@@ -15,12 +15,13 @@ extra-source-files: TODO README.md Changes-Tested-With: GHC == 8.0.2, GHC == 8.2.1, GHC == 8.4.2, GHC == 8.6.2+Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.2, GHC == 8.6.2, GHC == 8.8.4 source-repository head type: git location: git://github.com/k-bx/protocol-buffers.git Library+ default-language: Haskell2010 -- Added -fspec-constr-count=10 to quiet ghc-7.0.2. ghc-options: -Wall -O2 -fspec-constr-count=10 -- ghc-prof-options: -auto-all -prof@@ -54,19 +55,19 @@ -- Most of these are needed for protocol-buffers (Get and WireMessage.hs) -- Nothing especially hazardous in this list- extensions: BangPatterns,- CPP,- DeriveDataTypeable,- EmptyDataDecls,- FlexibleInstances,- FunctionalDependencies,- GADTs,- GeneralizedNewtypeDeriving,- MagicHash,- MultiParamTypeClasses,- PatternGuards,- RankNTypes,- RecordWildCards- ScopedTypeVariables,- StandaloneDeriving,- TypeSynonymInstances+ default-extensions: BangPatterns,+ CPP,+ DeriveDataTypeable,+ EmptyDataDecls,+ FlexibleInstances,+ FunctionalDependencies,+ GADTs,+ GeneralizedNewtypeDeriving,+ MagicHash,+ MultiParamTypeClasses,+ PatternGuards,+ RankNTypes,+ RecordWildCards+ ScopedTypeVariables,+ StandaloneDeriving,+ TypeSynonymInstances