From 0e980ed7c7d0a2f8a289255a912b8cfd7767c2f8 Mon Sep 17 00:00:00 2001 From: Sascha Matzke Date: Thu, 17 Jun 2010 06:45:16 +0200 Subject: [PATCH] added new BSON default binary subtype; fixed 0x02 binary subtype handling --- extra/bson/constants/constants.factor | 11 ++++++----- extra/bson/reader/reader.factor | 3 ++- extra/bson/writer/writer.factor | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/extra/bson/constants/constants.factor b/extra/bson/constants/constants.factor index e4bf14432a..b2b260615f 100644 --- a/extra/bson/constants/constants.factor +++ b/extra/bson/constants/constants.factor @@ -79,9 +79,10 @@ CONSTANT: T_Integer64 HEX: 12 CONSTANT: T_MinKey HEX: FF CONSTANT: T_MaxKey HEX: 7F -CONSTANT: T_Binary_Function HEX: 1 -CONSTANT: T_Binary_Bytes HEX: 2 -CONSTANT: T_Binary_UUID HEX: 3 -CONSTANT: T_Binary_MD5 HEX: 5 -CONSTANT: T_Binary_Custom HEX: 80 +CONSTANT: T_Binary_Default HEX: 0 +CONSTANT: T_Binary_Function HEX: 1 +CONSTANT: T_Binary_Bytes_Deprecated HEX: 2 +CONSTANT: T_Binary_UUID HEX: 3 +CONSTANT: T_Binary_MD5 HEX: 5 +CONSTANT: T_Binary_Custom HEX: 80 diff --git a/extra/bson/reader/reader.factor b/extra/bson/reader/reader.factor index 852f46f951..a007431e4a 100644 --- a/extra/bson/reader/reader.factor +++ b/extra/bson/reader/reader.factor @@ -54,7 +54,8 @@ DEFER: read-elements : bson-binary-read ( -- binary ) read-int32 read-byte { - { T_Binary_Bytes [ read ] } + { T_Binary_Default [ read ] } + { T_Binary_Bytes_Deprecated [ drop read-int32 read ] } { T_Binary_Custom [ read bytes>object ] } { T_Binary_Function [ read ] } [ drop read >string ] diff --git a/extra/bson/writer/writer.factor b/extra/bson/writer/writer.factor index 0c494c9848..c711451634 100644 --- a/extra/bson/writer/writer.factor +++ b/extra/bson/writer/writer.factor @@ -56,7 +56,7 @@ DEFER: write-pair TYPED: write-byte-array ( binary: byte-array -- ) [ length write-int32 ] - [ T_Binary_Bytes write1 write ] bi ; inline + [ T_Binary_Default write1 write ] bi ; inline TYPED: write-mdbregexp ( regexp: mdbregexp -- ) [ regexp>> write-cstring ]