@@ -215,7 +215,7 @@ bool CDBEnv::Salvage(std::string strFile, bool fAggressive,
215215}
216216
217217
218- void CDBEnv::CheckpointLSN (std::string strFile)
218+ void CDBEnv::CheckpointLSN (const std::string& strFile)
219219{
220220 dbenv.txn_checkpoint (0 , 0 , 0 );
221221 if (fMockDb )
@@ -224,12 +224,12 @@ void CDBEnv::CheckpointLSN(std::string strFile)
224224}
225225
226226
227- CDB::CDB (const char *pszFile , const char * pszMode) :
227+ CDB::CDB (const std::string& strFilename , const char * pszMode) :
228228 pdb(NULL ), activeTxn(NULL )
229229{
230230 int ret;
231231 fReadOnly = (!strchr (pszMode, ' +' ) && !strchr (pszMode, ' w' ));
232- if (pszFile == NULL )
232+ if (strFilename. empty () )
233233 return ;
234234
235235 bool fCreate = strchr (pszMode, ' c' ) != NULL ;
@@ -242,7 +242,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
242242 if (!bitdb.Open (GetDataDir ()))
243243 throw runtime_error (" CDB : Failed to open database environment." );
244244
245- strFile = pszFile ;
245+ strFile = strFilename ;
246246 ++bitdb.mapFileUseCount [strFile];
247247 pdb = bitdb.mapDb [strFile];
248248 if (pdb == NULL )
@@ -255,14 +255,14 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
255255 DbMpoolFile*mpf = pdb->get_mpf ();
256256 ret = mpf->set_flags (DB_MPOOL_NOFILE, 1 );
257257 if (ret != 0 )
258- throw runtime_error (strprintf (" CDB : Failed to configure for no temp file backing for database %s" , pszFile ));
258+ throw runtime_error (strprintf (" CDB : Failed to configure for no temp file backing for database %s" , strFile ));
259259 }
260260
261- ret = pdb->open (NULL , // Txn pointer
262- fMockDb ? NULL : pszFile, // Filename
263- fMockDb ? pszFile : " main" , // Logical db name
264- DB_BTREE, // Database type
265- nFlags, // Flags
261+ ret = pdb->open (NULL , // Txn pointer
262+ fMockDb ? NULL : strFile. c_str (), // Filename
263+ fMockDb ? strFile. c_str () : " main" , // Logical db name
264+ DB_BTREE, // Database type
265+ nFlags, // Flags
266266 0 );
267267
268268 if (ret != 0 )
@@ -271,7 +271,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) :
271271 pdb = NULL ;
272272 --bitdb.mapFileUseCount [strFile];
273273 strFile = " " ;
274- throw runtime_error (strprintf (" CDB : Error %d, can't open database %s" , ret, pszFile ));
274+ throw runtime_error (strprintf (" CDB : Error %d, can't open database %s" , ret, strFile ));
275275 }
276276
277277 if (fCreate && !Exists (string (" version" )))
0 commit comments