C++11 tidying.
authorCarl Hetherington <cth@carlh.net>
Fri, 11 Mar 2022 18:44:04 +0000 (19:44 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Aug 2022 16:22:58 +0000 (18:22 +0200)
src/lib/dcpomatic_socket.cc

index a92a294e6a05668dfa9ad10d8f982f85680a588d..f4292e842d5375e3944953954ebc7803305bc697 100644 (file)
 
 */
 
-#include "dcpomatic_socket.h"
+
 #include "compose.hpp"
-#include "exceptions.h"
 #include "dcpomatic_assert.h"
+#include "dcpomatic_socket.h"
+#include "exceptions.h"
 #include <boost/bind/bind.hpp>
 #include <boost/lambda/lambda.hpp>
 #include <iostream>
 
 #include "i18n.h"
 
+
 using std::shared_ptr;
 using std::weak_ptr;
 
+
 /** @param timeout Timeout in seconds */
 Socket::Socket (int timeout)
        : _deadline (_io_service)
@@ -52,6 +55,7 @@ Socket::check ()
        _deadline.async_wait (boost::bind (&Socket::check, this));
 }
 
+
 /** Blocking connect.
  *  @param endpoint End-point to connect to.
  */
@@ -74,6 +78,7 @@ Socket::connect (boost::asio::ip::tcp::endpoint endpoint)
        }
 }
 
+
 /** Blocking write.
  *  @param data Buffer to write.
  *  @param size Number of bytes to write.
@@ -99,6 +104,7 @@ Socket::write (uint8_t const * data, int size)
        }
 }
 
+
 void
 Socket::write (uint32_t v)
 {
@@ -106,6 +112,7 @@ Socket::write (uint32_t v)
        write (reinterpret_cast<uint8_t*> (&v), 4);
 }
 
+
 /** Blocking read.
  *  @param data Buffer to read to.
  *  @param size Number of bytes to read.
@@ -131,6 +138,7 @@ Socket::read (uint8_t* data, int size)
        }
 }
 
+
 uint32_t
 Socket::read_uint32 ()
 {
@@ -147,6 +155,7 @@ Socket::start_read_digest ()
        _read_digester.reset (new Digester());
 }
 
+
 void
 Socket::start_write_digest ()
 {
@@ -165,7 +174,7 @@ Socket::ReadDigestScope::ReadDigestScope (shared_ptr<Socket> socket)
 bool
 Socket::ReadDigestScope::check ()
 {
-       shared_ptr<Socket> sp = _socket.lock ();
+       auto sp = _socket.lock ();
        if (!sp) {
                return false;
        }
@@ -183,7 +192,7 @@ Socket::WriteDigestScope::WriteDigestScope (shared_ptr<Socket> socket)
 
 Socket::WriteDigestScope::~WriteDigestScope ()
 {
-       shared_ptr<Socket> sp = _socket.lock ();
+       auto sp = _socket.lock ();
        if (sp) {
                try {
                        sp->finish_write_digest ();
@@ -216,6 +225,7 @@ Socket::check_read_digest ()
        return memcmp(ref, actual, size) == 0;
 }
 
+
 void
 Socket::finish_write_digest ()
 {