From 48b922a964191852eead6a2d21b5ceb72ae9cc0a Mon Sep 17 00:00:00 2001 From: Adam Oleksy Date: Sat, 1 Aug 2015 14:18:36 +0200 Subject: [PATCH 1/3] boost_optional implicit cast to bool no longer available. Change to explicit cast. --- include/libport/option-parser.hxx | 2 +- include/sched/exception.hh | 2 +- lib/libport/option-parser.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/libport/option-parser.hxx b/include/libport/option-parser.hxx index bee36dec..6e8cecdc 100644 --- a/include/libport/option-parser.hxx +++ b/include/libport/option-parser.hxx @@ -22,7 +22,7 @@ namespace libport { if (!filled_) { - aver(def); + aver(bool(def)); return def.get(); } return boost::lexical_cast(value_); diff --git a/include/sched/exception.hh b/include/sched/exception.hh index 9d4e3ecb..664b43d4 100644 --- a/include/sched/exception.hh +++ b/include/sched/exception.hh @@ -38,7 +38,7 @@ namespace sched /// Define an optional field Name, and accessors. #define ADD_FIELD(Type, Name) \ public: \ - bool Name ## _is_set() const { return Name ## _; }; \ + bool Name ## _is_set() const { return bool(Name ## _); }; \ const Type& Name ## _get() const { return Name ## _ .get(); }; \ void Name ## _set(const Type& data) { Name ## _ = data; }; \ private: \ diff --git a/lib/libport/option-parser.cc b/lib/libport/option-parser.cc index 0f98534d..2596cc5c 100644 --- a/lib/libport/option-parser.cc +++ b/lib/libport/option-parser.cc @@ -305,7 +305,7 @@ namespace libport { if (!filled_) { - aver(def); + aver(bool(def)); return def.get(); } return value_; From 3f67c266b15b2616abf1412ee6a6a008026f3cb1 Mon Sep 17 00:00:00 2001 From: Adam Oleksy Date: Wed, 27 Apr 2016 19:42:19 +0200 Subject: [PATCH 2/3] Fix Boost depenency --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5e06076..24b9c26d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -432,7 +432,7 @@ qi_install_header(${SERIALIZE_HEADERS} SUBFOLDER serialize) qi_create_lib(port SHARED SRC ${PORT_SOURCES} ${PORT_HEADERS} - DEPENDS BOOST BOOST_CHRONO BOOST_FILESYSTEM BOOST_DATE_TIME BOOST_SYSTEM BOOST_THREAD) + DEPENDS BOOST BOOST_CHRONO BOOST_FILESYSTEM BOOST_DATE_TIME BOOST_SYSTEM BOOST_THREAD BOOST_REGEX) set_target_properties(port PROPERTIES From a077ff641c75b698091b1d06ccc2a591b9bacd0e Mon Sep 17 00:00:00 2001 From: Adam Oleksy Date: Wed, 4 May 2016 18:46:45 +0200 Subject: [PATCH 3/3] Support for MSVC 19 (Visual Studio 2015) * Do not define struct timespec, because MSVC 19 declares it * Do not define snprintf, because MSVC 19 declares it * Change environ name variable to env, because MSVC 19 defines it --- include/libport/ctime | 2 +- include/sched/libcoroutine/Common.h | 2 +- lib/libport/cstdlib.cc | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/libport/ctime b/include/libport/ctime index 2aaaf104..98a77e44 100644 --- a/include/libport/ctime +++ b/include/libport/ctime @@ -23,7 +23,7 @@ | timespec. | `-----------*/ -# if defined WIN32 +# if defined WIN32 && (_MSC_VER < 1900) struct timespec { time_t tv_sec; diff --git a/include/sched/libcoroutine/Common.h b/include/sched/libcoroutine/Common.h index c5bfa3f6..1d970c28 100644 --- a/include/sched/libcoroutine/Common.h +++ b/include/sched/libcoroutine/Common.h @@ -29,7 +29,7 @@ These defines are helpful for doing OS specific checks in the code. #if defined(WIN32) || defined(__WINS__) || defined(__MINGW32__) || defined(_MSC_VER) #define inline __inline -#if defined _MSC_VER +#if (_MSC_VER < 1900) # define snprintf _snprintf #endif #define usleep(x) Sleep(((x)+999)/1000) diff --git a/lib/libport/cstdlib.cc b/lib/libport/cstdlib.cc index 90bba7d7..0ad5396d 100644 --- a/lib/libport/cstdlib.cc +++ b/lib/libport/cstdlib.cc @@ -124,10 +124,10 @@ namespace libport # if defined __APPLE__ res = env_build(*_NSGetEnviron()); # elif defined _MSC_VER || defined __MINGW32__ - char* environ = GetEnvironmentStrings(); - for (char* cp = environ; *cp; cp += strlen(cp) + 1) + char* env = GetEnvironmentStrings(); + for (char* cp = env; *cp; cp += strlen(cp) + 1) env_add(res, cp); - FreeEnvironmentStrings(environ); + FreeEnvironmentStrings(env); # else res = env_build(environ); # endif