diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index 3725cf3ba..ef101757f 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -1191,7 +1191,7 @@ void ManifestDumpCommand::DoCommand() { exec_state_ = LDBCommandExecuteResult::Failed(err_msg); return; } - if (db_path_[db_path_.length() - 1] != '/') { + if (db_path_.back() != '/') { db_path_.append("/"); } manifestfile = db_path_ + matched_file; diff --git a/tools/ldb_cmd_test.cc b/tools/ldb_cmd_test.cc index 3bc6ea980..c0e412789 100644 --- a/tools/ldb_cmd_test.cc +++ b/tools/ldb_cmd_test.cc @@ -187,7 +187,7 @@ class FileChecksumTestHelper { Status VerifyChecksumInManifest( const std::vector& live_files) { // Step 1: verify if the dbname_ is correct - if (dbname_[dbname_.length() - 1] != '/') { + if (dbname_.back() != '/') { dbname_.append("/"); }