From cc2e643d6ec3025db3fb6f0a4c1f77af05cf1026 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 11 Dec 2022 11:39:07 +0200 Subject: [PATCH] Include the matching header first in .cpp files This avoids accidentally using transitively included headers. --- source/http/client.cpp | 2 +- source/http/formdata.cpp | 2 +- source/http/header.cpp | 2 +- source/http/message.cpp | 2 +- source/http/request.cpp | 2 +- source/http/response.cpp | 2 +- source/http/server.cpp | 2 +- source/http/utils.cpp | 2 +- source/http/version.cpp | 2 +- source/net/clientsocket.cpp | 2 +- source/net/communicator.cpp | 2 +- source/net/constants.cpp | 2 +- source/net/datagramsocket.cpp | 2 +- source/net/inet.cpp | 2 +- source/net/inet6.cpp | 2 +- source/net/protocol.cpp | 2 +- source/net/resolve.cpp | 4 ++-- source/net/serversocket.cpp | 2 +- source/net/sockaddr.cpp | 1 + source/net/socket.cpp | 2 +- source/net/streamserversocket.cpp | 2 +- source/net/streamsocket.cpp | 2 +- source/net/unix/socket.cpp | 4 ++-- source/net/unix/unix.cpp | 4 ++-- source/net/windows/socket.cpp | 4 ++-- source/net/windows/unix.cpp | 4 ++-- 26 files changed, 31 insertions(+), 30 deletions(-) diff --git a/source/http/client.cpp b/source/http/client.cpp index e8790aa..1c4c953 100644 --- a/source/http/client.cpp +++ b/source/http/client.cpp @@ -1,7 +1,7 @@ +#include "client.h" #include #include #include -#include "client.h" #include "request.h" #include "response.h" diff --git a/source/http/formdata.cpp b/source/http/formdata.cpp index 4ec3f88..4f2b7b3 100644 --- a/source/http/formdata.cpp +++ b/source/http/formdata.cpp @@ -1,9 +1,9 @@ +#include "formdata.h" #include #include "header.h" #include "request.h" #include "submessage.h" #include "utils.h" -#include "formdata.h" using namespace std; diff --git a/source/http/header.cpp b/source/http/header.cpp index b55223e..a112e91 100644 --- a/source/http/header.cpp +++ b/source/http/header.cpp @@ -1,6 +1,6 @@ +#include "header.h" #include #include -#include "header.h" #include "message.h" using namespace std; diff --git a/source/http/message.cpp b/source/http/message.cpp index 4f17017..a6ab465 100644 --- a/source/http/message.cpp +++ b/source/http/message.cpp @@ -1,8 +1,8 @@ +#include "message.h" #include #include #include #include -#include "message.h" using namespace std; diff --git a/source/http/request.cpp b/source/http/request.cpp index 15056d6..437b8ba 100644 --- a/source/http/request.cpp +++ b/source/http/request.cpp @@ -1,7 +1,7 @@ +#include "request.h" #include #include #include -#include "request.h" #include "utils.h" using namespace std; diff --git a/source/http/response.cpp b/source/http/response.cpp index 6fa4cc3..6005d35 100644 --- a/source/http/response.cpp +++ b/source/http/response.cpp @@ -1,6 +1,6 @@ +#include "response.h" #include #include -#include "response.h" using namespace std; diff --git a/source/http/server.cpp b/source/http/server.cpp index 066fabe..9c9a876 100644 --- a/source/http/server.cpp +++ b/source/http/server.cpp @@ -1,3 +1,4 @@ +#include "server.h" #include #include #include @@ -9,7 +10,6 @@ #include #include "request.h" #include "response.h" -#include "server.h" using namespace std; diff --git a/source/http/utils.cpp b/source/http/utils.cpp index 8662c2e..8aa966c 100644 --- a/source/http/utils.cpp +++ b/source/http/utils.cpp @@ -1,8 +1,8 @@ +#include "utils.h" #include #include #include #include -#include "utils.h" using namespace std; diff --git a/source/http/version.cpp b/source/http/version.cpp index c9fd1c9..d6f846c 100644 --- a/source/http/version.cpp +++ b/source/http/version.cpp @@ -1,7 +1,7 @@ +#include "version.h" #include #include #include -#include "version.h" using namespace std; diff --git a/source/net/clientsocket.cpp b/source/net/clientsocket.cpp index e6e10e9..fbbd241 100644 --- a/source/net/clientsocket.cpp +++ b/source/net/clientsocket.cpp @@ -1,6 +1,6 @@ #include "platform_api.h" -#include #include "clientsocket.h" +#include #include "socket_private.h" namespace Msp { diff --git a/source/net/communicator.cpp b/source/net/communicator.cpp index 3ac62d7..51202b5 100644 --- a/source/net/communicator.cpp +++ b/source/net/communicator.cpp @@ -1,5 +1,5 @@ -#include #include "communicator.h" +#include #include "streamsocket.h" using namespace std; diff --git a/source/net/constants.cpp b/source/net/constants.cpp index 5088e51..4de22b4 100644 --- a/source/net/constants.cpp +++ b/source/net/constants.cpp @@ -1,6 +1,6 @@ -#include #include "platform_api.h" #include "constants.h" +#include using namespace std; diff --git a/source/net/datagramsocket.cpp b/source/net/datagramsocket.cpp index 7ee057f..5493554 100644 --- a/source/net/datagramsocket.cpp +++ b/source/net/datagramsocket.cpp @@ -1,8 +1,8 @@ #include "platform_api.h" +#include "datagramsocket.h" #include #include #include -#include "datagramsocket.h" #include "sockaddr_private.h" #include "socket_private.h" diff --git a/source/net/inet.cpp b/source/net/inet.cpp index dbbd12d..f44b1c0 100644 --- a/source/net/inet.cpp +++ b/source/net/inet.cpp @@ -1,6 +1,6 @@ #include "platform_api.h" -#include #include "inet.h" +#include #include "sockaddr_private.h" using namespace std; diff --git a/source/net/inet6.cpp b/source/net/inet6.cpp index 8ddf1d5..7580058 100644 --- a/source/net/inet6.cpp +++ b/source/net/inet6.cpp @@ -1,6 +1,6 @@ +#include "inet6.h" #include "platform_api.h" #include -#include "inet6.h" #include "sockaddr_private.h" using namespace std; diff --git a/source/net/protocol.cpp b/source/net/protocol.cpp index 402b84a..63cc6f1 100644 --- a/source/net/protocol.cpp +++ b/source/net/protocol.cpp @@ -1,9 +1,9 @@ +#include "protocol.h" #include #include #include #include #include -#include "protocol.h" using namespace std; diff --git a/source/net/resolve.cpp b/source/net/resolve.cpp index 078d6ef..9ec5395 100644 --- a/source/net/resolve.cpp +++ b/source/net/resolve.cpp @@ -1,9 +1,9 @@ -#include "platform_api.h" +#include "resolve.h" #include #include +#include "platform_api.h" #include "sockaddr_private.h" #include "socket.h" -#include "resolve.h" using namespace std; diff --git a/source/net/serversocket.cpp b/source/net/serversocket.cpp index 01fa445..66876c5 100644 --- a/source/net/serversocket.cpp +++ b/source/net/serversocket.cpp @@ -1,5 +1,5 @@ -#include #include "serversocket.h" +#include using namespace std; diff --git a/source/net/sockaddr.cpp b/source/net/sockaddr.cpp index 36e9c68..6ac9189 100644 --- a/source/net/sockaddr.cpp +++ b/source/net/sockaddr.cpp @@ -1,3 +1,4 @@ +#include "sockaddr.h" #include #include "platform_api.h" #include "inet.h" diff --git a/source/net/socket.cpp b/source/net/socket.cpp index 877c1da..84db637 100644 --- a/source/net/socket.cpp +++ b/source/net/socket.cpp @@ -1,8 +1,8 @@ #include "platform_api.h" +#include "socket.h" #include #include #include "sockaddr_private.h" -#include "socket.h" #include "socket_private.h" using namespace std; diff --git a/source/net/streamserversocket.cpp b/source/net/streamserversocket.cpp index b91491d..8e655fc 100644 --- a/source/net/streamserversocket.cpp +++ b/source/net/streamserversocket.cpp @@ -1,11 +1,11 @@ #include "platform_api.h" +#include "streamserversocket.h" #include #include #include #include #include "sockaddr_private.h" #include "socket_private.h" -#include "streamserversocket.h" #include "streamsocket.h" using namespace std; diff --git a/source/net/streamsocket.cpp b/source/net/streamsocket.cpp index 02a7b54..9e2d79a 100644 --- a/source/net/streamsocket.cpp +++ b/source/net/streamsocket.cpp @@ -1,11 +1,11 @@ #include "platform_api.h" +#include "streamsocket.h" #include #include #include #include #include "sockaddr_private.h" #include "socket_private.h" -#include "streamsocket.h" namespace Msp { namespace Net { diff --git a/source/net/unix/socket.cpp b/source/net/unix/socket.cpp index b8cc580..d87cdd3 100644 --- a/source/net/unix/socket.cpp +++ b/source/net/unix/socket.cpp @@ -1,12 +1,12 @@ +#include "platform_api.h" +#include "socket.h" #include #include #include -#include "platform_api.h" #include #include #include #include "sockaddr_private.h" -#include "socket.h" #include "socket_private.h" using namespace std; diff --git a/source/net/unix/unix.cpp b/source/net/unix/unix.cpp index eba7fb6..648d53a 100644 --- a/source/net/unix/unix.cpp +++ b/source/net/unix/unix.cpp @@ -1,8 +1,8 @@ +#include "platform_api.h" +#include "unix.h" #include #include -#include "platform_api.h" #include "sockaddr_private.h" -#include "unix.h" using namespace std; diff --git a/source/net/windows/socket.cpp b/source/net/windows/socket.cpp index dfcff62..07db95d 100644 --- a/source/net/windows/socket.cpp +++ b/source/net/windows/socket.cpp @@ -1,9 +1,9 @@ -#include #include "platform_api.h" +#include "socket.h" +#include #include #include #include "sockaddr_private.h" -#include "socket.h" #include "socket_private.h" using namespace std; diff --git a/source/net/windows/unix.cpp b/source/net/windows/unix.cpp index 6a56ee0..b38a258 100644 --- a/source/net/windows/unix.cpp +++ b/source/net/windows/unix.cpp @@ -1,7 +1,7 @@ -#include #include "platform_api.h" -#include "sockaddr_private.h" #include "unix.h" +#include +#include "sockaddr_private.h" using namespace std; -- 2.43.0