From 6f040d3d22ce6f491b77b9612a9ff67c0c6db1d9 Mon Sep 17 00:00:00 2001 From: badaix Date: Thu, 4 Apr 2024 19:02:45 +0200 Subject: [PATCH] Cleanup Snapserver includes --- client/browseZeroConf/browse_bonjour.cpp | 12 ++++---- server/config.cpp | 7 ++++- server/config.hpp | 19 ++++++------- server/control_server.cpp | 9 ++---- server/control_session_tcp.hpp | 10 ++----- server/control_session_ws.hpp | 10 ++----- server/encoder/encoder.hpp | 7 ++--- server/encoder/encoder_factory.cpp | 6 ++-- server/encoder/encoder_factory.hpp | 27 +++++++++++++++--- server/encoder/flac_encoder.cpp | 15 ++++++++-- server/encoder/flac_encoder.hpp | 17 +++++------ server/encoder/null_encoder.cpp | 5 +++- server/encoder/null_encoder.hpp | 8 +++--- server/encoder/ogg_encoder.cpp | 14 +++++---- server/encoder/ogg_encoder.hpp | 12 ++++---- server/encoder/opus_encoder.cpp | 6 +++- server/encoder/opus_encoder.hpp | 33 +++++++++++----------- server/encoder/pcm_encoder.cpp | 5 ++++ server/encoder/pcm_encoder.hpp | 8 +++--- server/image_cache.hpp | 10 ++----- server/publishZeroConf/publish_avahi.cpp | 4 +-- server/publishZeroConf/publish_avahi.hpp | 10 ++----- server/publishZeroConf/publish_bonjour.hpp | 15 ++++------ server/publishZeroConf/publish_mdns.hpp | 8 ++---- server/stream_session.cpp | 4 +-- server/stream_session_tcp.hpp | 10 ++----- server/stream_session_ws.hpp | 12 +++----- server/streamreader/airplay_stream.hpp | 6 ++-- server/streamreader/alsa_stream.hpp | 6 ++-- server/streamreader/asio_stream.hpp | 7 ++--- server/streamreader/base64.cpp | 1 + server/streamreader/base64.h | 5 ++-- server/streamreader/control_error.cpp | 4 ++- server/streamreader/file_stream.hpp | 6 ++-- server/streamreader/librespot_stream.hpp | 8 ++---- server/streamreader/meta_stream.cpp | 3 +- server/streamreader/meta_stream.hpp | 6 ++-- server/streamreader/metadata.cpp | 10 ++++++- server/streamreader/metadata.hpp | 14 ++++----- server/streamreader/pcm_stream.hpp | 7 ++--- server/streamreader/pipe_stream.hpp | 6 ++-- server/streamreader/process_stream.cpp | 2 -- server/streamreader/process_stream.hpp | 7 ++--- server/streamreader/properties.cpp | 10 ++++++- server/streamreader/properties.hpp | 11 ++------ server/streamreader/stream_control.cpp | 5 +--- server/streamreader/stream_control.hpp | 9 ++---- server/streamreader/stream_manager.cpp | 2 -- server/streamreader/stream_manager.hpp | 8 ++---- server/streamreader/stream_uri.cpp | 6 ++-- server/streamreader/stream_uri.hpp | 12 ++++---- server/streamreader/tcp_stream.hpp | 6 ++-- server/streamreader/watchdog.hpp | 9 ++---- 53 files changed, 234 insertions(+), 245 deletions(-) diff --git a/client/browseZeroConf/browse_bonjour.cpp b/client/browseZeroConf/browse_bonjour.cpp index 6886f462..43520baf 100644 --- a/client/browseZeroConf/browse_bonjour.cpp +++ b/client/browseZeroConf/browse_bonjour.cpp @@ -202,12 +202,12 @@ bool BrowseBonjour::browse(const string& serviceName, mDNSResult& result, int /* service.get(), 0, 0, serviceName.c_str(), "local.", [](DNSServiceRef /*service*/, DNSServiceFlags /*flags*/, uint32_t /*interfaceIndex*/, DNSServiceErrorType errorCode, const char* serviceName, const char* regtype, const char* replyDomain, void* context) - { + { auto replyCollection = static_cast*>(context); CHECKED(errorCode); replyCollection->push_back(mDNSReply{string(serviceName), string(regtype), string(replyDomain)}); - }, + }, &replyCollection)); runService(service); @@ -222,12 +222,12 @@ bool BrowseBonjour::browse(const string& serviceName, mDNSResult& result, int /* service.get(), 0, 0, reply.name.c_str(), reply.regtype.c_str(), reply.domain.c_str(), [](DNSServiceRef /*service*/, DNSServiceFlags /*flags*/, uint32_t /*interfaceIndex*/, DNSServiceErrorType errorCode, const char* /*fullName*/, const char* hosttarget, uint16_t port, uint16_t /*txtLen*/, const unsigned char* /*txtRecord*/, void* context) - { + { auto resultCollection = static_cast*>(context); CHECKED(errorCode); resultCollection->push_back(mDNSResolve{string(hosttarget), ntohs(port)}); - }, + }, &resolveCollection)); runService(service); @@ -245,7 +245,7 @@ bool BrowseBonjour::browse(const string& serviceName, mDNSResult& result, int /* service.get(), kDNSServiceFlagsLongLivedQuery, 0, kDNSServiceProtocol_IPv4, resolve.fullName.c_str(), [](DNSServiceRef /*service*/, DNSServiceFlags /*flags*/, uint32_t interfaceIndex, DNSServiceErrorType /*errorCode*/, const char* hostname, const sockaddr* address, uint32_t /*ttl*/, void* context) - { + { auto result = static_cast(context); result->host = string(hostname); @@ -259,7 +259,7 @@ bool BrowseBonjour::browse(const string& serviceName, mDNSResult& result, int /* else return; result->valid = true; - }, + }, &resultCollection[i++])); } runService(service); diff --git a/server/config.cpp b/server/config.cpp index 2273bc8c..1f450a7c 100644 --- a/server/config.cpp +++ b/server/config.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,11 +16,16 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "config.hpp" + +// local headers #include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/str_compat.hpp" #include "common/utils/file_utils.hpp" + +// standard headers #include #include #include diff --git a/server/config.hpp b/server/config.hpp index d3f4c78d..736bc0f4 100644 --- a/server/config.hpp +++ b/server/config.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,19 +16,21 @@ along with this program. If not, see . ***/ -#ifndef CONFIG_HPP -#define CONFIG_HPP +#pragma once + +// local headers +#include "common/json.hpp" +#include "common/utils.hpp" +#include "common/utils/string_utils.hpp" + +// standard headers #include #include #include #include #include -#include "common/json.hpp" -#include "common/utils.hpp" -#include "common/utils/string_utils.hpp" - namespace strutils = utils::string; using json = nlohmann::json; @@ -404,6 +406,3 @@ private: std::mutex client_mutex_; std::string filename_; }; - - -#endif diff --git a/server/control_server.cpp b/server/control_server.cpp index 0c4f7c6e..03b2db76 100644 --- a/server/control_server.cpp +++ b/server/control_server.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2023 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,19 +21,16 @@ // local headers #include "common/aixlog.hpp" -#include "common/message/time.hpp" -#include "common/snap_exception.hpp" -#include "common/utils.hpp" -#include "config.hpp" +#include "common/json.hpp" #include "control_session_http.hpp" #include "control_session_tcp.hpp" -#include "jsonrpcpp.hpp" // 3rd party headers // standard headers #include + using namespace std; using json = nlohmann::json; diff --git a/server/control_session_tcp.hpp b/server/control_session_tcp.hpp index e9f98208..b27979b1 100644 --- a/server/control_session_tcp.hpp +++ b/server/control_session_tcp.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef CONTROL_SESSION_TCP_HPP -#define CONTROL_SESSION_TCP_HPP +#pragma once + // local headers #include "control_session.hpp" @@ -60,7 +60,3 @@ protected: boost::asio::strand strand_; std::deque messages_; }; - - - -#endif diff --git a/server/control_session_ws.hpp b/server/control_session_ws.hpp index 55df4cba..fa3c4c52 100644 --- a/server/control_session_ws.hpp +++ b/server/control_session_ws.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef CONTROL_SESSION_WS_HPP -#define CONTROL_SESSION_WS_HPP +#pragma once + // local headers #include "control_session.hpp" @@ -73,7 +73,3 @@ protected: boost::asio::strand strand_; std::deque messages_; }; - - - -#endif diff --git a/server/encoder/encoder.hpp b/server/encoder/encoder.hpp index 19ceca9c..a5bdf9c6 100644 --- a/server/encoder/encoder.hpp +++ b/server/encoder/encoder.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2023 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,7 @@ along with this program. If not, see . ***/ -#ifndef ENCODER_HPP -#define ENCODER_HPP +#pragma once // local headers #include "common/message/codec_header.hpp" @@ -91,5 +90,3 @@ protected: }; } // namespace encoder - -#endif diff --git a/server/encoder/encoder_factory.cpp b/server/encoder/encoder_factory.cpp index 0e73a2ed..cdcbd156 100644 --- a/server/encoder/encoder_factory.cpp +++ b/server/encoder/encoder_factory.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,10 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "encoder_factory.hpp" + +// local headers #include "null_encoder.hpp" #include "pcm_encoder.hpp" #if defined(HAS_OGG) && defined(HAS_VORBIS) && defined(HAS_VORBIS_ENC) @@ -28,7 +31,6 @@ #if defined(HAS_OPUS) #include "opus_encoder.hpp" #endif -#include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/utils/string_utils.hpp" diff --git a/server/encoder/encoder_factory.hpp b/server/encoder/encoder_factory.hpp index 127bb3fa..f4f6e056 100644 --- a/server/encoder/encoder_factory.hpp +++ b/server/encoder/encoder_factory.hpp @@ -1,10 +1,31 @@ -#ifndef ENCODER_FACTORY_H -#define ENCODER_FACTORY_H +/*** + This file is part of snapcast + Copyright (C) 2014-2024 Johannes Pohl + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +***/ + +#pragma once + +// local headers #include "encoder.hpp" + +// standard headers #include #include + namespace encoder { @@ -16,5 +37,3 @@ public: }; } // namespace encoder - -#endif diff --git a/server/encoder/flac_encoder.cpp b/server/encoder/flac_encoder.cpp index ad1d2700..01d14583 100644 --- a/server/encoder/flac_encoder.cpp +++ b/server/encoder/flac_encoder.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,12 +16,21 @@ along with this program. If not, see . ***/ -#include +// prototype/interface header file +#include "flac_encoder.hpp" + +// local headers #include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/str_compat.hpp" -#include "flac_encoder.hpp" + +// 3rd party headers +#include "FLAC/metadata.h" + +// standard headers +#include + using namespace std; diff --git a/server/encoder/flac_encoder.hpp b/server/encoder/flac_encoder.hpp index 65ec2ac6..2a9a5a23 100644 --- a/server/encoder/flac_encoder.hpp +++ b/server/encoder/flac_encoder.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2020 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,16 +16,19 @@ along with this program. If not, see . ***/ -#ifndef FLAC_ENCODER_HPP -#define FLAC_ENCODER_HPP +#pragma once + +// local headers #include "encoder.hpp" + +// 3rd party headers +#include "FLAC/stream_encoder.h" + +// standard headers #include #include #include -#include "FLAC/metadata.h" -#include "FLAC/stream_encoder.h" - namespace encoder { @@ -56,5 +59,3 @@ protected: }; } // namespace encoder - -#endif diff --git a/server/encoder/null_encoder.cpp b/server/encoder/null_encoder.cpp index 591caf1b..1730a0f2 100644 --- a/server/encoder/null_encoder.cpp +++ b/server/encoder/null_encoder.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2020 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,10 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "null_encoder.hpp" + +// local headers #include "common/aixlog.hpp" diff --git a/server/encoder/null_encoder.hpp b/server/encoder/null_encoder.hpp index f39214ba..b55204e7 100644 --- a/server/encoder/null_encoder.hpp +++ b/server/encoder/null_encoder.hpp @@ -16,10 +16,12 @@ along with this program. If not, see . ***/ -#ifndef NULL_ENCODER_HPP -#define NULL_ENCODER_HPP +#pragma once + +// local headers #include "encoder.hpp" + namespace encoder { @@ -44,5 +46,3 @@ protected: }; } // namespace encoder - -#endif diff --git a/server/encoder/ogg_encoder.cpp b/server/encoder/ogg_encoder.cpp index dd8d1caf..5df32886 100644 --- a/server/encoder/ogg_encoder.cpp +++ b/server/encoder/ogg_encoder.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,15 +16,19 @@ along with this program. If not, see . ***/ -#include -#include +// prototype/interface header file +#include "ogg_encoder.hpp" +// local headers #include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/str_compat.hpp" -#include "common/utils.hpp" #include "common/utils/string_utils.hpp" -#include "ogg_encoder.hpp" + +// standard headers +#include +#include + using namespace std; diff --git a/server/encoder/ogg_encoder.hpp b/server/encoder/ogg_encoder.hpp index cad231f6..c1fe6b3b 100644 --- a/server/encoder/ogg_encoder.hpp +++ b/server/encoder/ogg_encoder.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2020 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,12 +16,16 @@ along with this program. If not, see . ***/ -#ifndef OGG_ENCODER_HPP -#define OGG_ENCODER_HPP +#pragma once + +// local headers #include "encoder.hpp" + +// 3rd party headers #include #include + namespace encoder { @@ -54,5 +58,3 @@ private: }; } // namespace encoder - -#endif diff --git a/server/encoder/opus_encoder.cpp b/server/encoder/opus_encoder.cpp index 7046f3f6..9a97fb81 100644 --- a/server/encoder/opus_encoder.cpp +++ b/server/encoder/opus_encoder.cpp @@ -1,7 +1,7 @@ /*** This file is part of snapcast Copyright (C) 2015 Hannes Ellinger - Copyright (C) 2016-2021 Johannes Pohl + Copyright (C) 2016-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,12 +17,16 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "opus_encoder.hpp" + +// local headers #include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/str_compat.hpp" #include "common/utils/string_utils.hpp" + using namespace std; namespace encoder diff --git a/server/encoder/opus_encoder.hpp b/server/encoder/opus_encoder.hpp index 24c59f54..446da4c7 100644 --- a/server/encoder/opus_encoder.hpp +++ b/server/encoder/opus_encoder.hpp @@ -1,26 +1,29 @@ /*** - This file is part of snapcast - Copyright (C) 2015 Hannes Ellinger + This file is part of snapcast + Copyright (C) 2015 Hannes Ellinger + Copyright (C) 2016-2024 Johannes Pohl - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . ***/ -#ifndef OPUS_ENCODER_HPP -#define OPUS_ENCODER_HPP +#pragma once +// local headers #include "common/resampler.hpp" #include "encoder.hpp" + +// 3rd party headers #include @@ -49,5 +52,3 @@ protected: }; } // namespace encoder - -#endif diff --git a/server/encoder/pcm_encoder.cpp b/server/encoder/pcm_encoder.cpp index 3e1171db..676dd585 100644 --- a/server/encoder/pcm_encoder.cpp +++ b/server/encoder/pcm_encoder.cpp @@ -16,9 +16,14 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "pcm_encoder.hpp" + +// local headers #include "common/aixlog.hpp" #include "common/endian.hpp" + +// standard headers #include diff --git a/server/encoder/pcm_encoder.hpp b/server/encoder/pcm_encoder.hpp index 8a32acc1..0aa975f5 100644 --- a/server/encoder/pcm_encoder.hpp +++ b/server/encoder/pcm_encoder.hpp @@ -16,10 +16,12 @@ along with this program. If not, see . ***/ -#ifndef PCM_ENCODER_HPP -#define PCM_ENCODER_HPP +#pragma once + +// local headers #include "encoder.hpp" + namespace encoder { @@ -35,5 +37,3 @@ protected: }; } // namespace encoder - -#endif diff --git a/server/image_cache.hpp b/server/image_cache.hpp index 07a5cf3f..06a576b0 100644 --- a/server/image_cache.hpp +++ b/server/image_cache.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,7 @@ along with this program. If not, see . ***/ -#ifndef IMAGE_CACHE_HPP -#define IMAGE_CACHE_HPP +#pragma once // 3rd party headers @@ -25,11 +24,9 @@ #include // standard headers -#include #include #include #include -#include #include @@ -95,6 +92,3 @@ private: std::map url_to_data_; std::mutex mutex_; }; - - -#endif diff --git a/server/publishZeroConf/publish_avahi.cpp b/server/publishZeroConf/publish_avahi.cpp index 65253b05..3734da1b 100644 --- a/server/publishZeroConf/publish_avahi.cpp +++ b/server/publishZeroConf/publish_avahi.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,8 +25,6 @@ // 3rd party headers // standard headers -#include -#include static constexpr auto LOG_TAG = "Avahi"; diff --git a/server/publishZeroConf/publish_avahi.hpp b/server/publishZeroConf/publish_avahi.hpp index 8a8e2dfd..70e21ec0 100644 --- a/server/publishZeroConf/publish_avahi.hpp +++ b/server/publishZeroConf/publish_avahi.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +16,8 @@ along with this program. If not, see . ***/ +#pragma once -#ifndef PUBLISH_AVAHI_HPP -#define PUBLISH_AVAHI_HPP // local headers @@ -33,10 +32,10 @@ #include // standard headers -#include #include #include + class PublishAvahi; #include "publish_mdns.hpp" @@ -57,6 +56,3 @@ private: std::vector services_; boost::asio::steady_timer timer_; }; - - -#endif diff --git a/server/publishZeroConf/publish_bonjour.hpp b/server/publishZeroConf/publish_bonjour.hpp index 8d2c6c17..6000eff4 100644 --- a/server/publishZeroConf/publish_bonjour.hpp +++ b/server/publishZeroConf/publish_bonjour.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,9 +16,12 @@ along with this program. If not, see . ***/ +#pragma once -#ifndef PUBLISH_BONJOUR_HPP -#define PUBLISH_BONJOUR_HPP +class PublishBonjour; + +// local headers +#include "publish_mdns.hpp" // 3rd party headers #include @@ -27,9 +30,6 @@ #include #include -class PublishBonjour; - -#include "publish_mdns.hpp" class PublishBonjour : public PublishmDNS { @@ -44,6 +44,3 @@ private: std::atomic active_; std::vector clients; }; - - -#endif diff --git a/server/publishZeroConf/publish_mdns.hpp b/server/publishZeroConf/publish_mdns.hpp index 565847b6..3791c610 100644 --- a/server/publishZeroConf/publish_mdns.hpp +++ b/server/publishZeroConf/publish_mdns.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef PUBLISH_MDNS_HPP -#define PUBLISH_MDNS_HPP +#pragma once + // 3rd party headers #include @@ -61,5 +61,3 @@ using PublishZeroConf = PublishAvahi; #include "publish_bonjour.hpp" using PublishZeroConf = PublishBonjour; #endif - -#endif diff --git a/server/stream_session.cpp b/server/stream_session.cpp index 0dea9c78..013c147e 100644 --- a/server/stream_session.cpp +++ b/server/stream_session.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2023 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,13 +21,13 @@ // local headers #include "common/aixlog.hpp" -#include "common/message/pcm_chunk.hpp" // 3rd party headers // standard headers #include + using namespace std; using namespace streamreader; diff --git a/server/stream_session_tcp.hpp b/server/stream_session_tcp.hpp index b53675de..798bf301 100644 --- a/server/stream_session_tcp.hpp +++ b/server/stream_session_tcp.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef STREAM_SESSION_TCP_HPP -#define STREAM_SESSION_TCP_HPP +#pragma once + // local headers #include "stream_session.hpp" @@ -53,7 +53,3 @@ protected: private: tcp::socket socket_; }; - - - -#endif diff --git a/server/stream_session_ws.hpp b/server/stream_session_ws.hpp index 1e65bf2a..bac85244 100644 --- a/server/stream_session_ws.hpp +++ b/server/stream_session_ws.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef STREAM_SESSION_WS_HPP -#define STREAM_SESSION_WS_HPP +#pragma once + // local headers #include "stream_session.hpp" @@ -35,7 +35,7 @@ #include // standard headers -#include + namespace beast = boost::beast; // from // namespace http = beast::http; // from @@ -69,7 +69,3 @@ protected: protected: beast::flat_buffer buffer_; }; - - - -#endif diff --git a/server/streamreader/airplay_stream.hpp b/server/streamreader/airplay_stream.hpp index 3c10e4ee..192374e6 100644 --- a/server/streamreader/airplay_stream.hpp +++ b/server/streamreader/airplay_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef AIRPLAY_STREAM_HPP -#define AIRPLAY_STREAM_HPP +#pragma once + // local headers #include "process_stream.hpp" @@ -107,5 +107,3 @@ private: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/alsa_stream.hpp b/server/streamreader/alsa_stream.hpp index 12ed8b88..79a8a489 100644 --- a/server/streamreader/alsa_stream.hpp +++ b/server/streamreader/alsa_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef ALSA_STREAM_HPP -#define ALSA_STREAM_HPP +#pragma once + // local headers #include "pcm_stream.hpp" @@ -68,5 +68,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/asio_stream.hpp b/server/streamreader/asio_stream.hpp index 0ea7af03..8215d2de 100644 --- a/server/streamreader/asio_stream.hpp +++ b/server/streamreader/asio_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef ASIO_STREAM_HPP -#define ASIO_STREAM_HPP +#pragma once + // local headers #include "common/aixlog.hpp" @@ -30,7 +30,6 @@ #include // standard headers -#include namespace streamreader @@ -268,5 +267,3 @@ void AsioStream::do_read() } } // namespace streamreader - -#endif diff --git a/server/streamreader/base64.cpp b/server/streamreader/base64.cpp index 608bacc8..6245dcb7 100644 --- a/server/streamreader/base64.cpp +++ b/server/streamreader/base64.cpp @@ -24,6 +24,7 @@ René Nyffenegger rene.nyffenegger@adp-gmbh.ch */ + #include "base64.h" static const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" diff --git a/server/streamreader/base64.h b/server/streamreader/base64.h index f453c441..2444a04b 100644 --- a/server/streamreader/base64.h +++ b/server/streamreader/base64.h @@ -16,10 +16,9 @@ along with this program. If not, see . ***/ -#ifndef BASE64_H -#define BASE64_H +#pragma once + #include std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); std::string base64_decode(std::string const& encoded_string); -#endif diff --git a/server/streamreader/control_error.cpp b/server/streamreader/control_error.cpp index 2a9ac8e0..df101765 100644 --- a/server/streamreader/control_error.cpp +++ b/server/streamreader/control_error.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,10 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "control_error.hpp" + namespace snapcast::error::control { diff --git a/server/streamreader/file_stream.hpp b/server/streamreader/file_stream.hpp index 87e0d067..243fceb8 100644 --- a/server/streamreader/file_stream.hpp +++ b/server/streamreader/file_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef FILE_STREAM_HPP -#define FILE_STREAM_HPP +#pragma once + // local headers #include "asio_stream.hpp" @@ -44,5 +44,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/librespot_stream.hpp b/server/streamreader/librespot_stream.hpp index 2f10090d..68bd95a2 100644 --- a/server/streamreader/librespot_stream.hpp +++ b/server/streamreader/librespot_stream.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef SPOTIFY_STREAM_HPP -#define SPOTIFY_STREAM_HPP +#pragma once + // local headers #include "process_stream.hpp" @@ -48,5 +48,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/meta_stream.cpp b/server/streamreader/meta_stream.cpp index dfbb8ffb..e36beffd 100644 --- a/server/streamreader/meta_stream.cpp +++ b/server/streamreader/meta_stream.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/utils/string_utils.hpp" -#include "encoder/encoder_factory.hpp" using namespace std; diff --git a/server/streamreader/meta_stream.hpp b/server/streamreader/meta_stream.hpp index e5287beb..c87ed140 100644 --- a/server/streamreader/meta_stream.hpp +++ b/server/streamreader/meta_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef META_STREAM_HPP -#define META_STREAM_HPP +#pragma once + // local headers #include "common/resampler.hpp" @@ -84,5 +84,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/metadata.cpp b/server/streamreader/metadata.cpp index 873b505e..3cf433f6 100644 --- a/server/streamreader/metadata.cpp +++ b/server/streamreader/metadata.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,16 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "metadata.hpp" +// local headers +#include "common/aixlog.hpp" + +// standard headers +#include + + static constexpr auto LOG_TAG = "Metadata"; diff --git a/server/streamreader/metadata.hpp b/server/streamreader/metadata.hpp index 59d1b431..85299a68 100644 --- a/server/streamreader/metadata.hpp +++ b/server/streamreader/metadata.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,16 +16,17 @@ along with this program. If not, see . ***/ -#ifndef METADATA_HPP -#define METADATA_HPP +#pragma once -#include "common/aixlog.hpp" + +// local headers #include "common/json.hpp" +// standard headers #include -#include #include + using json = nlohmann::json; class Metadata @@ -145,6 +146,3 @@ public: void fromJson(const json& j); bool operator==(const Metadata& other) const; }; - - -#endif diff --git a/server/streamreader/pcm_stream.hpp b/server/streamreader/pcm_stream.hpp index 45191da6..0f0802fd 100644 --- a/server/streamreader/pcm_stream.hpp +++ b/server/streamreader/pcm_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef PCM_STREAM_HPP -#define PCM_STREAM_HPP +#pragma once + // local headers #include "common/error_code.hpp" @@ -207,7 +207,4 @@ protected: std::vector silent_chunk_; }; - } // namespace streamreader - -#endif diff --git a/server/streamreader/pipe_stream.hpp b/server/streamreader/pipe_stream.hpp index c1959292..75339ce2 100644 --- a/server/streamreader/pipe_stream.hpp +++ b/server/streamreader/pipe_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef PIPE_STREAM_HPP -#define PIPE_STREAM_HPP +#pragma once + // local headers #include "asio_stream.hpp" @@ -45,5 +45,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/process_stream.cpp b/server/streamreader/process_stream.cpp index 8b07a881..8037a460 100644 --- a/server/streamreader/process_stream.cpp +++ b/server/streamreader/process_stream.cpp @@ -25,10 +25,8 @@ #include "common/snap_exception.hpp" #include "common/utils.hpp" #include "common/utils/file_utils.hpp" -#include "common/utils/string_utils.hpp" // standard headers -#include #include diff --git a/server/streamreader/process_stream.hpp b/server/streamreader/process_stream.hpp index 97ac7090..e4210357 100644 --- a/server/streamreader/process_stream.hpp +++ b/server/streamreader/process_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef PROCESS_STREAM_HPP -#define PROCESS_STREAM_HPP +#pragma once + // local headers #include "asio_stream.hpp" @@ -26,7 +26,6 @@ // standard headers #include #include -#include namespace bp = boost::process; @@ -78,5 +77,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/properties.cpp b/server/streamreader/properties.cpp index 0df3924a..d4a36dce 100644 --- a/server/streamreader/properties.cpp +++ b/server/streamreader/properties.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,16 @@ along with this program. If not, see . ***/ +// prototype/interface header file #include "properties.hpp" +// local headers +#include "common/aixlog.hpp" + +// standard headers +#include + + static constexpr auto LOG_TAG = "Properties"; namespace diff --git a/server/streamreader/properties.hpp b/server/streamreader/properties.hpp index 881b68e2..aa8f4415 100644 --- a/server/streamreader/properties.hpp +++ b/server/streamreader/properties.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2021 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,17 +16,15 @@ along with this program. If not, see . ***/ -#ifndef PROPERTIES_HPP -#define PROPERTIES_HPP +#pragma once + // local headers -#include "common/aixlog.hpp" #include "common/json.hpp" #include "metadata.hpp" // standard headers #include -#include #include @@ -191,6 +189,3 @@ public: void fromJson(const json& j); bool operator==(const Properties& other) const; }; - - -#endif diff --git a/server/streamreader/stream_control.cpp b/server/streamreader/stream_control.cpp index 525018b8..7aebe50b 100644 --- a/server/streamreader/stream_control.cpp +++ b/server/streamreader/stream_control.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,10 +22,7 @@ // local headers #include "common/aixlog.hpp" #include "common/snap_exception.hpp" -#include "common/str_compat.hpp" #include "common/utils/file_utils.hpp" -#include "common/utils/string_utils.hpp" -#include "encoder/encoder_factory.hpp" // 3rd party headers #include diff --git a/server/streamreader/stream_control.hpp b/server/streamreader/stream_control.hpp index d36617a2..7a9389c9 100644 --- a/server/streamreader/stream_control.hpp +++ b/server/streamreader/stream_control.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef STREAM_CONTROL_HPP -#define STREAM_CONTROL_HPP +#pragma once + // local headers #include "jsonrpcpp.hpp" @@ -111,7 +111,4 @@ protected: bp::opstream in_; }; - } // namespace streamreader - -#endif diff --git a/server/streamreader/stream_manager.cpp b/server/streamreader/stream_manager.cpp index 05fb6534..961b87ba 100644 --- a/server/streamreader/stream_manager.cpp +++ b/server/streamreader/stream_manager.cpp @@ -24,10 +24,8 @@ #ifdef HAS_ALSA #include "alsa_stream.hpp" #endif -#include "common/aixlog.hpp" #include "common/snap_exception.hpp" #include "common/str_compat.hpp" -#include "common/utils.hpp" #include "file_stream.hpp" #include "librespot_stream.hpp" #include "meta_stream.hpp" diff --git a/server/streamreader/stream_manager.hpp b/server/streamreader/stream_manager.hpp index e82bf6b8..04681f00 100644 --- a/server/streamreader/stream_manager.hpp +++ b/server/streamreader/stream_manager.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef STREAM_MANAGER_HPP -#define STREAM_MANAGER_HPP +#pragma once + // local headers #include "pcm_stream.hpp" @@ -59,5 +59,3 @@ private: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/stream_uri.cpp b/server/streamreader/stream_uri.cpp index 88afd0e8..d5da4c84 100644 --- a/server/streamreader/stream_uri.cpp +++ b/server/streamreader/stream_uri.cpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2020 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,9 +20,11 @@ #define NOMINMAX #endif // NOMINMAX +// prototype/interface header file #include "stream_uri.hpp" + +// local headers #include "common/aixlog.hpp" -#include "common/str_compat.hpp" #include "common/utils/string_utils.hpp" diff --git a/server/streamreader/stream_uri.hpp b/server/streamreader/stream_uri.hpp index bc4fd97a..bd08b3e3 100644 --- a/server/streamreader/stream_uri.hpp +++ b/server/streamreader/stream_uri.hpp @@ -16,14 +16,16 @@ along with this program. If not, see . ***/ -#ifndef STREAM_URI_HPP -#define STREAM_URI_HPP +#pragma once + +// local headers +#include "common/json.hpp" + +// standard headers #include #include -#include "common/json.hpp" - using json = nlohmann::json; @@ -59,5 +61,3 @@ struct StreamUri }; } // namespace streamreader - -#endif diff --git a/server/streamreader/tcp_stream.hpp b/server/streamreader/tcp_stream.hpp index 9a9b1b8b..d1c19e6b 100644 --- a/server/streamreader/tcp_stream.hpp +++ b/server/streamreader/tcp_stream.hpp @@ -16,8 +16,8 @@ along with this program. If not, see . ***/ -#ifndef TCP_STREAM_HPP -#define TCP_STREAM_HPP +#pragma once + // local headers #include "asio_stream.hpp" @@ -53,5 +53,3 @@ protected: }; } // namespace streamreader - -#endif diff --git a/server/streamreader/watchdog.hpp b/server/streamreader/watchdog.hpp index a6eefe2e..d5cf4163 100644 --- a/server/streamreader/watchdog.hpp +++ b/server/streamreader/watchdog.hpp @@ -1,6 +1,6 @@ /*** This file is part of snapcast - Copyright (C) 2014-2022 Johannes Pohl + Copyright (C) 2014-2024 Johannes Pohl This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,15 +16,14 @@ along with this program. If not, see . ***/ -#ifndef WATCH_DOG_HPP -#define WATCH_DOG_HPP +#pragma once + // 3rd party headers #include #include // standard headers -#include namespace streamreader @@ -58,5 +57,3 @@ private: }; } // namespace streamreader - -#endif