diff --git a/CMakeLists.txt b/CMakeLists.txt index 0744d7e3..a0eafa4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,23 +40,8 @@ else(CMAKE_SIZEOF_VOID_P EQUAL 8) endif(CMAKE_SIZEOF_VOID_P EQUAL 8) if (WIN32) - if (EXISTS "C:/Proton/qpid-proton-winsdk/2015") - set(Boost_INCLUDE_DIRS "C:/Boost2015" CACHE String "Boost include directory") - set(Boost_LIBRARY_DIRS "C:/Boost2015/lib64-msvc-14.0" CACHE String "Boost library directory") - else() - set(Boost_INCLUDE_DIRS "C:/Boost" CACHE String "Boost include directory") - set(Boost_LIBRARY_DIRS "C:/Boost/lib64-msvc-12.0" CACHE String "Boost library directory") - endif() - set(PROTON_INCLUDE_DIR "C:/Proton/qpid-proton-winsdk/include" CACHE String "Proton include directory") set(PROTON_LIBRARY_DIR "C:/Proton/qpid-proton-winsdk/lib" CACHE String "Proton library directory") -else (WIN32) - include(FindBoost) - find_package(Boost - 1.41.0 # CentOS/RHEL 6 - REQUIRED - COMPONENTS filesystem regex system - ) endif (WIN32) set(ENABLE_QPID_PROTON ON CACHE BOOL "Enable qpid proton clients") @@ -77,18 +62,6 @@ if (NOT WIN32) ) endif (NOT WIN32) -if (EXISTS "${Boost_INCLUDE_DIRS}") - include_directories(${Boost_INCLUDE_DIRS}) -else (EXISTS "${Boost_INCLUDE_DIRS}") - message(FATAL_ERROR "Boost ${BOOST_VERSION} headers were not found in ${Boost_INCLUDE_DIRS}") -endif (EXISTS "${Boost_INCLUDE_DIRS}") - -if (EXISTS "${Boost_LIBRARY_DIRS}") - link_directories(${Boost_LIBRARY_DIRS}) -else (EXISTS "${Boost_LIBRARY_DIRS}") - message(FATAL_ERROR "Boost ${BOOST_VERSION} libraries were not found in ${Boost_LIBRARY_DIRS}") -endif (EXISTS "${Boost_LIBRARY_DIRS}") - if (WIN32) if (EXISTS "${PROTON_INCLUDE_DIR}") include_directories(${PROTON_INCLUDE_DIR}) diff --git a/src/api/qpid-proton/CMakeLists.txt b/src/api/qpid-proton/CMakeLists.txt index 3cead1b4..92100628 100644 --- a/src/api/qpid-proton/CMakeLists.txt +++ b/src/api/qpid-proton/CMakeLists.txt @@ -49,7 +49,6 @@ else (WIN32) target_link_libraries( dtests-proton-common - boost_regex dtests-cpp-contrib dtests-cpp-common dtests-cpp-common-options diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 6a4a41fd..4d1a8b23 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -59,8 +59,6 @@ if (WIN32) target_link_libraries(dtests-cpp-common) else (WIN32) target_link_libraries(dtests-cpp-common - boost_filesystem - boost_system pthread ) endif (WIN32) diff --git a/src/common/Utils.cpp b/src/common/Utils.cpp index c8bb8597..a708ad9b 100644 --- a/src/common/Utils.cpp +++ b/src/common/Utils.cpp @@ -10,11 +10,14 @@ #include #endif -#include -#include +#include +#include #include "Utils.h" +//MAX_INT is 2^64 so the number can take a maximum of 20 characters +//INT_CONSTANT is 32 just to be sure +#define INT_CONSTANT 32 // get_time () // get current time downto miliseconds (as double) since epoch @@ -106,23 +109,18 @@ void set_stdx_unbuffered() */ std::string str_fmt(const std::string& in_str, int in_indx) { - std::string str_int(in_str); - - if (!in_str.empty()) { - // string not empty - boost::regex regex("%[ 0-9]*[ds]"); // boost regexp - - if (boost::regex_search(in_str, regex)) { - // formating *printf substring found - std::ostringstream stm; - stm << boost::format(in_str) % in_indx; - - str_int = stm.str(); - } + std::string outputString; + char *str_int = new char[sizeof(*str_int) * + (in_str.size() + INT_CONSTANT)]; + if (sprintf(str_int, in_str.c_str(), in_indx) > 0) { + outputString = str_int; + } else { + outputString = in_str; } + delete [] str_int; // return the string value - return (str_int); + return (outputString); } diff --git a/src/common/options/OptionsHelper.cpp b/src/common/options/OptionsHelper.cpp index dc81851a..bf5f46f5 100644 --- a/src/common/options/OptionsHelper.cpp +++ b/src/common/options/OptionsHelper.cpp @@ -5,16 +5,19 @@ * Author: opiske */ +#include #include "OptionsHelper.h" #include "logger/LoggerWrapper.h" -namespace fs = boost::filesystem; - using namespace dtests::common; using namespace dtests::common::log; - +static bool fileExists(const std::string& name) +{ + std::ifstream f(name); + return f.is_open(); +} OptionsSetter::OptionsSetter(const optparse::Values &options) : options(options) @@ -34,15 +37,13 @@ string OptionsSetter::getContent() const } else if(options.is_set("msg-content-from-file")) { const string contentFile = options["msg-content-from-file"]; - fs::path file(contentFile); - - if (!exists(file)) { + if (!fileExists(contentFile)) { logger(error) << "The file " << contentFile << " does" << " not exist"; throw IOException("The file " + contentFile + " does not exist"); } - fs::ifstream inputStream(file); + std::ifstream inputStream(contentFile); string content; diff --git a/src/common/options/OptionsHelper.h b/src/common/options/OptionsHelper.h index 35edd075..a6ff69c6 100644 --- a/src/common/options/OptionsHelper.h +++ b/src/common/options/OptionsHelper.h @@ -8,11 +8,6 @@ #ifndef DTESTS_COMMON_OPTIONSHELPER_H_ #define DTESTS_COMMON_OPTIONSHELPER_H_ -#include -#include -#include -#include - #include #include