changeset 3767:c6658187e4b1

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Mar 2020 14:46:06 +0100
parents 5ff5d5a0fd28
children 6110a4995ace
files Core/Compatibility.h Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/Internals/CommandDispatcher.cpp OrthancServer/ServerJobs/StorageCommitmentScpJob.h OrthancServer/main.cpp UnitTestsSources/FromDcmtkTests.cpp
diffstat 6 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Compatibility.h	Mon Mar 16 14:12:20 2020 +0100
+++ b/Core/Compatibility.h	Tue Mar 17 14:46:06 2020 +0100
@@ -93,7 +93,7 @@
     {
     }      
 
-    unique_ptr(T* p) :
+    explicit unique_ptr(T* p) :
       boost::movelib::unique_ptr<T>(p)
     {
     }      
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Mon Mar 16 14:12:20 2020 +0100
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Tue Mar 17 14:46:06 2020 +0100
@@ -86,6 +86,7 @@
 #  error The macro DCMTK_VERSION_NUMBER must be defined
 #endif
 
+#include "../Compatibility.h"
 #include "../DicomFormat/DicomArray.h"
 #include "../Logging.h"
 #include "../OrthancException.h"
@@ -1476,7 +1477,7 @@
     {
       for (size_t i = 0; i < sopClassUids.size(); i++)
       {
-        std::auto_ptr<DcmItem> item(new DcmItem);
+        std::unique_ptr<DcmItem> item(new DcmItem);
         if (!item->putAndInsertString(DCM_ReferencedSOPClassUID, sopClassUids[i].c_str()).good() ||
             !item->putAndInsertString(DCM_ReferencedSOPInstanceUID, sopInstanceUids[i].c_str()).good() ||
             (hasFailureReasons &&
--- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp	Mon Mar 16 14:12:20 2020 +0100
+++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp	Tue Mar 17 14:46:06 2020 +0100
@@ -1053,7 +1053,7 @@
        * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html#table_J.3-1
        **/
       
-      std::auto_ptr<DcmDataset> dataset(
+      std::unique_ptr<DcmDataset> dataset(
         ReadDataset(assoc_, "Cannot read the dataset in N-ACTION SCP", associationTimeout_));
 
       std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);
@@ -1082,7 +1082,7 @@
   
       try
       {
-        std::auto_ptr<IStorageCommitmentRequestHandler> handler
+        std::unique_ptr<IStorageCommitmentRequestHandler> handler
           (server_.GetStorageCommitmentRequestHandlerFactory().
            ConstructStorageCommitmentRequestHandler());
 
@@ -1176,7 +1176,7 @@
        * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html#table_J.3-2
        **/
       
-      std::auto_ptr<DcmDataset> dataset(
+      std::unique_ptr<DcmDataset> dataset(
         ReadDataset(assoc_, "Cannot read the dataset in N-EVENT-REPORT SCP", associationTimeout_));
 
       std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);
@@ -1221,7 +1221,7 @@
 
       try
       {
-        std::auto_ptr<IStorageCommitmentRequestHandler> handler
+        std::unique_ptr<IStorageCommitmentRequestHandler> handler
           (server_.GetStorageCommitmentRequestHandlerFactory().
            ConstructStorageCommitmentRequestHandler());
 
--- a/OrthancServer/ServerJobs/StorageCommitmentScpJob.h	Mon Mar 16 14:12:20 2020 +0100
+++ b/OrthancServer/ServerJobs/StorageCommitmentScpJob.h	Tue Mar 17 14:46:06 2020 +0100
@@ -33,6 +33,7 @@
 
 #pragma once
 
+#include "../../Core/Compatibility.h"
 #include "../../Core/DicomNetworking/RemoteModalityParameters.h"
 #include "../../Core/JobsEngine/SetOfCommandsJob.h"
 #include "IStorageCommitmentFactory.h"
@@ -68,7 +69,7 @@
     std::vector<std::string>  sopClassUids_;
     std::vector<std::string>  sopInstanceUids_;
 
-    std::auto_ptr<IStorageCommitmentFactory::ILookupHandler>  lookupHandler_;
+    std::unique_ptr<IStorageCommitmentFactory::ILookupHandler>  lookupHandler_;
 
     void CheckInvariants();
     
--- a/OrthancServer/main.cpp	Mon Mar 16 14:12:20 2020 +0100
+++ b/OrthancServer/main.cpp	Tue Mar 17 14:46:06 2020 +0100
@@ -36,6 +36,7 @@
 
 #include <boost/algorithm/string/predicate.hpp>
 
+#include "../Core/Compatibility.h"
 #include "../Core/DicomFormat/DicomArray.h"
 #include "../Core/DicomNetworking/DicomServer.h"
 #include "../Core/DicomParsing/FromDcmtkBridge.h"
@@ -116,7 +117,7 @@
       throw OrthancException(ErrorCode_InternalError);
     }
     
-    std::auto_ptr<StorageCommitmentScpJob> job(
+    std::unique_ptr<StorageCommitmentScpJob> job(
       new StorageCommitmentScpJob(context_, transactionUid, remoteAet, calledAet));
 
     for (size_t i = 0; i < referencedSopClassUids.size(); i++)
--- a/UnitTestsSources/FromDcmtkTests.cpp	Mon Mar 16 14:12:20 2020 +0100
+++ b/UnitTestsSources/FromDcmtkTests.cpp	Tue Mar 17 14:46:06 2020 +0100
@@ -2215,7 +2215,7 @@
     //SystemToolbox::ReadFile(s, "/home/jodogne/DICOM/Alain.dcm");
     SystemToolbox::ReadFile(s, "/home/jodogne/Subversion/orthanc-tests/Database/Brainix/Epi/IM-0001-0002.dcm");
 
-    std::auto_ptr<DcmFileFormat> dicom(FromDcmtkBridge::LoadFromMemoryBuffer(s.c_str(), s.size()));
+    std::unique_ptr<DcmFileFormat> dicom(FromDcmtkBridge::LoadFromMemoryBuffer(s.c_str(), s.size()));
 
     // less /home/jodogne/Downloads/dcmtk-3.6.4/dcmdata/include/dcmtk/dcmdata/dcxfer.h
     printf(">> %d\n", dicom->getDataset()->getOriginalXfer());  // => 4 == EXS_JPEGProcess1