changeset 4981:d0c34145320c

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 25 Apr 2022 17:32:58 +0200
parents 8b95fc86b8d9
children 40fd2a485a84
files OrthancFramework/Sources/DicomFormat/DicomMap.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/Toolbox.h OrthancServer/CMakeLists.txt OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp OrthancServer/Resources/RunCppCheck.sh OrthancServer/Sources/Search/DatabaseLookup.cpp OrthancServer/Sources/ServerContext.cpp
diffstat 8 files changed, 58 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Mon Apr 25 17:32:58 2022 +0200
@@ -204,7 +204,7 @@
     {
       // std::set are sorted by default (which is important for us !)
       std::set<std::string> tagsIds;
-      for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); it++)
+      for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
       {
         tagsIds.insert(it->Format());
       }
@@ -411,7 +411,7 @@
     result.Clear();
 
     for (std::map<DicomTag, std::string>::const_iterator itmt = mainDicomTags.begin();
-         itmt != mainDicomTags.end(); itmt++)
+         itmt != mainDicomTags.end(); ++itmt)
     {
       DicomMap::Content::const_iterator it = source.find(itmt->first);
       if (it != source.end())
@@ -426,7 +426,7 @@
     result.Clear();
 
     for (std::set<DicomTag>::const_iterator itmt = tags.begin();
-         itmt != tags.end(); itmt++)
+         itmt != tags.end(); ++itmt)
     {
       DicomMap::Content::const_iterator it = content_.find(*itmt);
       if (it != content_.end())
@@ -550,7 +550,7 @@
     result.Clear();
 
     for (std::map<DicomTag, std::string>::const_iterator itmt = mainDicomTags.begin();
-         itmt != mainDicomTags.end(); itmt++)
+         itmt != mainDicomTags.end(); ++itmt)
     {
       result.SetValue(itmt->first, "", false);
     }
@@ -1415,7 +1415,7 @@
     const std::map<DicomTag, std::string>& mainDicomTags = DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTags(level);
 
     for (std::map<DicomTag, std::string>::const_iterator itmt = mainDicomTags.begin();
-         itmt != mainDicomTags.end(); itmt++)
+         itmt != mainDicomTags.end(); ++itmt)
     {
       Content::const_iterator found = other.content_.find(itmt->first);
 
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Mon Apr 25 17:32:58 2022 +0200
@@ -1315,7 +1315,7 @@
   {
     std::set<std::string> values;
     for (std::set<DicomTag>::const_iterator it = tags.begin();
-         it != tags.end(); it++)
+         it != tags.end(); ++it)
     {
       values.insert(it->Format());
     }
@@ -1327,7 +1327,7 @@
   {
     output = Json::arrayValue;
     for (std::set<DicomTag>::const_iterator it = tags.begin();
-         it != tags.end(); it++)
+         it != tags.end(); ++it)
     {
       output.append(it->Format());
     }
@@ -1342,7 +1342,7 @@
     Toolbox::TokenizeString(tokens, source, ';');
 
     for (std::vector<std::string>::const_iterator it = tokens.begin();
-         it != tokens.end(); it++)
+         it != tokens.end(); ++it)
     {
       if (it->size() > 0)
       {
--- a/OrthancFramework/Sources/Toolbox.h	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancFramework/Sources/Toolbox.h	Mon Apr 25 17:32:58 2022 +0200
@@ -197,7 +197,7 @@
     template <typename T> static bool IsSetInSet(const std::set<T>& needles, const std::set<T>& haystack)
     {
       for (typename std::set<T>::const_iterator it = needles.begin();
-            it != needles.end(); it++)
+            it != needles.end(); ++it)
       {
         if (haystack.count(*it) == 0)
         {
@@ -214,7 +214,7 @@
       missings.clear();
 
       for (typename std::set<T>::const_iterator it = needles.begin();
-            it != needles.end(); it++)
+            it != needles.end(); ++it)
       {
         if (haystack.count(*it) == 0)
         {
@@ -228,7 +228,7 @@
     template <typename T> static void AppendSets(std::set<T>& target, const std::set<T>& toAppend)
     {
       for (typename std::set<T>::const_iterator it = toAppend.begin();
-            it != toAppend.end(); it++)
+            it != toAppend.end(); ++it)
       {
         target.insert(*it);
       }
@@ -237,7 +237,7 @@
     template <typename T> static void RemoveSets(std::set<T>& target, const std::set<T>& toRemove)
     {
       for (typename std::set<T>::const_iterator it = toRemove.begin();
-            it != toRemove.end(); it++)
+            it != toRemove.end(); ++it)
       {
         target.erase(*it);
       }
--- a/OrthancServer/CMakeLists.txt	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancServer/CMakeLists.txt	Mon Apr 25 17:32:58 2022 +0200
@@ -316,7 +316,7 @@
   -DHAS_ORTHANC_EXCEPTION=0
   -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}"
   -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}"
-  -DDB_OPTIMIZER_VERSION="${ORTHANC_VERSION}"
+  -DHOUSEKEEPER_VERSION="${ORTHANC_VERSION}"
   )
 
 
@@ -429,7 +429,7 @@
 #####################################################################
 
 if (ENABLE_PLUGINS AND
-    (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_DB_OPTIMIZER))
+    (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS OR BUILD_HOUSEKEEPER))
   add_library(ThirdPartyPlugins STATIC
     ${BOOST_SOURCES}
     ${JSONCPP_SOURCES}
@@ -610,43 +610,43 @@
 ## Build the "Housekeeper" plugin
 #####################################################################
 
-if (ENABLE_PLUGINS AND BUILD_DB_OPTIMIZER)
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-execute_process(
-  COMMAND 
-  ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/WindowsResources.py
-  ${ORTHANC_VERSION} Housekeeper Housekeeper.dll "Sample Orthanc plugin to optimize/clean the DB/Storage"
-  ERROR_VARIABLE Failure
-  OUTPUT_FILE ${AUTOGENERATED_DIR}/Housekeeper.rc
-  )
-
-if (Failure)
-  message(FATAL_ERROR "Error while computing the version information: ${Failure}")
-endif()
-
-list(APPEND HOUSEKEEPER_RESOURCES ${AUTOGENERATED_DIR}/Housekeeper.rc)
-endif()
-
-add_library(Housekeeper SHARED 
-${CMAKE_SOURCE_DIR}/Plugins/Samples/Housekeeper/Plugin.cpp
-${HOUSEKEEPER_RESOURCES}
-)
-
-target_link_libraries(Housekeeper 
-  ThirdPartyPlugins
-  )
-
-set_target_properties(
-  Housekeeper PROPERTIES 
-VERSION ${ORTHANC_VERSION} 
-SOVERSION ${ORTHANC_VERSION}
-)
-
-install(
-TARGETS Housekeeper
-RUNTIME DESTINATION lib    # Destination for Windows
-LIBRARY DESTINATION share/orthanc/plugins    # Destination for Linux
-)
+if (ENABLE_PLUGINS AND BUILD_HOUSEKEEPER)
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+    execute_process(
+      COMMAND 
+      ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/WindowsResources.py
+      ${ORTHANC_VERSION} Housekeeper Housekeeper.dll "Sample Orthanc plugin to optimize/clean the DB/Storage"
+      ERROR_VARIABLE Failure
+      OUTPUT_FILE ${AUTOGENERATED_DIR}/Housekeeper.rc
+      )
+    
+    if (Failure)
+      message(FATAL_ERROR "Error while computing the version information: ${Failure}")
+    endif()
+    
+    list(APPEND HOUSEKEEPER_RESOURCES ${AUTOGENERATED_DIR}/Housekeeper.rc)
+  endif()
+  
+  add_library(Housekeeper SHARED 
+    ${CMAKE_SOURCE_DIR}/Plugins/Samples/Housekeeper/Plugin.cpp
+    ${HOUSEKEEPER_RESOURCES}
+    )
+  
+  target_link_libraries(Housekeeper 
+    ThirdPartyPlugins
+    )
+  
+  set_target_properties(
+    Housekeeper PROPERTIES 
+    VERSION ${ORTHANC_VERSION} 
+    SOVERSION ${ORTHANC_VERSION}
+    )
+  
+  install(
+    TARGETS Housekeeper
+    RUNTIME DESTINATION lib    # Destination for Windows
+    LIBRARY DESTINATION share/orthanc/plugins    # Destination for Linux
+    )
 endif()
 
 
--- a/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancServer/Plugins/Samples/Housekeeper/Plugin.cpp	Mon Apr 25 17:32:58 2022 +0200
@@ -674,6 +674,6 @@
 
   ORTHANC_PLUGINS_API const char* OrthancPluginGetVersion()
   {
-    return DB_OPTIMIZER_VERSION;
+    return HOUSEKEEPER_VERSION;
   }
 }
--- a/OrthancServer/Resources/RunCppCheck.sh	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Mon Apr 25 17:32:58 2022 +0200
@@ -13,15 +13,15 @@
 knownArgument:../../OrthancFramework/UnitTestsSources/ImageTests.cpp
 knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp
 nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:321
-nullPointerRedundantCheck:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp
-stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1195
+stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1406
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:165
 stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:73
-stlFindInsert:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:373
-stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:375
+stlFindInsert:../../OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp:372
+stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:377
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp:40
 stlFindInsert:../../OrthancServer/Sources/ServerJobs/SplitStudyJob.cpp:190
 syntaxError:../../OrthancFramework/Sources/SQLite/FunctionContext.h:52
+syntaxError:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp:72
 syntaxError:../../OrthancFramework/UnitTestsSources/ZipTests.cpp:132
 syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:310
 uninitMemberVar:../../OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp:416
--- a/OrthancServer/Sources/Search/DatabaseLookup.cpp	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancServer/Sources/Search/DatabaseLookup.cpp	Mon Apr 25 17:32:58 2022 +0200
@@ -334,7 +334,7 @@
       assert(constraints_[i] != NULL);
       if (constraints_[i]->GetTag() == tag)
       {
-        constraint = constraints_.at(i);
+        constraint = constraints_[i];
         return true;
       }
     }
--- a/OrthancServer/Sources/ServerContext.cpp	Mon Apr 25 15:50:57 2022 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Mon Apr 25 17:32:58 2022 +0200
@@ -2392,7 +2392,7 @@
         {
           std::set<DicomTag> missingTags;
           Toolbox::AppendSets(missingTags, resource.missingRequestedTags_);
-          for (std::set<DicomTag>::const_iterator it = resource.missingRequestedTags_.begin(); it != resource.missingRequestedTags_.end(); it++)
+          for (std::set<DicomTag>::const_iterator it = resource.missingRequestedTags_.begin(); it != resource.missingRequestedTags_.end(); ++it)
           {
             if (DicomMap::IsComputedTag(*it))
             {