File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -247,12 +247,12 @@ BerkeleyEnvironment::VerifyResult BerkeleyEnvironment::Verify(const std::string&
247
247
return (fRecovered ? VerifyResult::RECOVER_OK : VerifyResult::RECOVER_FAIL);
248
248
}
249
249
250
- BerkeleyBatch::SafeDbt::SafeDbt (u_int32_t flags )
250
+ BerkeleyBatch::SafeDbt::SafeDbt ()
251
251
{
252
- m_dbt.set_flags (flags );
252
+ m_dbt.set_flags (DB_DBT_MALLOC );
253
253
}
254
254
255
- BerkeleyBatch::SafeDbt::SafeDbt (void * data, size_t size)
255
+ BerkeleyBatch::SafeDbt::SafeDbt (void * data, size_t size)
256
256
: m_dbt(data, size)
257
257
{
258
258
}
Original file line number Diff line number Diff line change @@ -170,13 +170,15 @@ class BerkeleyDatabase
170
170
class BerkeleyBatch
171
171
{
172
172
/* * RAII class that automatically cleanses its data on destruction */
173
- class SafeDbt final {
173
+ class SafeDbt final
174
+ {
174
175
Dbt m_dbt;
175
176
176
177
public:
177
- // construct Dbt with data or flags
178
- SafeDbt (u_int32_t flags = 0 );
179
- SafeDbt (void *data, size_t size);
178
+ // construct Dbt with internally-managed data
179
+ SafeDbt ();
180
+ // construct Dbt with provided data
181
+ SafeDbt (void * data, size_t size);
180
182
~SafeDbt ();
181
183
182
184
// delegate to Dbt
@@ -227,7 +229,7 @@ class BerkeleyBatch
227
229
SafeDbt datKey (ssKey.data (), ssKey.size ());
228
230
229
231
// Read
230
- SafeDbt datValue (DB_DBT_MALLOC) ;
232
+ SafeDbt datValue;
231
233
int ret = pdb->get (activeTxn, datKey, datValue, 0 );
232
234
bool success = false ;
233
235
if (datValue.get_data () != nullptr ) {
@@ -318,8 +320,8 @@ class BerkeleyBatch
318
320
int ReadAtCursor (Dbc* pcursor, CDataStream& ssKey, CDataStream& ssValue)
319
321
{
320
322
// Read at cursor
321
- SafeDbt datKey (DB_DBT_MALLOC) ;
322
- SafeDbt datValue (DB_DBT_MALLOC) ;
323
+ SafeDbt datKey;
324
+ SafeDbt datValue;
323
325
int ret = pcursor->get (datKey, datValue, DB_NEXT);
324
326
if (ret != 0 )
325
327
return ret;
You can’t perform that action at this time.
0 commit comments