diff options
author | Pixel <pixel@nobis-crew.org> | 2013-01-22 08:29:55 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2013-01-22 08:29:55 -0800 |
commit | f40de21e5666be6fa456fedc60584bd672d12c44 (patch) | |
tree | b80497de619e661e246725b1cebcd68533d4e237 /includes | |
parent | 107d87dc983f34e4ff23a4db188baa650ac51f98 (diff) |
Removing some more cruft.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/BStream.h | 6 | ||||
-rw-r--r-- | includes/Buffer.h | 8 | ||||
-rw-r--r-- | includes/Exceptions.h | 6 | ||||
-rw-r--r-- | includes/Handle.h | 15 | ||||
-rw-r--r-- | includes/HttpServer.h | 8 | ||||
-rw-r--r-- | includes/Local.h | 4 | ||||
-rw-r--r-- | includes/LuaTask.h | 3 | ||||
-rw-r--r-- | includes/Main.h | 3 | ||||
-rw-r--r-- | includes/Printer.h | 3 | ||||
-rw-r--r-- | includes/SimpleMustache.h | 9 | ||||
-rw-r--r-- | includes/Socket.h | 7 | ||||
-rw-r--r-- | includes/Task.h | 14 |
12 files changed, 59 insertions, 27 deletions
diff --git a/includes/BStream.h b/includes/BStream.h index d412782..2fa842e 100644 --- a/includes/BStream.h +++ b/includes/BStream.h @@ -20,13 +20,13 @@ class BStream : public Handle { void detach() { m_detached = true; } private: IO<Handle> m_h; - uint8_t * m_buffer; + uint8_t * m_buffer = NULL; size_t m_availBytes = 0; size_t m_cursor = 0; String m_name; bool m_passThru = false; - bool m_detached; - bool m_closed; + bool m_detached = false; + bool m_closed = false; }; }; diff --git a/includes/Buffer.h b/includes/Buffer.h index 6577c64..a903ec9 100644 --- a/includes/Buffer.h +++ b/includes/Buffer.h @@ -7,7 +7,7 @@ namespace Balau { class Buffer : public SeekableHandle { public: Buffer(const uint8_t * buffer, size_t s) : m_buffer(const_cast<uint8_t *>(buffer)), m_bufSize(s), m_fromConst(true) { } - Buffer() throw (GeneralException) : m_buffer(NULL), m_fromConst(false), m_bufSize(0), m_numBlocks(0) { } + Buffer() throw (GeneralException) { } virtual ~Buffer(); virtual void close() throw (GeneralException); virtual ssize_t read(void * buf, size_t count) throw (GeneralException); @@ -22,9 +22,9 @@ class Buffer : public SeekableHandle { void reset(); void rewind() { rseek(0); wseek(0); } private: - uint8_t * m_buffer; - bool m_fromConst; - off_t m_bufSize, m_numBlocks; + uint8_t * m_buffer = NULL; + bool m_fromConst = false; + off_t m_bufSize = 0, m_numBlocks = 0; }; }; diff --git a/includes/Exceptions.h b/includes/Exceptions.h index 962a869..2d452cc 100644 --- a/includes/Exceptions.h +++ b/includes/Exceptions.h @@ -34,13 +34,13 @@ class GeneralException { const std::vector<String> getTrace() const { return m_trace; } protected: - GeneralException() : m_msg(NULL), m_details(NULL) { } + GeneralException() { } void setMsg(char * msg) { if (m_msg) free(m_msg); m_msg = msg; } void genTrace(); private: - mutable char * m_msg; - char * m_details; + mutable char * m_msg = NULL; + char * m_details = NULL; std::vector<String> m_trace; void setDetails(const char * details) { diff --git a/includes/Handle.h b/includes/Handle.h index e12fab7..f501ab1 100644 --- a/includes/Handle.h +++ b/includes/Handle.h @@ -59,7 +59,7 @@ class Handle { ssize_t forceWrite(const String & str) { return forceWrite(str.to_charp(), str.strlen()); } uint8_t readU8() { uint8_t r; read(&r, 1); return r; } protected: - Handle() : m_refCount(0) { } + Handle() { } private: void addRef() { Atomic::Increment(&m_refCount); } void delRef() { @@ -73,7 +73,7 @@ class Handle { template<class T> friend class IO; - volatile int m_refCount; + volatile int m_refCount = 0; Handle(const Handle &) = delete; Handle & operator=(const Handle &) = delete; @@ -87,17 +87,17 @@ class HPrinter : public Handle { virtual bool canWrite() { return true; } virtual const char * getName() { return "HPrinter"; } virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) { - Printer::print("%s", (const char *) buf); + Printer::print("%*s", (int) count, (const char *) buf); return count; } }; class IOBase { - protected: - IOBase() : m_h(NULL) { } + private: + IOBase() { } ~IOBase() { if (m_h) m_h->delRef(); } void setHandle(Handle * h) { m_h = h; if (m_h) m_h->addRef(); } - Handle * m_h; + Handle * m_h = NULL; template<class T> friend class IO; }; @@ -108,8 +108,11 @@ class IO : public IOBase { IO() { } IO(T * h) { setHandle(h); } IO(const IO<T> & io) { if (io.m_h) setHandle(io.m_h); } + IO(IO<T> && io) { m_h = io.m_h; io.m_h = NULL; } template<class U> IO(const IO<U> & io) { if (io.m_h) setHandle(io.m_h); } + template<class U> + IO(IO<U> && io) { m_h = io.m_h; io.m_h = NULL; } template<class U> bool isA() { return !!dynamic_cast<U *>(m_h); } template<class U> diff --git a/includes/HttpServer.h b/includes/HttpServer.h index 6c28910..55950cb 100644 --- a/includes/HttpServer.h +++ b/includes/HttpServer.h @@ -39,6 +39,9 @@ class HttpServer { String m_type; std::list<String> m_extraHeaders; bool m_flushed; + + Response(const Response &) = delete; + Response & operator=(const Response &) = delete; }; class Action { @@ -56,6 +59,8 @@ class HttpServer { private: const Regex m_regex, m_host; volatile int m_refCount; + Action(const Action &) = delete; + Action & operator=(const Action &) = delete; }; HttpServer() : m_started(false), m_listenerPtr(NULL), m_port(80) { } @@ -82,6 +87,9 @@ class HttpServer { RWLock m_actionsLock; friend class HttpWorker; + + HttpServer(const HttpServer &) = delete; + HttpServer & operator=(const HttpServer &) = delete; }; }; diff --git a/includes/Local.h b/includes/Local.h index 9221384..d009de7 100644 --- a/includes/Local.h +++ b/includes/Local.h @@ -6,8 +6,12 @@ namespace Balau { class TLSManager { public: + TLSManager() { } virtual void * getTLS(); virtual void * setTLS(void * val); + private: + TLSManager(const TLSManager &) = delete; + TLSManager & operator=(const TLSManager &) = delete; }; class PThreadsTLSManager : public TLSManager { diff --git a/includes/LuaTask.h b/includes/LuaTask.h index 9c495e8..50226cd 100644 --- a/includes/LuaTask.h +++ b/includes/LuaTask.h @@ -24,6 +24,9 @@ class LuaExecCell { bool m_detached = false; bool m_gotError = false; friend class LuaTask; + + LuaExecCell(const LuaExecCell &) = delete; + LuaExecCell & operator=(const LuaExecCell &) = delete; }; class LuaExecString : public LuaExecCell { diff --git a/includes/Main.h b/includes/Main.h index 49afd35..10a27b7 100644 --- a/includes/Main.h +++ b/includes/Main.h @@ -43,6 +43,9 @@ class Main { private: Status m_status; static Main * s_application; + + Main(const Main &) = delete; + Main & operator=(const Main &) = delete; }; }; diff --git a/includes/Printer.h b/includes/Printer.h index 8fd3674..cc9be2c 100644 --- a/includes/Printer.h +++ b/includes/Printer.h @@ -77,6 +77,9 @@ class Printer { private: uint32_t m_verbosity = M_STATUS | M_WARNING | M_ERROR | M_ENGINE_DEBUG; bool m_detailledLogs = false; + + Printer(const Printer &) = delete; + Printer & operator=(const Printer &) = delete; }; }; diff --git a/includes/SimpleMustache.h b/includes/SimpleMustache.h index 28cb477..b01955b 100644 --- a/includes/SimpleMustache.h +++ b/includes/SimpleMustache.h @@ -17,7 +17,7 @@ class SimpleMustache { Context & operator[](const char * str); private: Proxy(Context * parent, ssize_t idx) : m_parent(parent), m_idx(idx) { } - Context * m_parent; + Context * m_parent = NULL; ssize_t m_idx; friend class Context; }; @@ -71,6 +71,9 @@ class SimpleMustache { friend class Proxy; friend class SimpleMustache; + + Context(const Context &) = delete; + Context & operator=(const Context &) = delete; }; void setTemplate(IO<Handle> h); @@ -87,6 +90,7 @@ class SimpleMustache { void render(IO<Handle> h, Context * ctx) const { AAssert(ctx, "Please pass on a context to render"); render_r(h, ctx, "", m_fragments.begin(), false, -1); } void empty() { while (!m_fragments.empty()) { delete m_fragments.front(); m_fragments.pop_front(); } } void checkTemplate() { Fragments::const_iterator end = checkTemplate_r(m_fragments.begin()); AAssert(end == m_fragments.end(), "The template wasn't fully checked; possibly mismatched sections"); } + SimpleMustache() { } ~SimpleMustache() { empty(); } private: struct Fragment { @@ -108,6 +112,9 @@ class SimpleMustache { static String escape(const String & s); Fragments::const_iterator checkTemplate_r(Fragments::const_iterator begin, const String & endSection = "") const; + + SimpleMustache(const SimpleMustache &) = delete; + SimpleMustache & operator=(const SimpleMustache &) = delete; }; }; diff --git a/includes/Socket.h b/includes/Socket.h index 7972cb5..00dc2b4 100644 --- a/includes/Socket.h +++ b/includes/Socket.h @@ -19,7 +19,6 @@ struct DNSRequest; class Socket : public Handle { public: - Socket() throw (GeneralException); virtual void close() throw (GeneralException); virtual ssize_t read(void * buf, size_t count) throw (GeneralException); @@ -49,7 +48,7 @@ class Socket : public Handle { virtual void gotOwner(Task * task); ev::io m_evt; - Task * m_task; + Task * m_task = NULL; }; int m_fd; @@ -77,8 +76,8 @@ class ListenerBase : public StacklessTask { Events::Async m_evt; volatile bool m_stop; String m_local; - int m_port; - void * m_opaque; + int m_port = 0; + void * m_opaque = NULL; }; template<class Worker> diff --git a/includes/Task.h b/includes/Task.h index cb69ca3..6b9eff0 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -192,21 +192,23 @@ class Task { void switchTo(); static void CALLBACK coroutineTrampoline(void *); void coroutine(); - void * m_stack; + void * m_stack = NULL; #ifndef _WIN32 coro_context m_ctx; #else - void * m_fiber; + void * m_fiber = NULL; #endif - TaskMan * m_taskMan; - Status m_status; - void * m_tls; + TaskMan * m_taskMan = NULL; + Status m_status = STARTING; + void * m_tls = NULL; friend class TaskMan; friend class Events::TaskEvent; Lock m_eventLock; typedef std::list<Events::TaskEvent *> waitedByList_t; waitedByList_t m_waitedBy; - bool m_okayToEAgain, m_stackless; + bool m_okayToEAgain = false, m_stackless = false; + Task(const Task &) = delete; + Task & operator=(const Task &) = delete; }; class QueueBase { |