Skip to content

Commit 8f2515c

Browse files
author
Hugo Bonacci
committed
A few cleanup changes
1 parent def48df commit 8f2515c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Bson/BsonTranslator.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class BsonTranslator {
2222
/// Handles reading a type from a stream
2323
/// </summary>
2424
public static Dictionary<string, object> FromStream(Stream stream) {
25-
BinaryReader reader = new BinaryReader(stream);
2625

2726
//start reading out the values
2827
Dictionary<string, object> values = new Dictionary<string, object>();
@@ -245,7 +244,10 @@ public static byte[] ReadBinary(Stream stream) {
245244

246245
//get the length and flag
247246
int length = reader.ReadInt32();
248-
MongoBinaryTypes type = (MongoBinaryTypes)reader.ReadByte();
247+
248+
//read the type identifier (we don't need to use it)
249+
//MongoBinaryTypes type = (MongoBinaryTypes)reader.ReadByte();
250+
reader.ReadByte();
249251

250252
//then read the binary object (take in account the starting info)
251253
return reader.ReadBytes(length);
@@ -327,9 +329,11 @@ public static string ReadString(Stream stream) {
327329
public static string ReadCString(Stream stream) {
328330
BinaryReader reader = new BinaryReader(stream);
329331

330-
//get the length to expect - remove 4 bytes
331-
//from the count to read to account length value
332-
int length = reader.ReadInt32();
332+
//get the 'length' value - Since we are currently
333+
//reading CStrings like normal strings we don't
334+
//actually need to use this value
335+
//int length = reader.ReadInt32();
336+
reader.ReadInt32();
333337

334338
//just use the typical string reading for now.
335339
//not sure if this needs to be something special

0 commit comments

Comments
 (0)