diff --git a/Project/GNU/CLI/Makefile.am b/Project/GNU/CLI/Makefile.am index 5aebbf84..18eeec38 100644 --- a/Project/GNU/CLI/Makefile.am +++ b/Project/GNU/CLI/Makefile.am @@ -46,7 +46,7 @@ mediaconch_SOURCES = \ ../../../Source/Checker/Checker.cpp \ ../../../Source/Checker/Path.cpp \ ../../../Source/IMSC1/IMSC1Plugin.cpp \ - ../../../Source/ThirdParty/tfsxml/tfsxml.c + ../../../Source/ThirdParty/tfsxml/tfsxml.cpp #mediaconch_LDFLAGS = -no-undefined -version-info 0:0:0 mediaconch_CPPFLAGS = $(XML_CFLAGS) diff --git a/Project/GNU/Library/Makefile.am b/Project/GNU/Library/Makefile.am index 8d17ba85..aca178f4 100644 --- a/Project/GNU/Library/Makefile.am +++ b/Project/GNU/Library/Makefile.am @@ -43,7 +43,7 @@ lib@MediaConchLib_LibName@_la_SOURCES = \ ../../../Source/Checker/Checker.cpp \ ../../../Source/Checker/Path.cpp \ ../../../Source/IMSC1/IMSC1Plugin.cpp \ - ../../../Source/ThirdParty/tfsxml/tfsxml.c + ../../../Source/ThirdParty/tfsxml/tfsxml.cpp #lib@MediaConchLib_LibName@includedir = $(includedir)/MediaConch #lib@MediaConchLib_LibName@include_HEADERS = \ diff --git a/Project/GNU/Server/Makefile.am b/Project/GNU/Server/Makefile.am index 557ae496..cca67e58 100644 --- a/Project/GNU/Server/Makefile.am +++ b/Project/GNU/Server/Makefile.am @@ -45,7 +45,7 @@ mediaconchd_SOURCES = \ ../../../Source/Checker/Checker.cpp \ ../../../Source/Checker/Path.cpp \ ../../../Source/IMSC1/IMSC1Plugin.cpp \ - ../../../Source/ThirdParty/tfsxml/tfsxml.c + ../../../Source/ThirdParty/tfsxml/tfsxml.cpp #mediaconchd_LDFLAGS = -no-undefined -version-info 0:0:0 mediaconchd_CPPFLAGS = $(XML_CFLAGS) diff --git a/Project/MSVC2015/CLI/MediaConch.vcxproj b/Project/MSVC2015/CLI/MediaConch.vcxproj index f2c68ec6..a356cc74 100644 --- a/Project/MSVC2015/CLI/MediaConch.vcxproj +++ b/Project/MSVC2015/CLI/MediaConch.vcxproj @@ -186,7 +186,7 @@ - + diff --git a/Project/MSVC2015/GUI/MediaConch_GUI.vcxproj b/Project/MSVC2015/GUI/MediaConch_GUI.vcxproj index acf21e22..58d5b03b 100644 --- a/Project/MSVC2015/GUI/MediaConch_GUI.vcxproj +++ b/Project/MSVC2015/GUI/MediaConch_GUI.vcxproj @@ -229,7 +229,7 @@ - + diff --git a/Project/MSVC2015/Server/MediaConch-Server.vcxproj b/Project/MSVC2015/Server/MediaConch-Server.vcxproj index 3d3b4370..0e6fe2db 100644 --- a/Project/MSVC2015/Server/MediaConch-Server.vcxproj +++ b/Project/MSVC2015/Server/MediaConch-Server.vcxproj @@ -180,7 +180,7 @@ - + diff --git a/Project/MSVC2017/CLI/MediaConch.vcxproj b/Project/MSVC2017/CLI/MediaConch.vcxproj index b5540528..cd3708b8 100644 --- a/Project/MSVC2017/CLI/MediaConch.vcxproj +++ b/Project/MSVC2017/CLI/MediaConch.vcxproj @@ -186,7 +186,7 @@ - + diff --git a/Project/MSVC2017/GUI/MediaConch_GUI.vcxproj b/Project/MSVC2017/GUI/MediaConch_GUI.vcxproj index aa6aa62a..634ec60f 100644 --- a/Project/MSVC2017/GUI/MediaConch_GUI.vcxproj +++ b/Project/MSVC2017/GUI/MediaConch_GUI.vcxproj @@ -229,7 +229,7 @@ - + diff --git a/Project/MSVC2017/Server/MediaConch-Server.vcxproj b/Project/MSVC2017/Server/MediaConch-Server.vcxproj index 04a3db3e..d0a286e9 100644 --- a/Project/MSVC2017/Server/MediaConch-Server.vcxproj +++ b/Project/MSVC2017/Server/MediaConch-Server.vcxproj @@ -180,7 +180,7 @@ - + diff --git a/Project/MSVC2019/CLI/MediaConch.vcxproj b/Project/MSVC2019/CLI/MediaConch.vcxproj index abb2daea..b430cc0b 100644 --- a/Project/MSVC2019/CLI/MediaConch.vcxproj +++ b/Project/MSVC2019/CLI/MediaConch.vcxproj @@ -186,7 +186,7 @@ - + diff --git a/Project/MSVC2019/GUI/MediaConch_GUI.vcxproj b/Project/MSVC2019/GUI/MediaConch_GUI.vcxproj index 04b3d818..3a3e1c81 100644 --- a/Project/MSVC2019/GUI/MediaConch_GUI.vcxproj +++ b/Project/MSVC2019/GUI/MediaConch_GUI.vcxproj @@ -229,7 +229,7 @@ - + diff --git a/Project/MSVC2019/Server/MediaConch-Server.vcxproj b/Project/MSVC2019/Server/MediaConch-Server.vcxproj index 692eb2fc..b6ab6bed 100644 --- a/Project/MSVC2019/Server/MediaConch-Server.vcxproj +++ b/Project/MSVC2019/Server/MediaConch-Server.vcxproj @@ -180,7 +180,7 @@ - + diff --git a/Project/Qt/MediaConch.pro b/Project/Qt/MediaConch.pro index 62c7bffa..57f90d94 100644 --- a/Project/Qt/MediaConch.pro +++ b/Project/Qt/MediaConch.pro @@ -94,7 +94,7 @@ SOURCES += ../../Source/Common/MediaConchLib.cpp \ ../../Source/Checker/Checker.cpp \ ../../Source/Checker/Path.cpp \ ../../Source/IMSC1/IMSC1Plugin.cpp \ - ../../Source/ThirdParty/tfsxml/tfsxml.c \ + ../../Source/ThirdParty/tfsxml/tfsxml.cpp \ ../../Source/GUI/Qt/main.cpp \ ../../Source/GUI/Qt/commonwebwindow.cpp \ ../../Source/GUI/Qt/helpwindow.cpp \ diff --git a/Source/Checker/Checker.cpp b/Source/Checker/Checker.cpp index 4980ef5d..fcc2a34e 100644 --- a/Source/Checker/Checker.cpp +++ b/Source/Checker/Checker.cpp @@ -20,6 +20,9 @@ #include #include +//--------------------------------------------------------------------------- +using namespace tfsxml; + //TODO: mmt //TODO: reference_file diff --git a/Source/Checker/Checker.h b/Source/Checker/Checker.h index 4d0ef971..9fb3289b 100644 --- a/Source/Checker/Checker.h +++ b/Source/Checker/Checker.h @@ -16,6 +16,9 @@ //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- +#ifndef TFSXML_NAMESPACE + #define TFSXML_NAMESPACE 1 +#endif // TFSXML_NAMESPACEs #include "ThirdParty/tfsxml/tfsxml.h" #include "Path.h" @@ -124,9 +127,9 @@ class PolicyChecker size_t fail_count; }; - RuleElement* parse_rule(tfsxml_string& tfsxml_priv); - PolicyElement* parse_policy(tfsxml_string& tfsxml_priv); - void parse_node(tfsxml_string& tfsxml_priv, std::vector rules, size_t level); + RuleElement* parse_rule(tfsxml::tfsxml_string& tfsxml_priv); + PolicyElement* parse_policy(tfsxml::tfsxml_string& tfsxml_priv); + void parse_node(tfsxml::tfsxml_string& tfsxml_priv, std::vector rules, size_t level); std::vector policies; std::vector rules; diff --git a/Source/Checker/Path.cpp b/Source/Checker/Path.cpp index dfd61978..c527c586 100644 --- a/Source/Checker/Path.cpp +++ b/Source/Checker/Path.cpp @@ -17,6 +17,9 @@ //--------------------------------------------------------------------------- #include "Path.h" +//--------------------------------------------------------------------------- +using namespace tfsxml; + //--------------------------------------------------------------------------- namespace MediaConch { diff --git a/Source/Checker/Path.h b/Source/Checker/Path.h index f531fa05..6948cb62 100644 --- a/Source/Checker/Path.h +++ b/Source/Checker/Path.h @@ -16,6 +16,9 @@ //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- +#ifndef TFSXML_NAMESPACE + #define TFSXML_NAMESPACE 1 +#endif // TFSXML_NAMESPACE #include "ThirdParty/tfsxml/tfsxml.h" #include @@ -39,7 +42,7 @@ struct PathElement }; std::vector parse_path(const std::string& xpath); -bool path_is_matching(tfsxml_string& tfsxml_priv, tfsxml_string& node, PathElement path, size_t& occurrence); +bool path_is_matching(tfsxml::tfsxml_string& tfsxml_priv, tfsxml::tfsxml_string& node, PathElement path, size_t& occurrence); } #endif diff --git a/Source/ThirdParty/tfsxml/tfsxml.cpp b/Source/ThirdParty/tfsxml/tfsxml.cpp new file mode 100644 index 00000000..6bf3603c --- /dev/null +++ b/Source/ThirdParty/tfsxml/tfsxml.cpp @@ -0,0 +1,26 @@ +/* Copyright (c) MediaArea.net SARL. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +(zlib license) + +*/ +#include "tfsxml.h" + +namespace tfsxml { + #include "tfsxml.c" +} diff --git a/Source/ThirdParty/tfsxml/tfsxml.h b/Source/ThirdParty/tfsxml/tfsxml.h index 39e2655b..5f30b2f8 100644 --- a/Source/ThirdParty/tfsxml/tfsxml.h +++ b/Source/ThirdParty/tfsxml/tfsxml.h @@ -5,10 +5,13 @@ #ifndef TFSXML_H #define TFSXML_H -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(TFSXML_NAMESPACE) extern "C" { -#endif /* __cplusplus */ +#elif defined(__cplusplus) && defined(TFSXML_NAMESPACE) +namespace tfsxml +{ +#endif /* defined(__cplusplus) && !defined(TFSXML_NAMESPACE) */ /** ------------------------------------------------------------------------- Splitting of the XML content in blocks @@ -130,9 +133,9 @@ int tfsxml_strcmp_charp(tfsxml_string a, const char* b); */ tfsxml_string tfsxml_strstr_charp(tfsxml_string a, const char* b); -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(TFSXML_NAMESPACE) } -#endif /* __cplusplus */ +#endif /* defined(__cplusplus) && !defined(TFSXML_NAMESPACE) */ #ifdef __cplusplus #include @@ -155,5 +158,9 @@ static std::string tfsxml_decode(const tfsxml_string& b) { std::string s; tfsxml #endif /* __cplusplus */ +#if defined(__cplusplus) && defined(TFSXML_NAMESPACE) +} +#endif /* defined(__cplusplus) && defined(TFSXML_NAMESPACE) */ + #endif