@@ -32,13 +32,13 @@ class CLevelDBBatch
32
32
33
33
private:
34
34
leveldb::WriteBatch batch;
35
- const std::vector<unsigned char > obfuscate_key;
35
+ const std::vector<unsigned char > * obfuscate_key;
36
36
37
37
public:
38
38
/* *
39
39
* @param[in] obfuscate_key If passed, XOR data with this key.
40
40
*/
41
- CLevelDBBatch (const std::vector<unsigned char >& obfuscate_key) : obfuscate_key(obfuscate_key) { };
41
+ CLevelDBBatch (const std::vector<unsigned char > * obfuscate_key) : obfuscate_key(obfuscate_key) { };
42
42
43
43
template <typename K, typename V>
44
44
void Write (const K& key, const V& value)
@@ -51,7 +51,7 @@ class CLevelDBBatch
51
51
CDataStream ssValue (SER_DISK, CLIENT_VERSION);
52
52
ssValue.reserve (ssValue.GetSerializeSize (value));
53
53
ssValue << value;
54
- ssValue.Xor (obfuscate_key);
54
+ ssValue.Xor (* obfuscate_key);
55
55
leveldb::Slice slValue (&ssValue[0 ], ssValue.size ());
56
56
57
57
batch.Put (slKey, slValue);
@@ -73,15 +73,15 @@ class CLevelDBIterator
73
73
{
74
74
private:
75
75
leveldb::Iterator *piter;
76
- const std::vector<unsigned char > obfuscate_key;
76
+ const std::vector<unsigned char > * obfuscate_key;
77
77
78
78
public:
79
79
80
80
/* *
81
81
* @param[in] piterIn The original leveldb iterator.
82
82
* @param[in] obfuscate_key If passed, XOR data with this key.
83
83
*/
84
- CLevelDBIterator (leveldb::Iterator *piterIn, const std::vector<unsigned char >& obfuscate_key) :
84
+ CLevelDBIterator (leveldb::Iterator *piterIn, const std::vector<unsigned char >* obfuscate_key) :
85
85
piter (piterIn), obfuscate_key(obfuscate_key) { };
86
86
~CLevelDBIterator ();
87
87
@@ -120,7 +120,7 @@ class CLevelDBIterator
120
120
leveldb::Slice slValue = piter->value ();
121
121
try {
122
122
CDataStream ssValue (slValue.data (), slValue.data () + slValue.size (), SER_DISK, CLIENT_VERSION);
123
- ssValue.Xor (obfuscate_key);
123
+ ssValue.Xor (* obfuscate_key);
124
124
ssValue >> value;
125
125
} catch (std::exception &e) {
126
126
return false ;
@@ -210,7 +210,7 @@ class CLevelDBWrapper
210
210
template <typename K, typename V>
211
211
bool Write (const K& key, const V& value, bool fSync = false ) throw(leveldb_error)
212
212
{
213
- CLevelDBBatch batch (obfuscate_key);
213
+ CLevelDBBatch batch (& obfuscate_key);
214
214
batch.Write (key, value);
215
215
return WriteBatch (batch, fSync );
216
216
}
@@ -237,7 +237,7 @@ class CLevelDBWrapper
237
237
template <typename K>
238
238
bool Erase (const K& key, bool fSync = false ) throw(leveldb_error)
239
239
{
240
- CLevelDBBatch batch (obfuscate_key);
240
+ CLevelDBBatch batch (& obfuscate_key);
241
241
batch.Erase (key);
242
242
return WriteBatch (batch, fSync );
243
243
}
@@ -252,13 +252,13 @@ class CLevelDBWrapper
252
252
253
253
bool Sync () throw(leveldb_error)
254
254
{
255
- CLevelDBBatch batch (obfuscate_key);
255
+ CLevelDBBatch batch (& obfuscate_key);
256
256
return WriteBatch (batch, true );
257
257
}
258
258
259
259
CLevelDBIterator *NewIterator ()
260
260
{
261
- return new CLevelDBIterator (pdb->NewIterator (iteroptions), obfuscate_key);
261
+ return new CLevelDBIterator (pdb->NewIterator (iteroptions), & obfuscate_key);
262
262
}
263
263
264
264
/* *
0 commit comments