[med-svn] [Git][med-team/orthanc-gdcm][upstream] New upstream version 1.7+dfsg
Sebastien Jodogne (@jodogne-guest)
gitlab at salsa.debian.org
Mon May 6 21:15:35 BST 2024
Sebastien Jodogne pushed to branch upstream at Debian Med / orthanc-gdcm
Commits:
9c8845dc by jodogne-guest at 2024-05-06T22:03:23+02:00
New upstream version 1.7+dfsg
- - - - -
9 changed files:
- .hg_archival.txt
- + CITATION.cff
- CMakeLists.txt
- NEWS
- Plugin/Plugin.cpp
- Resources/CMake/GdcmConfiguration.cmake
- Resources/Orthanc/CMake/DownloadOrthancFramework.cmake
- Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
- Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h
Changes:
=====================================
.hg_archival.txt
=====================================
@@ -1,6 +1,6 @@
repo: 108d34b53bb89b998dbe89c3bb031241991f13c7
-node: feca364af19127bb9c93b570b31a32c5519d16a8
-branch: OrthancGdcm-1.6
+node: 40bc6f0b1c31f2c46952747d49c378a47e7d6caf
+branch: OrthancGdcm-1.7
latesttag: null
-latesttagdistance: 74
-changessincelatesttag: 81
+latesttagdistance: 81
+changessincelatesttag: 88
=====================================
CITATION.cff
=====================================
@@ -0,0 +1,14 @@
+cff-version: "1.1.0"
+message: "If you use this software, please cite it using these metadata."
+title: Orthanc
+abstract: "Orthanc is a lightweight open-source DICOM server for medical imaging supporting representational state transfer (REST)."
+authors:
+ -
+ affiliation: UCLouvain
+ family-names: Jodogne
+ given-names: "Sébastien"
+doi: "10.1007/s10278-018-0082-y"
+license: "GPL-3.0-or-later"
+repository-code: "https://orthanc.uclouvain.be/hg/orthanc/"
+version: 1.12.3
+date-released: 2024-01-31
=====================================
CMakeLists.txt
=====================================
@@ -22,13 +22,13 @@ cmake_minimum_required(VERSION 2.8)
project(OrthancGdcm)
-SET(PLUGIN_VERSION "1.6")
+SET(PLUGIN_VERSION "1.7")
if (PLUGIN_VERSION STREQUAL "mainline")
set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
else()
- set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.12.2")
+ set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.12.3")
set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
endif()
=====================================
NEWS
=====================================
@@ -2,6 +2,15 @@ Pending changes in the mainline
===============================
+Version 1.7 (2024-05-06)
+========================
+
+* Upgrade to GDCM 3.0.24 for static builds. Fixes:
+ - CVE-2024-22373: https://nvd.nist.gov/vuln/detail/CVE-2024-22373
+ - CVE-2024-22391: https://nvd.nist.gov/vuln/detail/CVE-2024-22391
+ - CVE-2024-25569: https://nvd.nist.gov/vuln/detail/CVE-2024-25569
+
+
Version 1.6 (2024-01-04)
========================
=====================================
Plugin/Plugin.cpp
=====================================
@@ -38,6 +38,8 @@
#include <gdcmUIDGenerator.h>
#include <gdcmVersion.h>
+#define PLUGIN_NAME "gdcm"
+
#define GDCM_VERSION_IS_ABOVE(major, minor, revision) \
(GDCM_MAJOR_VERSION > major || \
(GDCM_MAJOR_VERSION == major && \
@@ -502,7 +504,9 @@ extern "C"
OrthancPlugins::SetGlobalContext(context);
#if defined(ORTHANC_FRAMEWORK_VERSION_IS_ABOVE)
-# if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2)
+# if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 4)
+ Orthanc::Logging::InitializePluginContext(context, PLUGIN_NAME);
+# elif ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 7, 2)
Orthanc::Logging::InitializePluginContext(context);
# else
Orthanc::Logging::Initialize(context);
@@ -521,7 +525,7 @@ extern "C"
return -1;
}
- OrthancPluginSetDescription(context, "Decoder/transcoder of medical images using GDCM.");
+ OrthancPlugins::SetDescription(PLUGIN_NAME, "Decoder/transcoder of medical images using GDCM.");
OrthancPlugins::OrthancConfiguration global;
@@ -618,7 +622,7 @@ extern "C"
ORTHANC_PLUGINS_API const char* OrthancPluginGetName()
{
- return "gdcm";
+ return PLUGIN_NAME;
}
=====================================
Resources/CMake/GdcmConfiguration.cmake
=====================================
@@ -23,8 +23,8 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_GDCM)
set(GDCM_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/gdcm-2.8.9.tar.gz")
set(GDCM_MD5 "aeb00e0cb5375d454010a72e2e0f6154")
else()
- set(GDCM_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/gdcm-3.0.22.tar.gz")
- set(GDCM_MD5 "2d5b1e303d0fdd8c3766e14a4567f3c5")
+ set(GDCM_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/gdcm-3.0.24.tar.gz")
+ set(GDCM_MD5 "b51e20f7a7eaeafecae76b7d4da40481")
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
=====================================
Resources/Orthanc/CMake/DownloadOrthancFramework.cmake
=====================================
@@ -153,13 +153,15 @@ if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.2")
set(ORTHANC_FRAMEWORK_MD5 "ede3de356493a8868545f8cb4b8bc8b5")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.11.3")
- set(ORTHANC_FRAMEWORK_MD5 "f941c0f5771db7616e7b7961026a60e2")
+ set(ORTHANC_FRAMEWORK_MD5 "e48fc0cb09c4856803791a1be28c07dc")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.0")
set(ORTHANC_FRAMEWORK_MD5 "d32a0cde03b6eb603d8dd2b33d38bf1b")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.1")
set(ORTHANC_FRAMEWORK_MD5 "8a435140efc8ff4a01d8242f092f21de")
elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.2")
set(ORTHANC_FRAMEWORK_MD5 "d2476b9e796e339ac320b5333489bdb3")
+ elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.12.3")
+ set(ORTHANC_FRAMEWORK_MD5 "975f5bf2142c22cb1777b4f6a0a614c5")
# Below this point are development snapshots that were used to
# release some plugin, before an official release of the Orthanc
=====================================
Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
=====================================
@@ -61,6 +61,7 @@ static const OrthancPluginErrorCode OrthancPluginErrorCode_NullPointer = Orthanc
namespace OrthancPlugins
{
static OrthancPluginContext* globalContext_ = NULL;
+ static std::string pluginName_;
void SetGlobalContext(OrthancPluginContext* context)
@@ -79,9 +80,19 @@ namespace OrthancPlugins
}
}
+
+ void SetGlobalContext(OrthancPluginContext* context,
+ const char* pluginName)
+ {
+ SetGlobalContext(context);
+ pluginName_ = pluginName;
+ }
+
+
void ResetGlobalContext()
{
globalContext_ = NULL;
+ pluginName_.clear();
}
bool HasGlobalContext()
@@ -103,6 +114,66 @@ namespace OrthancPlugins
}
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+ void LogMessage(OrthancPluginLogLevel level,
+ const char* file,
+ uint32_t line,
+ const std::string& message)
+ {
+ if (HasGlobalContext())
+ {
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+ const char* pluginName = (pluginName_.empty() ? NULL : pluginName_.c_str());
+ OrthancPluginLogMessage(GetGlobalContext(), message.c_str(), pluginName, file, line, OrthancPluginLogCategory_Generic, level);
+#else
+ switch (level)
+ {
+ case OrthancPluginLogLevel_Error:
+ OrthancPluginLogError(GetGlobalContext(), message.c_str());
+ break;
+
+ case OrthancPluginLogLevel_Warning:
+ OrthancPluginLogWarning(GetGlobalContext(), message.c_str());
+ break;
+
+ case OrthancPluginLogLevel_Info:
+ OrthancPluginLogInfo(GetGlobalContext(), message.c_str());
+ break;
+
+ default:
+ ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
+ }
+#endif
+ }
+ }
+#endif
+
+
+ void LogError(const std::string& message)
+ {
+ if (HasGlobalContext())
+ {
+ OrthancPluginLogError(GetGlobalContext(), message.c_str());
+ }
+ }
+
+ void LogWarning(const std::string& message)
+ {
+ if (HasGlobalContext())
+ {
+ OrthancPluginLogWarning(GetGlobalContext(), message.c_str());
+ }
+ }
+
+ void LogInfo(const std::string& message)
+ {
+ if (HasGlobalContext())
+ {
+ OrthancPluginLogInfo(GetGlobalContext(), message.c_str());
+ }
+ }
+
+
void MemoryBuffer::Check(OrthancPluginErrorCode code)
{
if (code != OrthancPluginErrorCode_Success)
@@ -233,7 +304,7 @@ namespace OrthancPlugins
if (!ReadJson(target, buffer_.data, buffer_.size))
{
- LogError("Cannot convert some memory buffer to JSON");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot convert some memory buffer to JSON");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
}
@@ -265,7 +336,7 @@ namespace OrthancPlugins
explicit PluginHttpHeaders(const std::map<std::string, std::string>& httpHeaders)
{
for (std::map<std::string, std::string>::const_iterator
- it = httpHeaders.begin(); it != httpHeaders.end(); ++it)
+ it = httpHeaders.begin(); it != httpHeaders.end(); ++it)
{
headersKeys_.push_back(it->first.c_str());
headersValues_.push_back(it->second.c_str());
@@ -404,7 +475,7 @@ namespace OrthancPlugins
}
else
{
- LogError("Cannot parse JSON: " + std::string(err));
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot parse JSON: " + std::string(err));
return false;
}
#endif
@@ -565,13 +636,13 @@ namespace OrthancPlugins
{
if (str_ == NULL)
{
- LogError("Cannot convert an empty memory buffer to JSON");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot convert an empty memory buffer to JSON");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
if (!ReadJson(target, str_))
{
- LogError("Cannot convert some memory buffer to JSON");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot convert some memory buffer to JSON");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
}
@@ -581,13 +652,13 @@ namespace OrthancPlugins
{
if (str_ == NULL)
{
- LogError("Cannot convert an empty memory buffer to JSON");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot convert an empty memory buffer to JSON");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
if (!ReadJsonWithoutComments(target, str_))
{
- LogError("Cannot convert some memory buffer to JSON");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot convert some memory buffer to JSON");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
}
@@ -625,7 +696,7 @@ namespace OrthancPlugins
if (body.size() > 0xffffffffu)
{
- LogError("Cannot handle body size > 4GB");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot handle body size > 4GB");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
@@ -645,7 +716,7 @@ namespace OrthancPlugins
if (body.size() > 0xffffffffu)
{
- LogError("Cannot handle body size > 4GB");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot handle body size > 4GB");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
@@ -688,34 +759,6 @@ namespace OrthancPlugins
}
}
-
- void LogError(const std::string& message)
- {
- if (HasGlobalContext())
- {
- OrthancPluginLogError(GetGlobalContext(), message.c_str());
- }
- }
-
-
- void LogWarning(const std::string& message)
- {
- if (HasGlobalContext())
- {
- OrthancPluginLogWarning(GetGlobalContext(), message.c_str());
- }
- }
-
-
- void LogInfo(const std::string& message)
- {
- if (HasGlobalContext())
- {
- OrthancPluginLogInfo(GetGlobalContext(), message.c_str());
- }
- }
-
-
void OrthancConfiguration::LoadConfiguration()
{
OrthancString str;
@@ -723,7 +766,7 @@ namespace OrthancPlugins
if (str.GetContent() == NULL)
{
- LogError("Cannot access the Orthanc configuration");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot access the Orthanc configuration");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
@@ -731,7 +774,7 @@ namespace OrthancPlugins
if (configuration_.type() != Json::objectValue)
{
- LogError("Unable to read the Orthanc configuration");
+ ORTHANC_PLUGINS_LOG_ERROR("Unable to read the Orthanc configuration");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
}
@@ -799,8 +842,8 @@ namespace OrthancPlugins
{
if (configuration_[key].type() != Json::objectValue)
{
- LogError("The configuration section \"" + target.path_ +
- "\" is not an associative array as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration section \"" + target.path_ +
+ "\" is not an associative array as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -822,8 +865,8 @@ namespace OrthancPlugins
if (configuration_[key].type() != Json::stringValue)
{
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not a string as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not a string as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -854,8 +897,8 @@ namespace OrthancPlugins
return true;
default:
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not an integer as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not an integer as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -873,8 +916,8 @@ namespace OrthancPlugins
if (tmp < 0)
{
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not a positive integer as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not a positive integer as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -898,8 +941,8 @@ namespace OrthancPlugins
if (configuration_[key].type() != Json::booleanValue)
{
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not a Boolean as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not a Boolean as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -934,8 +977,8 @@ namespace OrthancPlugins
return true;
default:
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not an integer as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not an integer as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -994,8 +1037,8 @@ namespace OrthancPlugins
break;
}
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not a list of strings as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not a list of strings as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -1115,8 +1158,8 @@ namespace OrthancPlugins
if (configuration_[key].type() != Json::objectValue)
{
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not an object as expected");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not an object as expected");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -1133,8 +1176,8 @@ namespace OrthancPlugins
}
else
{
- LogError("The configuration option \"" + GetPath(key) +
- "\" is not a dictionary mapping strings to strings");
+ ORTHANC_PLUGINS_LOG_ERROR("The configuration option \"" + GetPath(key) +
+ "\" is not a dictionary mapping strings to strings");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
@@ -1156,7 +1199,7 @@ namespace OrthancPlugins
{
if (image_ == NULL)
{
- LogError("Trying to access a NULL image");
+ ORTHANC_PLUGINS_LOG_ERROR("Trying to access a NULL image");
ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
}
}
@@ -1182,7 +1225,7 @@ namespace OrthancPlugins
if (image_ == NULL)
{
- LogError("Cannot create an image");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot create an image");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
}
@@ -1199,7 +1242,7 @@ namespace OrthancPlugins
if (image_ == NULL)
{
- LogError("Cannot create an image accessor");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot create an image accessor");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
}
@@ -1213,7 +1256,7 @@ namespace OrthancPlugins
if (image_ == NULL)
{
- LogError("Cannot uncompress a PNG image");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot uncompress a PNG image");
ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
}
}
@@ -1226,7 +1269,7 @@ namespace OrthancPlugins
image_ = OrthancPluginUncompressImage(GetGlobalContext(), data, size, OrthancPluginImageFormat_Jpeg);
if (image_ == NULL)
{
- LogError("Cannot uncompress a JPEG image");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot uncompress a JPEG image");
ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
}
}
@@ -1240,7 +1283,7 @@ namespace OrthancPlugins
image_ = OrthancPluginDecodeDicomImage(GetGlobalContext(), data, size, frame);
if (image_ == NULL)
{
- LogError("Cannot uncompress a DICOM image");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot uncompress a DICOM image");
ORTHANC_PLUGINS_THROW_EXCEPTION(ParameterOutOfRange);
}
}
@@ -1654,13 +1697,13 @@ namespace OrthancPlugins
unsigned int minor,
unsigned int revision)
{
- LogError("Your version of the Orthanc core (" +
- std::string(GetGlobalContext()->orthancVersion) +
- ") is too old to run this plugin (version " +
- boost::lexical_cast<std::string>(major) + "." +
- boost::lexical_cast<std::string>(minor) + "." +
- boost::lexical_cast<std::string>(revision) +
- " is required)");
+ ORTHANC_PLUGINS_LOG_ERROR("Your version of the Orthanc core (" +
+ std::string(GetGlobalContext()->orthancVersion) +
+ ") is too old to run this plugin (version " +
+ boost::lexical_cast<std::string>(major) + "." +
+ boost::lexical_cast<std::string>(minor) + "." +
+ boost::lexical_cast<std::string>(revision) +
+ " is required)");
}
bool CheckMinimalVersion(const char* version,
@@ -1684,9 +1727,9 @@ namespace OrthancPlugins
int aa, bb, cc = 0;
if ((ORTHANC_SCANF(version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 &&
ORTHANC_SCANF(version, "%4d.%4d", &aa, &bb) != 2) ||
- aa < 0 ||
- bb < 0 ||
- cc < 0)
+ aa < 0 ||
+ bb < 0 ||
+ cc < 0)
{
return false;
}
@@ -1740,7 +1783,7 @@ namespace OrthancPlugins
{
if (!HasGlobalContext())
{
- LogError("Bad Orthanc context in the plugin");
+ ORTHANC_PLUGINS_LOG_ERROR("Bad Orthanc context in the plugin");
return false;
}
@@ -1777,7 +1820,7 @@ namespace OrthancPlugins
}
else
{
- LogError("Inexistent peer: " + name);
+ ORTHANC_PLUGINS_LOG_ERROR("Inexistent peer: " + name);
ORTHANC_PLUGINS_THROW_EXCEPTION(UnknownResource);
}
}
@@ -2061,7 +2104,7 @@ namespace OrthancPlugins
if (body.size() > 0xffffffffu)
{
- LogError("Cannot handle body size > 4GB");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot handle body size > 4GB");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
@@ -2098,7 +2141,7 @@ namespace OrthancPlugins
if (body.size() > 0xffffffffu)
{
- LogError("Cannot handle body size > 4GB");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot handle body size > 4GB");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
@@ -2464,7 +2507,7 @@ namespace OrthancPlugins
if (id == NULL)
{
- LogError("Plugin cannot submit job");
+ ORTHANC_PLUGINS_LOG_ERROR("Plugin cannot submit job");
OrthancPluginFreeJob(GetGlobalContext(), orthanc);
ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(OrthancPluginErrorCode_Plugin);
}
@@ -2533,7 +2576,7 @@ namespace OrthancPlugins
throw Orthanc::OrthancException(static_cast<Orthanc::ErrorCode>(status["ErrorCode"].asInt()),
status["ErrorDescription"].asString());
#else
- LogError("Exception while executing the job: " + status["ErrorDescription"].asString());
+ ORTHANC_PLUGINS_LOG_ERROR("Exception while executing the job: " + status["ErrorDescription"].asString());
ORTHANC_PLUGINS_THROW_PLUGIN_ERROR_CODE(status["ErrorCode"].asInt());
#endif
}
@@ -2558,7 +2601,7 @@ namespace OrthancPlugins
throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
"Expected a JSON object in the body");
#else
- LogError("Expected a JSON object in the body");
+ ORTHANC_PLUGINS_LOG_ERROR("Expected a JSON object in the body");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
#endif
}
@@ -2574,7 +2617,7 @@ namespace OrthancPlugins
"Option \"" + std::string(KEY_SYNCHRONOUS) +
"\" must be Boolean");
#else
- LogError("Option \"" + std::string(KEY_SYNCHRONOUS) + "\" must be Boolean");
+ ORTHANC_PLUGINS_LOG_ERROR("Option \"" + std::string(KEY_SYNCHRONOUS) + "\" must be Boolean");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
#endif
}
@@ -2593,7 +2636,7 @@ namespace OrthancPlugins
"Option \"" + std::string(KEY_ASYNCHRONOUS) +
"\" must be Boolean");
#else
- LogError("Option \"" + std::string(KEY_ASYNCHRONOUS) + "\" must be Boolean");
+ ORTHANC_PLUGINS_LOG_ERROR("Option \"" + std::string(KEY_ASYNCHRONOUS) + "\" must be Boolean");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
#endif
}
@@ -2614,7 +2657,7 @@ namespace OrthancPlugins
"Option \"" + std::string(KEY_PRIORITY) +
"\" must be an integer");
#else
- LogError("Option \"" + std::string(KEY_PRIORITY) + "\" must be an integer");
+ ORTHANC_PLUGINS_LOG_ERROR("Option \"" + std::string(KEY_PRIORITY) + "\" must be an integer");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
#endif
}
@@ -3135,7 +3178,7 @@ namespace OrthancPlugins
if (body.size() > 0xffffffffu)
{
- LogError("Cannot handle body size > 4GB");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot handle body size > 4GB");
ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
}
@@ -3280,7 +3323,7 @@ namespace OrthancPlugins
if (!ReadJson(answerBody, body))
{
- LogError("Cannot convert HTTP answer body to JSON");
+ ORTHANC_PLUGINS_LOG_ERROR("Cannot convert HTTP answer body to JSON");
ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat);
}
}
@@ -4026,4 +4069,48 @@ namespace OrthancPlugins
result[request->headersKeys[i]] = request->headersValues[i];
}
}
+
+#if !ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+ static void SetPluginProperty(const std::string& pluginIdentifier,
+ _OrthancPluginProperty property,
+ const std::string& value)
+ {
+ _OrthancPluginSetPluginProperty params;
+ params.plugin = pluginIdentifier.c_str();
+ params.property = property;
+ params.value = value.c_str();
+
+ GetGlobalContext()->InvokeService(GetGlobalContext(), _OrthancPluginService_SetPluginProperty, ¶ms);
+ }
+#endif
+
+ void SetRootUri(const std::string& pluginIdentifier,
+ const std::string& uri)
+ {
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+ OrthancPluginSetRootUri2(GetGlobalContext(), pluginIdentifier.c_str(), uri.c_str());
+#else
+ SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_RootUri, uri);
+#endif
+ }
+
+ void SetDescription(const std::string& pluginIdentifier,
+ const std::string& description)
+ {
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+ OrthancPluginSetDescription2(GetGlobalContext(), pluginIdentifier.c_str(), description.c_str());
+#else
+ SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_Description, description);
+#endif
+ }
+
+ void ExtendOrthancExplorer(const std::string& pluginIdentifier,
+ const std::string& javascript)
+ {
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+ OrthancPluginExtendOrthancExplorer2(GetGlobalContext(), pluginIdentifier.c_str(), javascript.c_str());
+#else
+ SetPluginProperty(pluginIdentifier, _OrthancPluginProperty_OrthancExplorer, javascript);
+#endif
+ }
}
=====================================
Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h
=====================================
@@ -127,6 +127,44 @@
# define HAS_ORTHANC_PLUGIN_WEBDAV 0
#endif
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 4)
+# define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 1
+#else
+# define HAS_ORTHANC_PLUGIN_LOG_MESSAGE 0
+#endif
+
+
+// Macro to tag a function as having been deprecated
+#if (__cplusplus >= 201402L) // C++14
+# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) [[deprecated]] f
+#elif defined(__GNUC__) || defined(__clang__)
+# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) f __attribute__((deprecated))
+#elif defined(_MSC_VER)
+# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(f) __declspec(deprecated) f
+#else
+# define ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED
+#endif
+
+
+#if !defined(__ORTHANC_FILE__)
+# if defined(_MSC_VER)
+# pragma message("Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries")
+# else
+# warning Warning: Macro __ORTHANC_FILE__ is not defined, this will leak the full path of the source files in the binaries
+# endif
+# define __ORTHANC_FILE__ __FILE__
+#endif
+
+
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+# define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Error, __ORTHANC_FILE__, __LINE__, msg)
+# define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Warning, __ORTHANC_FILE__, __LINE__, msg)
+# define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogMessage(OrthancPluginLogLevel_Info, __ORTHANC_FILE__, __LINE__, msg)
+#else
+# define ORTHANC_PLUGINS_LOG_ERROR(msg) ::OrthancPlugins::LogError(msg)
+# define ORTHANC_PLUGINS_LOG_WARNING(msg) ::OrthancPlugins::LogWarning(msg)
+# define ORTHANC_PLUGINS_LOG_INFO(msg) ::OrthancPlugins::LogInfo(msg)
+#endif
namespace OrthancPlugins
@@ -137,6 +175,9 @@ namespace OrthancPlugins
void SetGlobalContext(OrthancPluginContext* context);
+ void SetGlobalContext(OrthancPluginContext* context,
+ const char* pluginName);
+
void ResetGlobalContext();
bool HasGlobalContext();
@@ -637,11 +678,33 @@ namespace OrthancPlugins
const char* AutodetectMimeType(const std::string& path);
#endif
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+ void LogMessage(OrthancPluginLogLevel level,
+ const char* file,
+ uint32_t line,
+ const std::string& message);
+#endif
+
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+ // Use macro ORTHANC_PLUGINS_LOG_ERROR() instead
+ ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogError(const std::string& message));
+#else
void LogError(const std::string& message);
+#endif
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+ // Use macro ORTHANC_PLUGINS_LOG_WARNING() instead
+ ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogWarning(const std::string& message));
+#else
void LogWarning(const std::string& message);
+#endif
+#if HAS_ORTHANC_PLUGIN_LOG_MESSAGE == 1
+ // Use macro ORTHANC_PLUGINS_LOG_INFO() instead
+ ORTHANC_PLUGIN_CPP_WRAPPER_DEPRECATED(void LogInfo(const std::string& message));
+#else
void LogInfo(const std::string& message);
+#endif
void ReportMinimalOrthancVersion(unsigned int major,
unsigned int minor,
@@ -1435,4 +1498,13 @@ void GetHttpHeaders(std::map<std::string, std::string>& result, const OrthancPlu
IWebDavCollection& collection);
};
#endif
+
+ void SetRootUri(const std::string& pluginIdentifier,
+ const std::string& uri);
+
+ void SetDescription(const std::string& pluginIdentifier,
+ const std::string& description);
+
+ void ExtendOrthancExplorer(const std::string& pluginIdentifier,
+ const std::string& javascript);
}
View it on GitLab: https://salsa.debian.org/med-team/orthanc-gdcm/-/commit/9c8845dc8a3c227fd3a15356b5d9726f2eb89ef2
--
View it on GitLab: https://salsa.debian.org/med-team/orthanc-gdcm/-/commit/9c8845dc8a3c227fd3a15356b5d9726f2eb89ef2
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240506/5d6005a0/attachment-0001.htm>
More information about the debian-med-commit
mailing list