asn1-types 0.3.2 → 0.3.3
raw patch · 2 files changed
+20/−15 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.ASN1.BitArray: instance GHC.Exception.Exception Data.ASN1.BitArray.BitArrayOutOfBound
+ Data.ASN1.BitArray: instance GHC.Exception.Type.Exception Data.ASN1.BitArray.BitArrayOutOfBound
- Data.ASN1.Types: ASN1Time :: ASN1TimeType -> DateTime -> (Maybe TimezoneOffset) -> ASN1
+ Data.ASN1.Types: ASN1Time :: ASN1TimeType -> DateTime -> Maybe TimezoneOffset -> ASN1
Files
- Data/ASN1/Types/String.hs +17/−12
- asn1-types.cabal +3/−3
Data/ASN1/Types/String.hs view
@@ -148,18 +148,23 @@ b1 = fromIntegral (v .&. 0xff) decodeUTF32 :: ByteString -> String-decodeUTF32 b- | (B.length b `mod` 4) /= 0 = error "not a valid UTF32 string"- | otherwise = fromUTF32 $ B.unpack b- where fromUTF32 (a:b:c:d:l) =- let v :: Word32- v = (fromIntegral a `shiftL` 24) .|.- (fromIntegral b `shiftL` 16) .|.- (fromIntegral c `shiftL` 8) .|.- (fromIntegral d)- in toEnum (fromIntegral v) : fromUTF32 l- fromUTF32 [] = []- fromUTF32 _ = error "decodeUTF32: internal error"+decodeUTF32 bs+ | (B.length bs `mod` 4) /= 0 = error "not a valid UTF32 string"+ | otherwise = fromUTF32 0+ where w32ToChar :: Word32 -> Char+ w32ToChar = toEnum . fromIntegral+ fromUTF32 ofs+ | ofs == B.length bs = []+ | otherwise =+ let a = B.index bs ofs+ b = B.index bs (ofs+1)+ c = B.index bs (ofs+2)+ d = B.index bs (ofs+3)+ v = (fromIntegral a `shiftL` 24) .|.+ (fromIntegral b `shiftL` 16) .|.+ (fromIntegral c `shiftL` 8) .|.+ (fromIntegral d)+ in w32ToChar v : fromUTF32 (ofs+4) encodeUTF32 :: String -> ByteString encodeUTF32 s = B.pack $ concatMap (toUTF32 . fromEnum) s where toUTF32 v = [b0,b1,b2,b3]
asn1-types.cabal view
@@ -1,5 +1,5 @@ Name: asn1-types-Version: 0.3.2+Version: 0.3.3 Description: ASN.1 standard types License: BSD3 License-file: LICENSE@@ -11,7 +11,7 @@ Category: Data stability: experimental Cabal-Version: >=1.6-Homepage: http://github.com/vincenthz/hs-asn1-types+Homepage: http://github.com/vincenthz/hs-asn1 Library Build-Depends: base >= 3 && < 5@@ -29,4 +29,4 @@ source-repository head type: git- location: git://github.com/vincenthz/hs-asn1-types+ location: git://github.com/vincenthz/hs-asn1