From a3b15b995e9448e1ed34b1a9d4d168abdf161b6e Mon Sep 17 00:00:00 2001 From: Cheer Xiao Date: Thu, 17 Jan 2013 14:46:02 +0800 Subject: [PATCH] Make io_data_t::io_mode const A protected constructor is needed in io_pipe_t to let io_buffer_t override its io_mode. --- io.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/io.h b/io.h index c9bcd36a3..c463836b2 100644 --- a/io.h +++ b/io.h @@ -30,7 +30,7 @@ protected: public: /** Type of redirect */ - io_mode_t io_mode; + const io_mode_t io_mode; /** FD to redirect */ int fd; @@ -99,6 +99,14 @@ public: class io_pipe_t : public io_data_t { +protected: + io_pipe_t(io_mode_t m, int f, bool i): + io_data_t(m, f), + pipe_fd(), + is_input(i) + { + } + public: int pipe_fd[2]; bool is_input; @@ -120,10 +128,9 @@ private: std::vector *out_buffer; io_buffer_t(int f, bool i): - io_pipe_t(f, i), + io_pipe_t(IO_BUFFER, f, i), out_buffer(new std::vector) { - io_mode = IO_BUFFER; } public: