Parcourir la source

[3736] Fixed uninitMemberVar issue reported by cppcheck.

Marcin Siodelski il y a 10 ans
Parent
commit
cbdcd8c31e
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      src/lib/cc/tests/session_unittests.cc

+ 4 - 3
src/lib/cc/tests/session_unittests.cc

@@ -75,7 +75,8 @@ public:
         io_service_(io_service),
         ep_(file),
         acceptor_(io_service_, ep_),
-        socket_(io_service_)
+        socket_(io_service_),
+        data_buf_(1024)
     {
         acceptor_.async_accept(socket_, boost::bind(&TestDomainSocket::acceptHandler,
                                                     _1));
@@ -115,7 +116,7 @@ public:
 
     void setSendLname() {
         // ignore whatever data we get, send back an lname
-        asio::async_read(socket_,  asio::buffer(data_buf, 0),
+        asio::async_read(socket_,  asio::buffer(&data_buf_[0], 0),
                          boost::bind(&TestDomainSocket::sendLname, this));
     }
 
@@ -124,7 +125,7 @@ private:
     asio::local::stream_protocol::endpoint ep_;
     asio::local::stream_protocol::acceptor acceptor_;
     asio::local::stream_protocol::socket socket_;
-    char data_buf[1024];
+    std::vector<char> data_buf_;
 };
 
 /// \brief Pair holding header and data of a message sent over the connection.