Skip to content

Commit

Permalink
8e035fd missed the Put side
Browse files Browse the repository at this point in the history
  • Loading branch information
srp committed Mar 14, 2010
1 parent 532e758 commit 8df947c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Database/MongoDB/BSON.hs
Expand Up @@ -294,10 +294,11 @@ putVal (BsonDoc o) = putObj o
putVal (BsonArray es) = putOutterObj bs
where bs = runPut $ forM_ (List.zip [(0::Int) .. ] es) $ \(i, e) ->
putType e >> putS (L8.fromString $ show i) >> putVal e
putVal (BsonBinary t bs)= do putI32 $ fromIntegral $ 4 + L.length bs
putI8 $ fromBinarySubType t
putI32 $ fromIntegral $ L.length bs
putLazyByteString bs
putVal (BsonBinary t bs) = do
putI32 $ fromIntegral $ (if t == BSTByteArray then 4 else 0) + L.length bs
putI8 $ fromBinarySubType t
when (t == BSTByteArray) $ putI32 $ fromIntegral $ L.length bs
putLazyByteString bs
putVal BsonUndefined = putNothing
putVal (BsonObjectId o) = putWord64be (fromIntegral $ o `shiftR` 32) >>
putWord32be (fromIntegral $ o .&. 0xffffffff)
Expand Down

0 comments on commit 8df947c

Please sign in to comment.