This commit is contained in:
gwenn
2016-05-16 19:52:17 +02:00
parent 9fefa372db
commit 3a52dd65f0
5 changed files with 38 additions and 38 deletions

View File

@@ -159,9 +159,8 @@ impl<'conn> io::Read for Blob<'conn> {
if n <= 0 {
return Ok(0);
}
let rc = unsafe {
ffi::sqlite3_blob_read(self.blob, mem::transmute(buf.as_ptr()), n, self.pos)
};
let rc =
unsafe { ffi::sqlite3_blob_read(self.blob, mem::transmute(buf.as_ptr()), n, self.pos) };
self.conn
.decode_result(rc)
.map(|_| {
@@ -353,7 +352,7 @@ mod test {
{
// ... but it should've written the first 10 bytes
let mut blob = db.blob_open(DatabaseName::Main, "test", "content", rowid, false)
.unwrap();
.unwrap();
let mut bytes = [0u8; 10];
assert_eq!(10, blob.read(&mut bytes[..]).unwrap());
assert_eq!(b"0123456701", &bytes);
@@ -371,7 +370,7 @@ mod test {
{
// ... but it should've written the first 10 bytes
let mut blob = db.blob_open(DatabaseName::Main, "test", "content", rowid, false)
.unwrap();
.unwrap();
let mut bytes = [0u8; 10];
assert_eq!(10, blob.read(&mut bytes[..]).unwrap());
assert_eq!(b"aaaaaaaaaa", &bytes);