Fix warnings.

This commit is contained in:
Gav Wood 2015-11-29 16:00:23 +01:00
parent b334a8f824
commit cf62f67b5f
4 changed files with 5 additions and 8 deletions

View File

@ -1,5 +1,4 @@
use hash::*; use hash::*;
use bytes::Bytes;
pub trait HashDB { pub trait HashDB {
/// Look up a given hash into the bytes that hash to it, returning None if the /// Look up a given hash into the bytes that hash to it, returning None if the

View File

@ -104,9 +104,8 @@ impl MemoryDB {
pub fn denote(&self, key: &H256, value: Bytes) -> &(Bytes, i32) { pub fn denote(&self, key: &H256, value: Bytes) -> &(Bytes, i32) {
if self.data.get(&key) == None { if self.data.get(&key) == None {
unsafe { unsafe {
let p = &self.data as *const HashMap<H256, (Bytes, i32)>; let p = &self.data as *const HashMap<H256, (Bytes, i32)> as *mut HashMap<H256, (Bytes, i32)>;
let mp = p as *mut HashMap<H256, (Bytes, i32)>; (*p).insert(key.clone(), (value, 0));
(*mp).insert(key.clone(), (value, 0));
} }
} }
self.data.get(key).unwrap() self.data.get(key).unwrap()
@ -161,7 +160,7 @@ fn memorydb_denote() {
let hash = m.insert(hello_bytes); let hash = m.insert(hello_bytes);
assert_eq!(m.lookup(&hash).unwrap(), b"Hello world!"); assert_eq!(m.lookup(&hash).unwrap(), b"Hello world!");
for i in 0..1000 { for _ in 0..1000 {
let r = H256::random(); let r = H256::random();
let k = r.sha3(); let k = r.sha3();
let &(ref v, ref rc) = m.denote(&k, r.bytes().to_vec()); let &(ref v, ref rc) = m.denote(&k, r.bytes().to_vec());

View File

@ -8,7 +8,6 @@ use hashdb::*;
use memorydb::*; use memorydb::*;
use std::ops::*; use std::ops::*;
use std::sync::*; use std::sync::*;
use std::cell::*;
use std::env; use std::env;
use rocksdb::{DB, Writable}; use rocksdb::{DB, Writable};

View File

@ -1,8 +1,8 @@
use memorydb::*; use memorydb::*;
use hashdb::*; use hashdb::*;
use hash::*; use hash::*;
use rlp::*; //use rlp::*;
use bytes::*; //use bytes::*;
pub const NULL_RLP: [u8; 1] = [0x80; 1]; pub const NULL_RLP: [u8; 1] = [0x80; 1];
pub const SHA3_NULL_RLP: H256 = H256( [0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6, 0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e, 0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0, 0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21] ); pub const SHA3_NULL_RLP: H256 = H256( [0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6, 0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e, 0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0, 0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21] );