File tree Expand file tree Collapse file tree 2 files changed +26
-26
lines changed Expand file tree Collapse file tree 2 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -220,17 +220,17 @@ BerkeleyEnvironment::BerkeleyEnvironment() : m_use_shared_memory(false)
220
220
fMockDb = true ;
221
221
}
222
222
223
- BerkeleyBatch:: SafeDbt::SafeDbt ()
223
+ SafeDbt::SafeDbt ()
224
224
{
225
225
m_dbt.set_flags (DB_DBT_MALLOC);
226
226
}
227
227
228
- BerkeleyBatch:: SafeDbt::SafeDbt (void * data, size_t size)
228
+ SafeDbt::SafeDbt (void * data, size_t size)
229
229
: m_dbt(data, size)
230
230
{
231
231
}
232
232
233
- BerkeleyBatch:: SafeDbt::~SafeDbt ()
233
+ SafeDbt::~SafeDbt ()
234
234
{
235
235
if (m_dbt.get_data () != nullptr ) {
236
236
// Clear memory, e.g. in case it was a private key
@@ -244,17 +244,17 @@ BerkeleyBatch::SafeDbt::~SafeDbt()
244
244
}
245
245
}
246
246
247
- const void * BerkeleyBatch:: SafeDbt::get_data () const
247
+ const void * SafeDbt::get_data () const
248
248
{
249
249
return m_dbt.get_data ();
250
250
}
251
251
252
- uint32_t BerkeleyBatch:: SafeDbt::get_size () const
252
+ uint32_t SafeDbt::get_size () const
253
253
{
254
254
return m_dbt.get_size ();
255
255
}
256
256
257
- BerkeleyBatch:: SafeDbt::operator Dbt*()
257
+ SafeDbt::operator Dbt*()
258
258
{
259
259
return &m_dbt;
260
260
}
Original file line number Diff line number Diff line change @@ -165,29 +165,29 @@ class BerkeleyDatabase : public WalletDatabase
165
165
std::unique_ptr<DatabaseBatch> MakeBatch (bool flush_on_close = true ) override ;
166
166
};
167
167
168
- /* * RAII class that provides access to a Berkeley database */
169
- class BerkeleyBatch : public DatabaseBatch
168
+ /* * RAII class that automatically cleanses its data on destruction */
169
+ class SafeDbt final
170
170
{
171
- /* * RAII class that automatically cleanses its data on destruction */
172
- class SafeDbt final
173
- {
174
- Dbt m_dbt;
175
-
176
- public:
177
- // construct Dbt with internally-managed data
178
- SafeDbt ();
179
- // construct Dbt with provided data
180
- SafeDbt (void * data, size_t size);
181
- ~SafeDbt ();
182
-
183
- // delegate to Dbt
184
- const void * get_data () const ;
185
- uint32_t get_size () const ;
171
+ Dbt m_dbt;
186
172
187
- // conversion operator to access the underlying Dbt
188
- operator Dbt*();
189
- };
173
+ public:
174
+ // construct Dbt with internally-managed data
175
+ SafeDbt ();
176
+ // construct Dbt with provided data
177
+ SafeDbt (void * data, size_t size);
178
+ ~SafeDbt ();
179
+
180
+ // delegate to Dbt
181
+ const void * get_data () const ;
182
+ uint32_t get_size () const ;
183
+
184
+ // conversion operator to access the underlying Dbt
185
+ operator Dbt*();
186
+ };
190
187
188
+ /* * RAII class that provides access to a Berkeley database */
189
+ class BerkeleyBatch : public DatabaseBatch
190
+ {
191
191
private:
192
192
bool ReadKey (CDataStream&& key, CDataStream& value) override ;
193
193
bool WriteKey (CDataStream&& key, CDataStream&& value, bool overwrite = true ) override ;
You can’t perform that action at this time.
0 commit comments