Mercurial > hg > orthanc-webviewer
changeset 134:d73006baca3f
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 13 Jun 2016 10:27:52 +0200 |
parents | 3251ec958a29 |
children | 4524e450979a |
files | Orthanc/Core/DicomFormat/DicomMap.cpp Orthanc/Core/DicomFormat/DicomMap.h Orthanc/Core/Toolbox.cpp Orthanc/Core/Toolbox.h |
diffstat | 4 files changed, 35 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/Orthanc/Core/DicomFormat/DicomMap.cpp Thu Jun 09 17:04:58 2016 +0200 +++ b/Orthanc/Core/DicomFormat/DicomMap.cpp Mon Jun 13 10:27:52 2016 +0200 @@ -535,10 +535,10 @@ return true; case ValueRepresentation_OtherDouble: - return value.size() <= static_cast<size_t>((1llu << 32) - 8); + return value.size() <= (static_cast<uint64_t>(1) << 32) - 8; case ValueRepresentation_OtherFloat: - return value.size() <= static_cast<size_t>((1llu << 32) - 4); + return value.size() <= (static_cast<uint64_t>(1) << 32) - 4; case ValueRepresentation_OtherLong: return true; @@ -568,7 +568,7 @@ return value.size() <= 28; case ValueRepresentation_UnlimitedCharacters: - return value.size() <= static_cast<size_t>((1llu << 32) - 2); + return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; case ValueRepresentation_UniqueIdentifier: return value.size() <= 64; @@ -580,13 +580,13 @@ return true; case ValueRepresentation_UniversalResource: - return value.size() <= static_cast<size_t>((1llu << 32) - 2); + return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; case ValueRepresentation_UnsignedShort: return value.size() == 2; case ValueRepresentation_UnlimitedText: - return value.size() <= static_cast<size_t>((1llu << 32) - 2); + return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; default: // Assume unsupported tags are OK
--- a/Orthanc/Core/DicomFormat/DicomMap.h Thu Jun 09 17:04:58 2016 +0200 +++ b/Orthanc/Core/DicomFormat/DicomMap.h Mon Jun 13 10:27:52 2016 +0200 @@ -171,8 +171,6 @@ static void GetMainDicomTags(std::set<DicomTag>& result); - void Print(FILE* fp) const; - void GetTags(std::set<DicomTag>& tags) const; static void LoadMainDicomTags(const DicomTag*& tags,
--- a/Orthanc/Core/Toolbox.cpp Thu Jun 09 17:04:58 2016 +0200 +++ b/Orthanc/Core/Toolbox.cpp Mon Jun 13 10:27:52 2016 +0200 @@ -111,19 +111,25 @@ namespace Orthanc { - static bool finish; + static bool finish_; + static ServerBarrierEvent barrierEvent_; #if defined(_WIN32) static BOOL WINAPI ConsoleControlHandler(DWORD dwCtrlType) { // http://msdn.microsoft.com/en-us/library/ms683242(v=vs.85).aspx - finish = true; + finish_ = true; return true; } #else - static void SignalHandler(int) + static void SignalHandler(int signal) { - finish = true; + if (signal == SIGHUP) + { + barrierEvent_ = ServerBarrierEvent_Reload; + } + + finish_ = true; } #endif @@ -140,7 +146,7 @@ } - static void ServerBarrierInternal(const bool* stopFlag) + static ServerBarrierEvent ServerBarrierInternal(const bool* stopFlag) { #if defined(_WIN32) SetConsoleCtrlHandler(ConsoleControlHandler, true); @@ -148,11 +154,13 @@ signal(SIGINT, SignalHandler); signal(SIGQUIT, SignalHandler); signal(SIGTERM, SignalHandler); + signal(SIGHUP, SignalHandler); #endif // Active loop that awakens every 100ms - finish = false; - while (!(*stopFlag || finish)) + finish_ = false; + barrierEvent_ = ServerBarrierEvent_Stop; + while (!(*stopFlag || finish_)) { Toolbox::USleep(100 * 1000); } @@ -163,19 +171,22 @@ signal(SIGINT, NULL); signal(SIGQUIT, NULL); signal(SIGTERM, NULL); + signal(SIGHUP, NULL); #endif + + return barrierEvent_; } - void Toolbox::ServerBarrier(const bool& stopFlag) + ServerBarrierEvent Toolbox::ServerBarrier(const bool& stopFlag) { - ServerBarrierInternal(&stopFlag); + return ServerBarrierInternal(&stopFlag); } - void Toolbox::ServerBarrier() + ServerBarrierEvent Toolbox::ServerBarrier() { const bool stopFlag = false; - ServerBarrierInternal(&stopFlag); + return ServerBarrierInternal(&stopFlag); }
--- a/Orthanc/Core/Toolbox.h Thu Jun 09 17:04:58 2016 +0200 +++ b/Orthanc/Core/Toolbox.h Mon Jun 13 10:27:52 2016 +0200 @@ -47,11 +47,17 @@ { }; + enum ServerBarrierEvent + { + ServerBarrierEvent_Stop, + ServerBarrierEvent_Reload // SIGHUP signal: reload configuration file + }; + namespace Toolbox { - void ServerBarrier(const bool& stopFlag); + ServerBarrierEvent ServerBarrier(const bool& stopFlag); - void ServerBarrier(); + ServerBarrierEvent ServerBarrier(); void ToUpperCase(std::string& s); // Inplace version