subtype is unsigned, another test

This commit is contained in:
Mike Dirolf 2009-02-06 16:07:19 -05:00
parent 2d7d198b7c
commit 40afeaba27
2 changed files with 2 additions and 1 deletions

View File

@ -516,7 +516,7 @@ static PyObject* _elements_to_dict(PyObject* elements) {
{
int length;
memcpy(&length, string + position, 4);
int subtype = (int)string[position + 4];
int subtype = (unsigned char)string[position + 4];
PyObject* data;
if (subtype == 2) {
data = PyString_FromStringAndSize(string + position + 9, length - 4);

View File

@ -114,6 +114,7 @@ class TestBSON(unittest.TestCase):
helper({"an object": {"test": u"something"}})
helper({"a binary": Binary("test", 100)})
helper({"a binary": Binary("test", 128)})
helper({"a binary": Binary("test", 254)})
helper({"another binary": Binary("test")})
helper(SON([(u'test dst', datetime.datetime(1993, 4, 4, 2))]))