From 53fbab5d3382bb1e96520fc86f9b1eb714a7ce24 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Fri, 22 Feb 2019 10:07:49 +0800 Subject: [PATCH] add fs_local_open example --- paddle/fluid/framework/common/fs.cc | 13 ++++++------- paddle/fluid/framework/common/shell.cc | 4 ++-- paddle/fluid/framework/data_feed.cc | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/paddle/fluid/framework/common/fs.cc b/paddle/fluid/framework/common/fs.cc index 295b2d3c540..62db2a2bd0b 100644 --- a/paddle/fluid/framework/common/fs.cc +++ b/paddle/fluid/framework/common/fs.cc @@ -63,15 +63,14 @@ static std::shared_ptr fs_open_internal(const std::string& path, if (buffer_size > 0) { char* buffer = new char[buffer_size]; CHECK_EQ(0, setvbuf(&*fp, buffer, _IOFBF, buffer_size)); - fp = {&*fp, - [ fp, buffer ] reinterpret_cast mutable {CHECK(fp.unique()); - fp = nullptr; - delete[] buffer; + fp = {&*fp, [fp, buffer](FILE*) mutable { // NOLINT + CHECK(fp.unique()); // NOLINT + fp = nullptr; + delete[] buffer; + }}; } -}; -} -return fp; + return fp; } static bool fs_begin_with_internal(const std::string& path, diff --git a/paddle/fluid/framework/common/shell.cc b/paddle/fluid/framework/common/shell.cc index 6e423d90719..ff6e828aa15 100644 --- a/paddle/fluid/framework/common/shell.cc +++ b/paddle/fluid/framework/common/shell.cc @@ -41,9 +41,9 @@ std::shared_ptr shell_fopen(const std::string& path, // Mostly copy from CPython code static int close_open_fds_internal() { struct linux_dirent { - int64 d_ino = 0; + long d_ino = 0; // NOLINT off_t d_off; - uint16 d_reclen = 0; + unsigned short d_reclen = 0; // NOLINT char d_name[256]; }; diff --git a/paddle/fluid/framework/data_feed.cc b/paddle/fluid/framework/data_feed.cc index 0703851d204..e37e5965654 100644 --- a/paddle/fluid/framework/data_feed.cc +++ b/paddle/fluid/framework/data_feed.cc @@ -95,7 +95,7 @@ template bool PrivateQueueDataFeed::Start() { CheckSetFileList(); std::string filename; - while (PickOneFile(&filename)) { + if (PickOneFile(&filename)) { int err_no = 0; std::string pipeline_cmd = "cat"; -- GitLab