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&
247247 return (fRecovered ? VerifyResult::RECOVER_OK : VerifyResult::RECOVER_FAIL);
248248}
249249
250- BerkeleyBatch::SafeDbt::SafeDbt (u_int32_t flags )
250+ BerkeleyBatch::SafeDbt::SafeDbt ()
251251{
252- m_dbt.set_flags (flags );
252+ m_dbt.set_flags (DB_DBT_MALLOC );
253253}
254254
255- BerkeleyBatch::SafeDbt::SafeDbt (void * data, size_t size)
255+ BerkeleyBatch::SafeDbt::SafeDbt (void * data, size_t size)
256256 : m_dbt(data, size)
257257{
258258}
Original file line number Diff line number Diff line change @@ -170,13 +170,15 @@ class BerkeleyDatabase
170170class BerkeleyBatch
171171{
172172 /* * RAII class that automatically cleanses its data on destruction */
173- class SafeDbt final {
173+ class SafeDbt final
174+ {
174175 Dbt m_dbt;
175176
176177 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);
180182 ~SafeDbt ();
181183
182184 // delegate to Dbt
@@ -227,7 +229,7 @@ class BerkeleyBatch
227229 SafeDbt datKey (ssKey.data (), ssKey.size ());
228230
229231 // Read
230- SafeDbt datValue (DB_DBT_MALLOC) ;
232+ SafeDbt datValue;
231233 int ret = pdb->get (activeTxn, datKey, datValue, 0 );
232234 bool success = false ;
233235 if (datValue.get_data () != nullptr ) {
@@ -318,8 +320,8 @@ class BerkeleyBatch
318320 int ReadAtCursor (Dbc* pcursor, CDataStream& ssKey, CDataStream& ssValue)
319321 {
320322 // Read at cursor
321- SafeDbt datKey (DB_DBT_MALLOC) ;
322- SafeDbt datValue (DB_DBT_MALLOC) ;
323+ SafeDbt datKey;
324+ SafeDbt datValue;
323325 int ret = pcursor->get (datKey, datValue, DB_NEXT);
324326 if (ret != 0 )
325327 return ret;
You can’t perform that action at this time.
0 commit comments