diff --git a/dali/operators/reader/loader/discover_files_s3.cc b/dali/operators/reader/loader/discover_files_s3.cc index 314beba273e..a22f4991327 100644 --- a/dali/operators/reader/loader/discover_files_s3.cc +++ b/dali/operators/reader/loader/discover_files_s3.cc @@ -54,8 +54,8 @@ std::vector s3_discover_files(const std::string &file_root, assert(path_elems >= 2); if (path_elems > 2) return; // we only look at one subdir level - auto subdir = *(p.begin()); - auto fname = *(++p.begin()); + const auto& subdir = p.begin()->native(); + const auto& fname = (++p.begin())->native(); bool subdir_ok = opts.dir_filters.empty(); bool fname_ok = opts.file_filters.empty(); for (auto &filter : opts.dir_filters) { diff --git a/dali/util/file.cc b/dali/util/file.cc index e9a6ccb3891..1cc729daddb 100644 --- a/dali/util/file.cc +++ b/dali/util/file.cc @@ -32,6 +32,10 @@ std::unique_ptr FileStream::Open(const std::string& uri, FileStream: bool is_s3 = uri.rfind("s3://", 0) == 0; if (is_s3) { #if AWSSDK_ENABLED + if (opts.use_mmap) + throw std::invalid_argument("use_mmap not supported"); + if (opts.use_odirect) + throw std::invalid_argument("use_odirect not supported"); return std::make_unique(S3ClientManager::Instance().client(), uri, size); #else throw std::runtime_error("This version of DALI was not built with AWS S3 storage support."); diff --git a/dali/util/s3_client_manager.h b/dali/util/s3_client_manager.h index 210f6ee4cb1..4b931883b93 100644 --- a/dali/util/s3_client_manager.h +++ b/dali/util/s3_client_manager.h @@ -45,10 +45,9 @@ struct S3ClientManager { private: // Documentation says: - // 1) Please call this from the same thread from which InitAPI() has been called (use a dedicated - // thread - // if necessary). This avoids problems in initializing the dependent Common RunTime C - // libraries. + // Please call this from the same thread from which InitAPI() has been called (use a dedicated + // thread if necessary). This avoids problems in initializing the dependent Common RunTime C + // libraries. static void RunInitOrShutdown(std::function work) { static ThreadPool s_thread_pool_(1, 0, false, "S3ClientManager"); s_thread_pool_.AddWork(std::move(work));