# HG changeset patch # User Sebastien Jodogne # Date 1442591572 -7200 # Node ID ab5218c18b7a49b6063bcd7a9290d5f628fd9c29 # Parent 465bed3c5c81f8af65f5226ba901083fb9c15619 compatibility with forthcoming sdk 0.9.5 diff -r 465bed3c5c81 -r ab5218c18b7a NEWS --- a/NEWS Fri Aug 28 13:51:55 2015 +0200 +++ b/NEWS Fri Sep 18 17:52:52 2015 +0200 @@ -1,12 +1,16 @@ Pending changes in the mainline =============================== +=> Minimum SDK version: 0.9.4 <= + * Fix for old versions of jQuery Version 1.2 (2015-08-02) ======================== +=> Minimum SDK version: 0.9.1 <= + * Update to Boost 1.58.0 for static and Windows builds * Inject version information into Windows binaries * Support of OS X diff -r 465bed3c5c81 -r ab5218c18b7a Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Fri Aug 28 13:51:55 2015 +0200 +++ b/Plugin/Plugin.cpp Fri Sep 18 17:52:52 2015 +0200 @@ -31,6 +31,16 @@ #include "SeriesInformationAdapter.h" +#if (ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER >= 9 && ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER >= 5) +# define RETURN_TYPE OrthancPluginErrorCode +# define RETURN_SUCCESS OrthancPluginErrorCode_Success +# define RETURN_FAILURE OrthancPluginErrorCode_Plugin +#else +# define RETURN_TYPE int32_t +# define RETURN_SUCCESS 0 +# define RETURN_FAILURE -1 +#endif + class CacheContext { @@ -71,9 +81,9 @@ -static int32_t OnChangeCallback(OrthancPluginChangeType changeType, - OrthancPluginResourceType resourceType, - const char* resourceId) +static RETURN_TYPE OnChangeCallback(OrthancPluginChangeType changeType, + OrthancPluginResourceType resourceType, + const char* resourceId) { try { @@ -93,28 +103,28 @@ } } - return 0; + return RETURN_SUCCESS; } catch (std::runtime_error& e) { OrthancPluginLogError(context_, e.what()); - return 0; // Ignore error + return RETURN_SUCCESS; // Ignore error } } template -int32_t ServeCache(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +static RETURN_TYPE ServeCache(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { try { if (request->method != OrthancPluginHttpMethod_Get) { OrthancPluginSendMethodNotAllowed(context_, output, "GET"); - return 0; + return RETURN_SUCCESS; } const std::string id = request->groups[0]; @@ -129,22 +139,22 @@ OrthancPluginSendHttpStatusCode(context_, output, 404); } - return 0; + return RETURN_SUCCESS; } catch (Orthanc::OrthancException& e) { OrthancPluginLogError(context_, e.What()); - return -1; + return RETURN_FAILURE; } catch (std::runtime_error& e) { OrthancPluginLogError(context_, e.what()); - return -1; + return RETURN_FAILURE; } catch (boost::bad_lexical_cast&) { OrthancPluginLogError(context_, "Bad lexical cast"); - return -1; + return RETURN_FAILURE; } } @@ -185,14 +195,14 @@ template -static int32_t ServeEmbeddedFolder(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +static RETURN_TYPE ServeEmbeddedFolder(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { if (request->method != OrthancPluginHttpMethod_Get) { OrthancPluginSendMethodNotAllowed(context_, output, "GET"); - return 0; + return RETURN_SUCCESS; } std::string path = "/" + std::string(request->groups[0]); @@ -206,29 +216,29 @@ const char* resource = s.size() ? s.c_str() : NULL; OrthancPluginAnswerBuffer(context_, output, resource, s.size(), mime); - return 0; + return RETURN_SUCCESS; } catch (std::runtime_error&) { std::string s = "Unknown static resource in plugin: " + std::string(request->groups[0]); OrthancPluginLogError(context_, s.c_str()); OrthancPluginSendHttpStatusCode(context_, output, 404); - return 0; + return RETURN_SUCCESS; } } -static int32_t IsStableSeries(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) +static RETURN_TYPE IsStableSeries(OrthancPluginRestOutput* output, + const char* url, + const OrthancPluginHttpRequest* request) { try { if (request->method != OrthancPluginHttpMethod_Get) { OrthancPluginSendMethodNotAllowed(context_, output, "GET"); - return 0; + return RETURN_SUCCESS; } const std::string id = request->groups[0]; @@ -247,22 +257,22 @@ OrthancPluginSendHttpStatusCode(context_, output, 404); } - return 0; + return RETURN_SUCCESS; } catch (Orthanc::OrthancException& e) { OrthancPluginLogError(context_, e.What()); - return -1; + return RETURN_FAILURE; } catch (std::runtime_error& e) { OrthancPluginLogError(context_, e.what()); - return -1; + return RETURN_FAILURE; } catch (boost::bad_lexical_cast&) { OrthancPluginLogError(context_, "Bad lexical cast"); - return -1; + return RETURN_FAILURE; } }