# HG changeset patch # User Sebastien Jodogne # Date 1547637270 -3600 # Node ID 972cc98959a3d5076e05568dc4687fb19d57932b # Parent e678a2b1a25be3b78a25d6b7492f66f5ed7901e7 fix build of civetweb for Visual Studio 2008 and LSB diff -r e678a2b1a25b -r 972cc98959a3 Core/Compression/ZipWriter.cpp --- a/Core/Compression/ZipWriter.cpp Wed Jan 16 09:53:45 2019 +0100 +++ b/Core/Compression/ZipWriter.cpp Wed Jan 16 12:14:30 2019 +0100 @@ -59,9 +59,9 @@ ptime midnight(today); time_duration sinceMidnight = now - midnight; - zfi.tmz_date.tm_sec = sinceMidnight.seconds(); // seconds after the minute - [0,59] - zfi.tmz_date.tm_min = sinceMidnight.minutes(); // minutes after the hour - [0,59] - zfi.tmz_date.tm_hour = sinceMidnight.hours(); // hours since midnight - [0,23] + zfi.tmz_date.tm_sec = static_cast(sinceMidnight.seconds()); // seconds after the minute - [0,59] + zfi.tmz_date.tm_min = static_cast(sinceMidnight.minutes()); // minutes after the hour - [0,59] + zfi.tmz_date.tm_hour = static_cast(sinceMidnight.hours()); // hours since midnight - [0,23] // http://www.boost.org/doc/libs/1_35_0/doc/html/boost/gregorian/greg_day.html zfi.tmz_date.tm_mday = today.day(); // day of the month - [1,31] diff -r e678a2b1a25b -r 972cc98959a3 Core/DicomNetworking/TimeoutDicomConnectionManager.cpp --- a/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp Wed Jan 16 09:53:45 2019 +0100 +++ b/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp Wed Jan 16 12:14:30 2019 +0100 @@ -97,7 +97,7 @@ unsigned int TimeoutDicomConnectionManager::GetTimeout() { - return timeout_.total_milliseconds(); + return static_cast(timeout_.total_milliseconds()); } diff -r e678a2b1a25b -r 972cc98959a3 Core/SerializationToolbox.cpp --- a/Core/SerializationToolbox.cpp Wed Jan 16 09:53:45 2019 +0100 +++ b/Core/SerializationToolbox.cpp Wed Jan 16 12:14:30 2019 +0100 @@ -53,7 +53,7 @@ tag = FromDcmtkBridge::ParseTag(name); return true; } - catch (OrthancException& e) + catch (OrthancException&) { return false; } diff -r e678a2b1a25b -r 972cc98959a3 Resources/CMake/CivetwebConfiguration.cmake --- a/Resources/CMake/CivetwebConfiguration.cmake Wed Jan 16 09:53:45 2019 +0100 +++ b/Resources/CMake/CivetwebConfiguration.cmake Wed Jan 16 12:14:30 2019 +0100 @@ -3,8 +3,25 @@ set(CIVETWEB_URL "http://www.orthanc-server.com/downloads/third-party/civetweb-1.11.tar.gz") set(CIVETWEB_MD5 "b6d2175650a27924bccb747cbe084cd4") + if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}") + set(FirstRun OFF) + else() + set(FirstRun ON) + endif() + DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}") + execute_process( + COMMAND ${PATCH_EXECUTABLE} -p0 -N -i + ${ORTHANC_ROOT}/Resources/Patches/civetweb-1.11.patch + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE Failure + ) + + if (FirstRun AND Failure) + message(FATAL_ERROR "Error while patching a file") + endif() + include_directories( ${CIVETWEB_SOURCES_DIR}/include ) @@ -13,7 +30,6 @@ ${CIVETWEB_SOURCES_DIR}/src/civetweb.c ) - if (ENABLE_SSL) add_definitions( -DNO_SSL_DL=1 @@ -29,13 +45,6 @@ ) endif() - - if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND - CMAKE_COMPILER_IS_GNUCXX) - # This is a patch for MinGW64 - add_definitions(-D_TIMESPEC_DEFINED=1) - endif() - source_group(ThirdParty\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*) else() diff -r e678a2b1a25b -r 972cc98959a3 Resources/Patches/civetweb-1.11.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Patches/civetweb-1.11.patch Wed Jan 16 12:14:30 2019 +0100 @@ -0,0 +1,29 @@ +diff -urEb civetweb-1.11.orig/src/civetweb.c civetweb-1.11/src/civetweb.c +--- civetweb-1.11.orig/src/civetweb.c 2019-01-16 10:52:21.313348500 +0100 ++++ civetweb-1.11/src/civetweb.c 2019-01-16 11:59:58.995605655 +0100 +@@ -20,6 +20,14 @@ + * THE SOFTWARE. + */ + ++ ++#if defined(__LSB_VERSION__) ++// These definitions are mandatory for Linux Standard Base ++# define NO_CACHING ++# define NO_ALTERNATIVE_QUEUE ++# define NO_THREAD_NAME ++#endif ++ + #if defined(__GNUC__) || defined(__MINGW32__) + #define GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +@@ -536,6 +544,10 @@ + #if !defined(EWOULDBLOCK) + #define EWOULDBLOCK WSAEWOULDBLOCK + #endif /* !EWOULDBLOCK */ ++#if !defined(ECONNRESET) ++// Macro ECONNRESET is not always defined (e.g. on Visual Studio 2008) ++# define ECONNRESET WSAECONNRESET ++#endif /* !ECONNRESET */ + #define _POSIX_ + #define INT64_FMT "I64d" + #define UINT64_FMT "I64u"