From: Amos Jeffries <> Date: Mon, 3 Apr 2017 07:22:32 +0000 (+1200) Subject: Cleanup: convert class Client to C++11 initialization X-Git-Tag: M-staged-PR71~205 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2272542f5e6256479e15d54df432fc730e8dc35;p=thirdparty%2Fsquid.git Cleanup: convert class Client to C++11 initialization --- diff --git a/src/clients/Client.cc b/src/clients/Client.cc index 4f5e8ba620..24a3b9bf33 100644 --- a/src/clients/Client.cc +++ b/src/clients/Client.cc @@ -37,26 +37,13 @@ // implemented in client_side_reply.cc until sides have a common parent void purgeEntriesByUrl(HttpRequest * req, const char *url); -Client::Client(FwdState *theFwdState): AsyncJob("Client"), - completed(false), - currentOffset(0), - responseBodyBuffer(NULL), +Client::Client(FwdState *theFwdState) : + AsyncJob("Client"), fwd(theFwdState), - requestSender(NULL), -#if USE_ADAPTATION - adaptedHeadSource(NULL), - adaptationAccessCheckPending(false), - startedAdaptation(false), -#endif - receivedWholeRequestBody(false), - doneWithFwd(nullptr), - theVirginReply(NULL), - theFinalReply(NULL) + request(fwd->request) { entry = fwd->entry; entry->lock("Client"); - - request = fwd->request; } Client::~Client() diff --git a/src/clients/Client.h b/src/clients/Client.h index d6f1548a92..36ca27cd7a 100644 --- a/src/clients/Client.h +++ b/src/clients/Client.h @@ -83,7 +83,7 @@ public: // should be protected private: void serverComplete2(); /**< Continuation of serverComplete */ - bool completed; /**< serverComplete() has been called */ + bool completed = false; /**< serverComplete() has been called */ protected: // kids customize these @@ -157,11 +157,11 @@ protected: void adjustBodyBytesRead(const int64_t delta); // These should be private - int64_t currentOffset; /**< Our current offset in the StoreEntry */ - MemBuf *responseBodyBuffer; /**< Data temporarily buffered for ICAP */ + int64_t currentOffset = 0; /**< Our current offset in the StoreEntry */ + MemBuf *responseBodyBuffer = nullptr; /**< Data temporarily buffered for ICAP */ public: // should not be - StoreEntry *entry; + StoreEntry *entry = nullptr; FwdState::Pointer fwd; HttpRequestPointer request; @@ -174,21 +174,21 @@ protected: CbcPointer adaptedHeadSource; /**< to get adapted response headers */ BodyPipe::Pointer adaptedBodySource; /**< to consume adated response body */ - bool adaptationAccessCheckPending; - bool startedAdaptation; + bool adaptationAccessCheckPending = false; + bool startedAdaptation = false; #endif - bool receivedWholeRequestBody; ///< handleRequestBodyProductionEnded called + bool receivedWholeRequestBody = false; ///< handleRequestBodyProductionEnded called /// whether we should not be talking to FwdState; XXX: clear fwd instead /// points to a string literal which is used only for debugging - const char *doneWithFwd; + const char *doneWithFwd = nullptr; private: void sendBodyIsTooLargeError(); void maybePurgeOthers(); - HttpReply *theVirginReply; /**< reply received from the origin server */ - HttpReply *theFinalReply; /**< adapted reply from ICAP or virgin reply */ + HttpReply *theVirginReply = nullptr; /**< reply received from the origin server */ + HttpReply *theFinalReply = nullptr; /**< adapted reply from ICAP or virgin reply */ }; #endif /* SQUID_SRC_CLIENTS_CLIENT_H */