Liam Staskawicz avatar Liam Staskawicz committed 9c54375

* slightly more complete

Comments (0)

Files changed (2)

fan/bson/BsonReader.fan

         if(len + 4 != totallen)
           throw MongoOpErr("BSON - bad data size got subtype 0x02 len: $len, totallen: $totallen")
         val = ins.readBufFully(null, len)
+      default:
+        val = ins.readBufFully(null, totallen)
     }
-    
     bson[name] = val
     return remaining - (name.size + totallen + 6)  // 6 == 1 null, 4 len, 1 type
   }

fan/bson/BsonWriter.fan

   {
     b.write(Bson.BINARY)
     writeCStr(b.out, key)
-    b.writeI4(bin.size + 4).write(bbt).writeI4(bin.size)
+    switch(bbt) {
+      case Bson.BIN_LENGTH:
+        b.writeI4(bin.size + 4).write(bbt).writeI4(bin.size)
+      default:
+        b.writeI4(bin.size).write(bbt)
+    }
     // don't disturb the pos
     p := bin.pos
     b.writeBuf(bin)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.