comparison Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp @ 21:42ebec01143b

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Nov 2023 08:01:03 +0100
parents 4e889a8e8be2
children dd0cd39e6259
comparison
equal deleted inserted replaced
20:cb7fd3c25f40 21:42ebec01143b
77 { 77 {
78 ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls); 78 ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls);
79 } 79 }
80 } 80 }
81 81
82 void ResetGlobalContext()
83 {
84 globalContext_ = NULL;
85 }
82 86
83 bool HasGlobalContext() 87 bool HasGlobalContext()
84 { 88 {
85 return globalContext_ != NULL; 89 return globalContext_ != NULL;
86 } 90 }
1668 { 1672 {
1669 // Assume compatibility with the mainline 1673 // Assume compatibility with the mainline
1670 return true; 1674 return true;
1671 } 1675 }
1672 1676
1677 #ifdef _MSC_VER
1678 #define ORTHANC_SCANF sscanf_s
1679 #else
1680 #define ORTHANC_SCANF sscanf
1681 #endif
1682
1673 // Parse the version 1683 // Parse the version
1674 int aa, bb, cc; 1684 int aa, bb, cc = 0;
1675 if ( 1685 if ((ORTHANC_SCANF(version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 &&
1676 #ifdef _MSC_VER 1686 ORTHANC_SCANF(version, "%4d.%4d", &aa, &bb) != 2) ||
1677 sscanf_s
1678 #else
1679 sscanf
1680 #endif
1681 (version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 ||
1682 aa < 0 || 1687 aa < 0 ||
1683 bb < 0 || 1688 bb < 0 ||
1684 cc < 0) 1689 cc < 0)
1685 { 1690 {
1686 return false; 1691 return false;