diff --git a/src/bsonc.rs b/src/bsonc.rs index e2034ea..80e187a 100644 --- a/src/bsonc.rs +++ b/src/bsonc.rs @@ -2,7 +2,7 @@ use std::ffi::CStr; use std::ptr; use std::fmt; use std::slice; -use libc::{c_uint, c_void}; +use libc::c_void; use mongoc::bindings; use bson; @@ -27,8 +27,9 @@ impl Bsonc { let mut buffer = Vec::new(); try!(bson::encode_document(&mut buffer, document)); - let inner = - unsafe { bindings::bson_new_from_data(buffer[..].as_ptr(), buffer.len() as c_uint) }; + let inner = unsafe { + bindings::bson_new_from_data(buffer[..].as_ptr(), (buffer.len() as u32).into()) + }; // Inner will be null if there was an error converting the data. // We're assuming the bson crate works and therefore assert here.