From 95abf92b23de71f5374eab4c0f3d47a564a8b1b2 Mon Sep 17 00:00:00 2001 From: YangLuo Date: Wed, 26 Jan 2022 13:15:01 +0800 Subject: [PATCH] Change data() to c_str() when getting const char* --- mindspore/ccsrc/minddata/dataset/api/text.cc | 2 +- .../ccsrc/minddata/dataset/audio/kernels/audio_utils.cc | 2 +- mindspore/ccsrc/minddata/dataset/engine/cache/cache_hw.cc | 2 +- .../dataset/engine/datasetops/source/celeba_op.cc | 2 +- .../dataset/engine/datasetops/source/cityscapes_op.cc | 2 +- .../minddata/dataset/engine/datasetops/source/clue_op.cc | 4 ++-- .../dataset/engine/datasetops/source/cmu_arctic_op.cc | 2 +- .../minddata/dataset/engine/datasetops/source/coco_op.cc | 4 ++-- .../dataset/engine/datasetops/source/conll2000_op.cc | 2 +- .../minddata/dataset/engine/datasetops/source/csv_op.cc | 8 ++++---- .../minddata/dataset/engine/datasetops/source/div2k_op.cc | 2 +- .../dataset/engine/datasetops/source/emnist_op.cc | 2 +- .../dataset/engine/datasetops/source/en_wik9_op.cc | 4 ++-- .../dataset/engine/datasetops/source/flickr_op.cc | 4 ++-- .../minddata/dataset/engine/datasetops/source/gtzan_op.cc | 2 +- .../minddata/dataset/engine/datasetops/source/imdb_op.cc | 4 ++-- .../minddata/dataset/engine/datasetops/source/iwslt_op.cc | 2 +- .../dataset/engine/datasetops/source/libri_tts_op.cc | 2 +- .../dataset/engine/datasetops/source/lj_speech_op.cc | 4 ++-- .../dataset/engine/datasetops/source/manifest_op.cc | 4 ++-- .../dataset/engine/datasetops/source/multi30k_op.cc | 4 ++-- .../dataset/engine/datasetops/source/photo_tour_op.cc | 2 +- .../dataset/engine/datasetops/source/places365_op.cc | 2 +- .../dataset/engine/datasetops/source/qmnist_op.cc | 2 +- .../dataset/engine/datasetops/source/semeion_op.cc | 2 +- .../engine/datasetops/source/speech_commands_op.cc | 4 ++-- .../minddata/dataset/engine/datasetops/source/stl10_op.cc | 2 +- .../dataset/engine/datasetops/source/text_file_op.cc | 4 ++-- .../dataset/engine/datasetops/source/tf_reader_op.cc | 8 ++++---- .../minddata/dataset/engine/datasetops/source/udpos_op.cc | 2 +- .../minddata/dataset/engine/datasetops/source/usps_op.cc | 2 +- .../minddata/dataset/engine/datasetops/source/voc_op.cc | 2 +- .../dataset/engine/datasetops/source/wider_face_op.cc | 2 +- .../dataset/engine/datasetops/source/yes_no_op.cc | 2 +- .../minddata/dataset/engine/gnn/graph_shared_memory.cc | 2 +- .../dataset/engine/ir/datasetops/source/celeba_node.cc | 4 ++-- mindspore/ccsrc/minddata/dataset/engine/serdes.cc | 2 +- .../dataset/text/kernels/sentence_piece_tokenizer_op.cc | 2 +- .../ccsrc/minddata/dataset/text/sentence_piece_vocab.cc | 2 +- mindspore/ccsrc/minddata/dataset/text/vocab.cc | 4 ++-- mindspore/ccsrc/minddata/mindrecord/common/shard_utils.cc | 2 +- .../ccsrc/minddata/mindrecord/io/shard_index_generator.cc | 4 ++-- mindspore/ccsrc/minddata/mindrecord/io/shard_reader.cc | 8 ++++---- mindspore/ccsrc/minddata/mindrecord/io/shard_writer.cc | 6 +++--- mindspore/ccsrc/minddata/mindrecord/meta/shard_header.cc | 8 ++++---- 45 files changed, 72 insertions(+), 72 deletions(-) diff --git a/mindspore/ccsrc/minddata/dataset/api/text.cc b/mindspore/ccsrc/minddata/dataset/api/text.cc index 42891cebe3b..0dfb7970409 100644 --- a/mindspore/ccsrc/minddata/dataset/api/text.cc +++ b/mindspore/ccsrc/minddata/dataset/api/text.cc @@ -169,7 +169,7 @@ Status JiebaTokenizer::AddDictChar(const std::vector &file_path) { Status JiebaTokenizer::ParserFile(const std::string &file_path, std::vector> *const user_dict) { RETURN_UNEXPECTED_IF_NULL(user_dict); - auto realpath = FileUtils::GetRealPath(file_path.data()); + auto realpath = FileUtils::GetRealPath(file_path.c_str()); if (!realpath.has_value()) { std::string err_msg = "Get real path failed, path: " + file_path; LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); diff --git a/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc b/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc index fee41ad881b..ef1d0404ae4 100644 --- a/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc +++ b/mindspore/ccsrc/minddata/dataset/audio/kernels/audio_utils.cc @@ -986,7 +986,7 @@ Status GenerateWaveTable(std::shared_ptr *output, const DataType &type, Status ReadWaveFile(const std::string &wav_file_dir, std::vector *waveform_vec, int32_t *sample_rate) { RETURN_UNEXPECTED_IF_NULL(waveform_vec); RETURN_UNEXPECTED_IF_NULL(sample_rate); - auto wav_realpath = FileUtils::GetRealPath(wav_file_dir.data()); + auto wav_realpath = FileUtils::GetRealPath(wav_file_dir.c_str()); if (!wav_realpath.has_value()) { LOG_AND_RETURN_STATUS_SYNTAX_ERROR("Invalid file path, get real path failed: " + wav_file_dir); } diff --git a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_hw.cc b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_hw.cc index f1e3773a28b..14ffaf920df 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/cache/cache_hw.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/cache/cache_hw.cc @@ -123,7 +123,7 @@ Status CacheServerHW::GetNumaNodeInfo() { numa_id_t numa_node = static_cast(strtol(node_dir.data() + strlen(kNodeName), nullptr, kDecimal)); Path f = p / kCpuList; - auto realpath = FileUtils::GetRealPath(f.ToString().data()); + auto realpath = FileUtils::GetRealPath(f.ToString().c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Get real path failed, path=" << f.ToString(); RETURN_STATUS_UNEXPECTED("Get real path failed, path=" + f.ToString()); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/celeba_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/celeba_op.cc index 5e9affec769..0c41d3f5cc4 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/celeba_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/celeba_op.cc @@ -58,7 +58,7 @@ Status CelebAOp::ParseAttrFile() { TaskManager::FindMe()->Post(); Path folder_path(folder_path_); - auto realpath = FileUtils::GetRealPath((folder_path / "list_attr_celeba.txt").ToString().data()); + auto realpath = FileUtils::GetRealPath((folder_path / "list_attr_celeba.txt").ToString().c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << (folder_path / "list_attr_celeba.txt").ToString() << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + (folder_path / "list_attr_celeba.txt").ToString() + diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cityscapes_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cityscapes_op.cc index a060401390c..a748bc0d0e9 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cityscapes_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cityscapes_op.cc @@ -107,7 +107,7 @@ void CityscapesOp::Print(std::ostream &out, bool show_all) const { } Status CityscapesOp::PrepareData() { - auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.data()); + auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.c_str()); if (!real_dataset_dir.has_value()) { MS_LOG(ERROR) << "Invalid file path, Cityscapes Dataset dir: " << dataset_dir_ << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, Cityscapes Dataset dir: " + dataset_dir_ + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.cc index cdeee7a2fcd..941605340ef 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/clue_op.cc @@ -82,7 +82,7 @@ Status ClueOp::GetValue(const nlohmann::json &js, std::vector key_c } Status ClueOp::LoadFile(const std::string &file, int64_t start_offset, int64_t end_offset, int32_t worker_id) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { std::string err_msg = "Invalid file path, " + file + " does not exist."; LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); @@ -230,7 +230,7 @@ Status ClueOp::CalculateNumRowsPerShard() { } int64_t CountTotalRowsPerFile(const std::string &file) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file, " << file << " does not exist."; return 0; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc index b1f2eea854e..9ff7a831602 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/cmu_arctic_op.cc @@ -132,7 +132,7 @@ Status CMUArcticOp::ReadAudio(const std::string &audio_dir, std::shared_ptr image; - auto real_path = FileUtils::GetRealPath(image_folder_path_.data()); + auto real_path = FileUtils::GetRealPath(image_folder_path_.c_str()); if (!real_path.has_value()) { RETURN_STATUS_UNEXPECTED("Invalid file path, COCO dataset image folder: " + image_folder_path_ + " does not exist."); @@ -313,7 +313,7 @@ Status CocoOp::SearchNodeInJson(const nlohmann::json &input_tree, std::string no Status CocoOp::PrepareData() { nlohmann::json js; try { - auto realpath = FileUtils::GetRealPath(annotation_path_.data()); + auto realpath = FileUtils::GetRealPath(annotation_path_.c_str()); if (!realpath.has_value()) { std::string err_msg = "Invalid file path, Coco Dataset annotation file: " + annotation_path_ + " does not exist."; LOG_AND_RETURN_STATUS_SYNTAX_ERROR(err_msg); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc index 91200e44ac4..666c61691a4 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/conll2000_op.cc @@ -115,7 +115,7 @@ Status CoNLL2000Op::Load(const std::vector &word, const std::vector } Status CoNLL2000Op::LoadFile(const std::string &file, int64_t start_offset, int64_t end_offset, int32_t worker_id) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << DatasetName() << " dataset dir: " << file << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + DatasetName() + " dataset dir: " + file + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/csv_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/csv_op.cc index e49f340c74e..f42fd6e1282 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/csv_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/csv_op.cc @@ -469,7 +469,7 @@ Status CsvOp::LoadFile(const std::string &file, int64_t start_offset, int64_t en csv_parser.SetStartOffset(start_offset); csv_parser.SetEndOffset(end_offset); - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << file << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + file + " does not exist."); @@ -612,7 +612,7 @@ int64_t CsvOp::CountTotalRows(const std::string &file) { return 0; } - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, csv file: " << file << " does not exist."; return 0; @@ -716,7 +716,7 @@ Status CsvOp::ColMapAnalyse(const std::string &csv_file_name) { if (column_name_list_.empty()) { // Actually we only deal with the first file, because the column name set in other files must remain the same if (!check_flag_) { - auto realpath = FileUtils::GetRealPath(csv_file_name.data()); + auto realpath = FileUtils::GetRealPath(csv_file_name.c_str()); if (!realpath.has_value()) { std::string err_msg = "Invalid file path, csv file: " + csv_file_name + " does not exist."; MS_LOG(ERROR) << err_msg; @@ -774,7 +774,7 @@ bool CsvOp::ColumnNameValidate() { std::string match_file; for (auto &csv_file : csv_files_list_) { - auto realpath = FileUtils::GetRealPath(csv_file.data()); + auto realpath = FileUtils::GetRealPath(csv_file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, csv file: " << csv_file << " does not exist."; return false; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/div2k_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/div2k_op.cc index 3d25ad04ba5..2efc8a76f8d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/div2k_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/div2k_op.cc @@ -158,7 +158,7 @@ Status DIV2KOp::GetDIV2KLRDirRealName(const std::string &hr_dir_key, const std:: Status DIV2KOp::GetDIV2KDataByUsage() { const std::string kExtension = ".png"; - auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.data()); + auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.c_str()); if (!real_dataset_dir.has_value()) { MS_LOG(ERROR) << "Invalid file path, div2k dataset dir: " << dataset_dir_ << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, div2k dataset dir: " + dataset_dir_ + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc index 423965a9d6b..516a9656d27 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/emnist_op.cc @@ -57,7 +57,7 @@ Status EMnistOp::WalkAllFiles() { const std::string lbl_ext = "-labels-idx1-ubyte"; const std::string train_prefix = "-train"; const std::string test_prefix = "-test"; - auto realpath = FileUtils::GetRealPath(folder_path_.data()); + auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); CHECK_FAIL_RETURN_UNEXPECTED(realpath.has_value(), "Invalid file path, " + folder_path_ + " does not exist."); Path dir(realpath.value()); auto dir_it = Path::DirIterator::OpenDirectory(&dir); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/en_wik9_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/en_wik9_op.cc index 8fc31c026c2..13dc28b70bd 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/en_wik9_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/en_wik9_op.cc @@ -52,7 +52,7 @@ void EnWik9Op::Print(std::ostream &out, bool show_all) const { } Status EnWik9Op::LoadFile(const std::string &file, int64_t start_offset, int64_t end_offset, int32_t worker_id) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << file << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + file + " does not exist."); @@ -93,7 +93,7 @@ Status EnWik9Op::LoadFile(const std::string &file, int64_t start_offset, int64_t } int64_t EnWik9Op::CountTotalRows(const std::string &file) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file, " << file << " does not exist."; return 0; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/flickr_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/flickr_op.cc index a6783df65ee..3360af0699c 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/flickr_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/flickr_op.cc @@ -75,7 +75,7 @@ void FlickrOp::Print(std::ostream &out, bool show_all) const { } Status FlickrOp::PrepareData() { - auto real_file_path = FileUtils::GetRealPath(file_path_.data()); + auto real_file_path = FileUtils::GetRealPath(file_path_.c_str()); if (!real_file_path.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << file_path_ << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + file_path_ + " does not exist."); @@ -147,7 +147,7 @@ Status FlickrOp::PrepareData() { // Optimization: Could take in a tensor // This function does not return status because we want to just skip bad input, not crash Status FlickrOp::CheckImageType(const std::string &file_name, bool *valid) { - auto real_file_name = FileUtils::GetRealPath(file_name.data()); + auto real_file_name = FileUtils::GetRealPath(file_name.c_str()); if (!real_file_name.has_value()) { MS_LOG(ERROR) << "Invalid file path, flickr dataset file: " << file_name << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, flickr dataset file: " + file_name + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/gtzan_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/gtzan_op.cc index 5bb80886f99..8f06d4abcb3 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/gtzan_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/gtzan_op.cc @@ -277,7 +277,7 @@ Status GTZANOp::ReadAudio(const std::string &audio_dir, std::shared_ptr } Status GTZANOp::PrepareData() { - auto realpath = FileUtils::GetRealPath(folder_path_.data()); + auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, GTZAN Dataset dir: " << folder_path_ << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, GTZAN Dataset dir: " + folder_path_ + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/imdb_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/imdb_op.cc index 5f8478fc5b1..369e2056b6f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/imdb_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/imdb_op.cc @@ -48,7 +48,7 @@ Status IMDBOp::PrepareData() { } std::vector label_list = {"pos", "neg"}; // get abs path for folder_path_ - auto realpath = FileUtils::GetRealPath(folder_path_.data()); + auto realpath = FileUtils::GetRealPath(folder_path_.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, imdb dataset dir: " << folder_path_ << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, imdb dataset dir: " + folder_path_ + " does not exist."); @@ -142,7 +142,7 @@ Status IMDBOp::GetDataByUsage(const std::string &folder, const std::string &labe Status IMDBOp::CountRows(const std::string &path, const std::string &usage, int64_t *num_rows) { RETURN_UNEXPECTED_IF_NULL(num_rows); // get abs path for folder_path_ - auto abs_path = FileUtils::GetRealPath(path.data()); + auto abs_path = FileUtils::GetRealPath(path.c_str()); if (!abs_path.has_value()) { MS_LOG(ERROR) << "Invalid file path, imdb dataset dir: " << path << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, imdb dataset dir: " + path + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.cc index 52bfd45ca84..b314dc7e9ac 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/iwslt_op.cc @@ -447,7 +447,7 @@ std::string IWSLTOp::GenerateIWSLT2017XMLFileName(Path dir, const std::string &s Status IWSLTOp::GetFiles() { std::vector src_path_list; std::vector target_path_list; - auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.data()); + auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.c_str()); CHECK_FAIL_RETURN_UNEXPECTED(real_dataset_dir.has_value(), "Get real path failed: " + dataset_dir_); Path root_dir(real_dataset_dir.value()); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/libri_tts_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/libri_tts_op.cc index cd6c5f6cce4..cdd069da306 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/libri_tts_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/libri_tts_op.cc @@ -139,7 +139,7 @@ Status LibriTTSOp::ReadAudio(const std::string &audio_dir, std::shared_ptr> *cls_ids) // {"source": "/path/to/image1.jpg", "usage":"train", annotation": ...} // {"source": "/path/to/image2.jpg", "usage":"eval", "annotation": ...} Status ManifestOp::PrepareData() { - auto realpath = FileUtils::GetRealPath(file_.data()); + auto realpath = FileUtils::GetRealPath(file_.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << file_ << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + file_ + " does not exist."); @@ -194,7 +194,7 @@ Status ManifestOp::PrepareData() { // Only support JPEG/PNG/GIF/BMP Status ManifestOp::CheckImageType(const std::string &file_name, bool *valid) { - auto realpath = FileUtils::GetRealPath(file_name.data()); + auto realpath = FileUtils::GetRealPath(file_name.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << file_name << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + file_name + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc index 80b8367d7ab..960a5f47c42 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/multi30k_op.cc @@ -68,7 +68,7 @@ Status Multi30kOp::LoadTensor(const std::string &line, TensorRow *out_row, size_ } Status Multi30kOp::LoadFile(const std::string &file_en, int64_t start_offset, int64_t end_offset, int32_t worker_id) { - auto realpath_en = FileUtils::GetRealPath(file_en.data()); + auto realpath_en = FileUtils::GetRealPath(file_en.c_str()); if (!realpath_en.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << DatasetName() + " Dataset file: " << file_en << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + DatasetName() + " Dataset file: " + file_en + " does not exist."); @@ -84,7 +84,7 @@ Status Multi30kOp::LoadFile(const std::string &file_en, int64_t start_offset, in Path BaseName(basename); Path path_de = parent_path / BaseName; std::string file_de = path_de.ToString(); - auto realpath_de = FileUtils::GetRealPath(file_de.data()); + auto realpath_de = FileUtils::GetRealPath(file_de.c_str()); if (!realpath_de.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << DatasetName() + " Dataset file: " << file_de << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + DatasetName() + " Dataset file: " + file_de + " does not exist."); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc index 24e08472091..06063583528 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/photo_tour_op.cc @@ -337,7 +337,7 @@ Status PhotoTourOp::GetPhotoTourDataTensor(uint32_t index, std::shared_ptr file_names; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc index 3d3bdde553b..6c646672bd6 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/places365_op.cc @@ -253,7 +253,7 @@ Status Places365Op::GetPlaces365DataTensor(uint32_t index, std::shared_ptr selected_files; - auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.data()); + auto real_dataset_dir = FileUtils::GetRealPath(dataset_dir_.c_str()); if (!real_dataset_dir.has_value()) { MS_LOG(ERROR) << "Get real path failed, path=" << dataset_dir_; RETURN_STATUS_UNEXPECTED("Get real path failed, path=" + dataset_dir_); @@ -191,7 +191,7 @@ Status SpeechCommandsOp::GetFileInfo(const std::string &file_path, std::string * Status SpeechCommandsOp::CountTotalRows(int64_t *num_rows) { RETURN_UNEXPECTED_IF_NULL(num_rows); if (all_wave_files.size() == 0) { - auto real_path = FileUtils::GetRealPath(dataset_dir_.data()); + auto real_path = FileUtils::GetRealPath(dataset_dir_.c_str()); if (!real_path.has_value()) { MS_LOG(ERROR) << "Get real path failed, path=" << dataset_dir_; RETURN_STATUS_UNEXPECTED("Get real path failed, path=" + dataset_dir_); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc index 30e916253f6..69a1a5d8d83 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/stl10_op.cc @@ -93,7 +93,7 @@ void STL10Op::Print(std::ostream &out, bool show_all) const { } Status STL10Op::WalkAllFiles() { - auto real_dataset_dir = FileUtils::GetRealPath(folder_path_.data()); + auto real_dataset_dir = FileUtils::GetRealPath(folder_path_.c_str()); CHECK_FAIL_RETURN_UNEXPECTED(real_dataset_dir.has_value(), "Invalid file, get real path failed, path: " + folder_path_); Path root_dir(real_dataset_dir.value()); diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/text_file_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/text_file_op.cc index 87b6cb87a91..b0ddf4c5b46 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/text_file_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/text_file_op.cc @@ -78,7 +78,7 @@ Status TextFileOp::LoadTensor(const std::string &line, TensorRow *out_row) { } Status TextFileOp::LoadFile(const std::string &file, int64_t start_offset, int64_t end_offset, int32_t worker_id) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << file << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + file + " does not exist."); @@ -168,7 +168,7 @@ Status TextFileOp::FillIOBlockQueue(const std::vector &i_keys) { } int64_t TextFileOp::CountTotalRows(const std::string &file) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file, " << file << " does not exist."; return 0; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc index c626681e0e0..67ab06ac60d 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/tf_reader_op.cc @@ -42,7 +42,7 @@ namespace dataset { const int64_t kTFRecordFileLimit = 0x140000000; bool TFReaderOp::ValidateFirstRowCrc(const std::string &filename) { - auto realpath = FileUtils::GetRealPath(filename.data()); + auto realpath = FileUtils::GetRealPath(filename.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << filename << " does not exist."; return false; @@ -265,7 +265,7 @@ Status TFReaderOp::FillIOBlockNoShuffle() { // Reads a tf_file file and loads the data into multiple TensorRows. Status TFReaderOp::LoadFile(const std::string &filename, int64_t start_offset, int64_t end_offset, int32_t worker_id) { - auto realpath = FileUtils::GetRealPath(filename.data()); + auto realpath = FileUtils::GetRealPath(filename.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << filename << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + filename + " does not exist."); @@ -553,7 +553,7 @@ Status TFReaderOp::LoadIntList(const ColDescriptor ¤t_col, const dataengin } Status TFReaderOp::CreateSchema(const std::string tf_file, std::vector columns_to_load) { - auto realpath = FileUtils::GetRealPath(tf_file.data()); + auto realpath = FileUtils::GetRealPath(tf_file.c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << tf_file << " does not exist."; RETURN_STATUS_UNEXPECTED("Invalid file path, " + tf_file + " does not exist."); @@ -691,7 +691,7 @@ Status TFReaderOp::CountTotalRows(int64_t *out_total_rows, const std::vector &filenames, int64_t begin, int64_t end) { int64_t rows_read = 0; for (int i = begin; i < end; i++) { - auto realpath = FileUtils::GetRealPath(filenames[i].data()); + auto realpath = FileUtils::GetRealPath(filenames[i].c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file path, " << filenames[i] << " does not exist."; continue; diff --git a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/udpos_op.cc b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/udpos_op.cc index e78b6dc8d75..aae7121489f 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/udpos_op.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/udpos_op.cc @@ -113,7 +113,7 @@ Status UDPOSOp::Load(const std::vector &word, const std::vector &size std::string line; Path folder_path(dataset_dir_); - auto realpath = FileUtils::GetRealPath((folder_path / "list_attr_celeba.txt").ToString().data()); + auto realpath = FileUtils::GetRealPath((folder_path / "list_attr_celeba.txt").ToString().c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file, get real path failed, path=" << (folder_path / "list_attr_celeba.txt").ToString(); RETURN_STATUS_UNEXPECTED("Invalid file, get real path failed, path=" + @@ -137,7 +137,7 @@ Status CelebANode::GetDatasetSize(const std::shared_ptr &size } } if (!partition_file.is_open()) { - auto realpath_eval = FileUtils::GetRealPath((folder_path / "list_eval_partition.txt").ToString().data()); + auto realpath_eval = FileUtils::GetRealPath((folder_path / "list_eval_partition.txt").ToString().c_str()); if (!realpath_eval.has_value()) { MS_LOG(ERROR) << "Invalid file, get real path failed, path=" << (folder_path / "list_eval_partition.txt").ToString(); diff --git a/mindspore/ccsrc/minddata/dataset/engine/serdes.cc b/mindspore/ccsrc/minddata/dataset/engine/serdes.cc index 9b62ec802ca..a37de09b817 100644 --- a/mindspore/ccsrc/minddata/dataset/engine/serdes.cc +++ b/mindspore/ccsrc/minddata/dataset/engine/serdes.cc @@ -63,7 +63,7 @@ Status Serdes::SaveJSONToFile(nlohmann::json json_string, const std::string &fil if (!dir.has_value()) { dir = "."; } - auto realpath = FileUtils::GetRealPath(dir.value().data()); + auto realpath = FileUtils::GetRealPath(dir.value().c_str()); if (!realpath.has_value()) { MS_LOG(ERROR) << "Invalid file, get real path failed, path=" << file_name; RETURN_STATUS_UNEXPECTED("Invalid file, get real path failed, path=" + file_name); diff --git a/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.cc b/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.cc index 84df819ab66..6503c8267b8 100644 --- a/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.cc +++ b/mindspore/ccsrc/minddata/dataset/text/kernels/sentence_piece_tokenizer_op.cc @@ -87,7 +87,7 @@ Status SentencePieceTokenizerOp::Compute(const std::shared_ptr &input, s } Status SentencePieceTokenizerOp::GetModelRealPath(const std::string &model_path, const std::string &filename) { - auto realpath = FileUtils::GetRealPath(model_path.data()); + auto realpath = FileUtils::GetRealPath(model_path.c_str()); if (!realpath.has_value()) { RETURN_STATUS_UNEXPECTED( "SentencePieceTokenizer: Sentence piece model path is not existed or permission denied. Model path: " + diff --git a/mindspore/ccsrc/minddata/dataset/text/sentence_piece_vocab.cc b/mindspore/ccsrc/minddata/dataset/text/sentence_piece_vocab.cc index 0e75c9b9a3f..9afd792bd24 100644 --- a/mindspore/ccsrc/minddata/dataset/text/sentence_piece_vocab.cc +++ b/mindspore/ccsrc/minddata/dataset/text/sentence_piece_vocab.cc @@ -91,7 +91,7 @@ Status SentencePieceVocab::SaveModel(const std::shared_ptr * if (vocab == nullptr) { RETURN_STATUS_UNEXPECTED("SentencePieceVocab::SaveModel: input vocab can not be null"); } - auto realpath = FileUtils::GetRealPath(path.data()); + auto realpath = FileUtils::GetRealPath(path.c_str()); if (!realpath.has_value()) { RETURN_STATUS_UNEXPECTED("Get real path failed, path=" + path); } diff --git a/mindspore/ccsrc/minddata/dataset/text/vocab.cc b/mindspore/ccsrc/minddata/dataset/text/vocab.cc index c964bca11d0..82dbb48b0f5 100644 --- a/mindspore/ccsrc/minddata/dataset/text/vocab.cc +++ b/mindspore/ccsrc/minddata/dataset/text/vocab.cc @@ -168,7 +168,7 @@ Status Vocab::BuildFromFileCpp(const std::string &path, const std::string &delim RETURN_STATUS_UNEXPECTED("Vocab::BuildFromFileCpp: input vocab can not be null"); } // Validate parameters - auto realpath = FileUtils::GetRealPath(path.data()); + auto realpath = FileUtils::GetRealPath(path.c_str()); CHECK_FAIL_RETURN_UNEXPECTED(realpath.has_value(), "Get real path failed, path=" + path); CHECK_FAIL_RETURN_UNEXPECTED( @@ -241,7 +241,7 @@ Status Vocab::BuildFromFile(const std::string &path, const std::string &delimite WordIdType word_id = prepend_special ? static_cast(special_tokens.size()) : 0; std::unordered_map word2id; - auto realpath = FileUtils::GetRealPath(path.data()); + auto realpath = FileUtils::GetRealPath(path.c_str()); if (!realpath.has_value()) { RETURN_STATUS_UNEXPECTED("Get real path failed, path=" + path); } diff --git a/mindspore/ccsrc/minddata/mindrecord/common/shard_utils.cc b/mindspore/ccsrc/minddata/mindrecord/common/shard_utils.cc index 212cf926dd7..9dd007ccb15 100644 --- a/mindspore/ccsrc/minddata/mindrecord/common/shard_utils.cc +++ b/mindspore/ccsrc/minddata/mindrecord/common/shard_utils.cc @@ -83,7 +83,7 @@ Status GetParentDir(const std::string &path, std::shared_ptr *pd_pt prefix_path = "."; } - auto realpath = FileUtils::GetRealPath(prefix_path.value().data()); + auto realpath = FileUtils::GetRealPath(prefix_path.value().c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the parent dir of mindrecord file. Please check file: " + path); diff --git a/mindspore/ccsrc/minddata/mindrecord/io/shard_index_generator.cc b/mindspore/ccsrc/minddata/mindrecord/io/shard_index_generator.cc index 2a3808a10e0..ee9d0bde3a6 100644 --- a/mindspore/ccsrc/minddata/mindrecord/io/shard_index_generator.cc +++ b/mindspore/ccsrc/minddata/mindrecord/io/shard_index_generator.cc @@ -169,7 +169,7 @@ Status ShardIndexGenerator::CheckDatabase(const std::string &shard_address, sqli dir = "."; } - auto realpath = FileUtils::GetRealPath(dir.value().data()); + auto realpath = FileUtils::GetRealPath(dir.value().c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file: " + shard_address); @@ -504,7 +504,7 @@ Status ShardIndexGenerator::ExecuteTransaction(const int &shard_no, sqlite3 *db, // Add index data to database std::string shard_address = shard_header_.GetShardAddressByID(shard_no); - auto realpath = FileUtils::GetRealPath(shard_address.data()); + auto realpath = FileUtils::GetRealPath(shard_address.c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file path: " + shard_address); diff --git a/mindspore/ccsrc/minddata/mindrecord/io/shard_reader.cc b/mindspore/ccsrc/minddata/mindrecord/io/shard_reader.cc index 424bf219469..4aa03575982 100644 --- a/mindspore/ccsrc/minddata/mindrecord/io/shard_reader.cc +++ b/mindspore/ccsrc/minddata/mindrecord/io/shard_reader.cc @@ -197,7 +197,7 @@ Status ShardReader::Open() { dir = "."; } - auto realpath = FileUtils::GetRealPath(dir.value().data()); + auto realpath = FileUtils::GetRealPath(dir.value().c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file: " + file); @@ -230,7 +230,7 @@ Status ShardReader::Open(int n_consumer) { dir = "."; } - auto realpath = FileUtils::GetRealPath(dir.value().data()); + auto realpath = FileUtils::GetRealPath(dir.value().c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file: " + file); @@ -438,7 +438,7 @@ Status ShardReader::ReadAllRowsInShard(int shard_id, const std::string &sql, con MS_LOG(INFO) << "Succeed to get " << labels.size() << " records from shard " << std::to_string(shard_id) << " index."; std::string file_name = file_paths_[shard_id]; - auto realpath = FileUtils::GetRealPath(file_name.data()); + auto realpath = FileUtils::GetRealPath(file_name.c_str()); if (!realpath.has_value()) { sqlite3_free(errmsg); sqlite3_close(db); @@ -763,7 +763,7 @@ Status ShardReader::GetLabelsFromBinaryFile(int shard_id, const std::vector> *labels_ptr) { RETURN_UNEXPECTED_IF_NULL(labels_ptr); std::string file_name = file_paths_[shard_id]; - auto realpath = FileUtils::GetRealPath(file_name.data()); + auto realpath = FileUtils::GetRealPath(file_name.c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file: " + file_name); diff --git a/mindspore/ccsrc/minddata/mindrecord/io/shard_writer.cc b/mindspore/ccsrc/minddata/mindrecord/io/shard_writer.cc index c4a4be449e3..0b10e5e1a3a 100644 --- a/mindspore/ccsrc/minddata/mindrecord/io/shard_writer.cc +++ b/mindspore/ccsrc/minddata/mindrecord/io/shard_writer.cc @@ -54,7 +54,7 @@ Status ShardWriter::GetFullPathFromFileName(const std::vector &path dir = "."; } - auto realpath = FileUtils::GetRealPath(dir.value().data()); + auto realpath = FileUtils::GetRealPath(dir.value().c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid dir, failed to get the realpath of mindrecord file dir. Please check path: " + dir.value()); @@ -77,7 +77,7 @@ Status ShardWriter::OpenDataFiles(bool append, bool overwrite) { dir = "."; } - auto realpath = FileUtils::GetRealPath(dir.value().data()); + auto realpath = FileUtils::GetRealPath(dir.value().c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file: " + file); @@ -518,7 +518,7 @@ Status ShardWriter::LockWriter(bool parallel_writer, std::unique_ptr *fd_pt // Open files file_streams_.clear(); for (const auto &file : file_paths_) { - auto realpath = FileUtils::GetRealPath(file.data()); + auto realpath = FileUtils::GetRealPath(file.c_str()); if (!realpath.has_value()) { close(fd); RETURN_STATUS_UNEXPECTED("[Internal ERROR] Failed to get real path, path: " + file); diff --git a/mindspore/ccsrc/minddata/mindrecord/meta/shard_header.cc b/mindspore/ccsrc/minddata/mindrecord/meta/shard_header.cc index 49dc95a4971..61efce025bf 100644 --- a/mindspore/ccsrc/minddata/mindrecord/meta/shard_header.cc +++ b/mindspore/ccsrc/minddata/mindrecord/meta/shard_header.cc @@ -60,7 +60,7 @@ Status ShardHeader::InitializeHeader(const std::vector &headers, bool load } Status ShardHeader::CheckFileStatus(const std::string &path) { - auto realpath = FileUtils::GetRealPath(path.data()); + auto realpath = FileUtils::GetRealPath(path.c_str()); CHECK_FAIL_RETURN_UNEXPECTED( realpath.has_value(), "Invalid file, failed to get the realpath of mindrecord files. Please check file path: " + path); @@ -92,7 +92,7 @@ Status ShardHeader::ValidateHeader(const std::string &path, std::shared_ptr