From b6de7842b83439af1bcbd728e0e0ac2a139a2f16 Mon Sep 17 00:00:00 2001 From: Matthias Larisch Date: Mon, 23 Nov 2015 20:09:32 +0100 Subject: [PATCH] Use boost::regex instead of std::regex std::regex support is not yet available for older GCC versions. As boost is used anyway, use also the regex component. --- CMakeLists.txt | 2 +- IncomingConnectionValidator.cpp | 10 +++++----- IncomingConnectionValidator.hpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8851b9..5e97295 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(mumsi) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") INCLUDE(FindPkgConfig) -find_package(Boost COMPONENTS system REQUIRED) +find_package(Boost COMPONENTS system regex REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(PJSIP "libpjproject") diff --git a/IncomingConnectionValidator.cpp b/IncomingConnectionValidator.cpp index e47d5dd..7d509a8 100644 --- a/IncomingConnectionValidator.cpp +++ b/IncomingConnectionValidator.cpp @@ -13,16 +13,16 @@ sip::IncomingConnectionValidator::IncomingConnectionValidator(std::string validU for (auto &uri : separateUris) { boost::replace_all(uri, ".", "\\."); boost::replace_all(uri, "*", "\\w*"); - uriRegexVec.push_back(regex(uri)); + uriRegexVec.push_back(boost::regex(uri)); } } bool sip::IncomingConnectionValidator::validateUri(std::string uri) { - regex addressRegex("[\"\\w ]*"); + boost::regex addressRegex("[\"\\w ]*"); - smatch s; + boost::smatch s; - if (not regex_match(uri, s, addressRegex)) { + if (not boost::regex_match(uri, s, addressRegex)) { logger.warn("URI has invalid format: %s", uri.c_str()); return false; } @@ -30,7 +30,7 @@ bool sip::IncomingConnectionValidator::validateUri(std::string uri) { string rawAddress = s[1].str(); for (auto ® : uriRegexVec) { - if (regex_match(rawAddress, s, reg)) { + if (boost::regex_match(rawAddress, s, reg)) { logger.info("URI %s is valid.", rawAddress.c_str()); return true; } diff --git a/IncomingConnectionValidator.hpp b/IncomingConnectionValidator.hpp index c9a5352..a6da219 100644 --- a/IncomingConnectionValidator.hpp +++ b/IncomingConnectionValidator.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include namespace sip { class IncomingConnectionValidator : boost::noncopyable { @@ -16,6 +16,6 @@ namespace sip { private: log4cpp::Category &logger; std::string validUriExpression; - std::vector uriRegexVec; + std::vector uriRegexVec; }; -} \ No newline at end of file +}