[vlc-devel] [PATCH 1/5] upnp: fix headers

Shaleen Jain shaleen at jain.sh
Mon Oct 15 10:17:59 CEST 2018


Header files should be self-contained and should not have
to adhere to special conditions or include order to include the header.
Also add a header guard
---
 modules/services_discovery/upnp-wrapper.cpp | 2 --
 modules/services_discovery/upnp-wrapper.hpp | 5 +++++
 modules/services_discovery/upnp.cpp         | 4 ----
 modules/services_discovery/upnp.hpp         | 1 +
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/services_discovery/upnp-wrapper.cpp b/modules/services_discovery/upnp-wrapper.cpp
index 52c942cb3d..6ff748c8b4 100644
--- a/modules/services_discovery/upnp-wrapper.cpp
+++ b/modules/services_discovery/upnp-wrapper.cpp
@@ -28,8 +28,6 @@
 # include "config.h"
 #endif
 
-#include <vlc_common.h>
-
 #ifdef _WIN32
 #include <windows.h>
 #include <wincrypt.h>
diff --git a/modules/services_discovery/upnp-wrapper.hpp b/modules/services_discovery/upnp-wrapper.hpp
index c62749214e..f19031d864 100644
--- a/modules/services_discovery/upnp-wrapper.hpp
+++ b/modules/services_discovery/upnp-wrapper.hpp
@@ -24,6 +24,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifndef UPNP_WRAPPER_H
+#define UPNP_WRAPPER_H
+
+#include <vlc_common.h>
 #include <vlc_charset.h>
 
 #include <memory>
@@ -342,3 +346,4 @@ inline char *getIpv4ForMulticast()
 #endif
 
 #endif /* _WIN32 */
+#endif /* UPNP_WRAPPER_H */
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 200677baa9..2e9decee52 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -28,10 +28,6 @@
 # include "config.h"
 #endif
 
-#include <vlc_common.h>
-#include <vlc_threads.h>
-#include <vlc_cxx_helpers.hpp>
-
 #include "upnp.hpp"
 
 #include <vlc_access.h>
diff --git a/modules/services_discovery/upnp.hpp b/modules/services_discovery/upnp.hpp
index f62e43af0a..8b6f947b9e 100644
--- a/modules/services_discovery/upnp.hpp
+++ b/modules/services_discovery/upnp.hpp
@@ -37,6 +37,7 @@
 #include <vlc_url.h>
 #include <vlc_interrupt.h>
 #include <vlc_threads.h>
+#include <vlc_cxx_helpers.hpp>
 
 namespace SD
 {
-- 
2.19.1


More information about the vlc-devel mailing list