提交 53fbab5d 编写于 作者: D dongdaxiang

add fs_local_open example

上级 afaf9370
...@@ -63,15 +63,14 @@ static std::shared_ptr<FILE> fs_open_internal(const std::string& path, ...@@ -63,15 +63,14 @@ static std::shared_ptr<FILE> fs_open_internal(const std::string& path,
if (buffer_size > 0) { if (buffer_size > 0) {
char* buffer = new char[buffer_size]; char* buffer = new char[buffer_size];
CHECK_EQ(0, setvbuf(&*fp, buffer, _IOFBF, buffer_size)); CHECK_EQ(0, setvbuf(&*fp, buffer, _IOFBF, buffer_size));
fp = {&*fp, fp = {&*fp, [fp, buffer](FILE*) mutable { // NOLINT
[ fp, buffer ] reinterpret_cast<FILE*> mutable {CHECK(fp.unique()); CHECK(fp.unique()); // NOLINT
fp = nullptr; fp = nullptr;
delete[] buffer; delete[] buffer;
}};
} }
};
}
return fp; return fp;
} }
static bool fs_begin_with_internal(const std::string& path, static bool fs_begin_with_internal(const std::string& path,
......
...@@ -41,9 +41,9 @@ std::shared_ptr<FILE> shell_fopen(const std::string& path, ...@@ -41,9 +41,9 @@ std::shared_ptr<FILE> shell_fopen(const std::string& path,
// Mostly copy from CPython code // Mostly copy from CPython code
static int close_open_fds_internal() { static int close_open_fds_internal() {
struct linux_dirent { struct linux_dirent {
int64 d_ino = 0; long d_ino = 0; // NOLINT
off_t d_off; off_t d_off;
uint16 d_reclen = 0; unsigned short d_reclen = 0; // NOLINT
char d_name[256]; char d_name[256];
}; };
......
...@@ -95,7 +95,7 @@ template <typename T> ...@@ -95,7 +95,7 @@ template <typename T>
bool PrivateQueueDataFeed<T>::Start() { bool PrivateQueueDataFeed<T>::Start() {
CheckSetFileList(); CheckSetFileList();
std::string filename; std::string filename;
while (PickOneFile(&filename)) { if (PickOneFile(&filename)) {
int err_no = 0; int err_no = 0;
std::string pipeline_cmd = "cat"; std::string pipeline_cmd = "cat";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册