# HG changeset patch # User Sebastien Jodogne # Date 1383561983 -3600 # Node ID 5425bb6f1ea5515a2f2edf3821c62885bac53ab9 # Parent 08eca5d86aadbcabcb80be4d4f5baad6dd183229 further cppcheck fixes diff -r 08eca5d86aad -r 5425bb6f1ea5 Core/SQLite/StatementReference.cpp --- a/Core/SQLite/StatementReference.cpp Mon Nov 04 11:19:31 2013 +0100 +++ b/Core/SQLite/StatementReference.cpp Mon Nov 04 11:46:23 2013 +0100 @@ -119,7 +119,11 @@ { if (root_->refCount_ == 0) { - throw OrthancException(ErrorCode_InternalError); + // There remain references to this object. We cannot throw + // an exception because: + // http://www.parashift.com/c++-faq/dtors-shouldnt-throw.html + + LOG(ERROR) << "Bad value of the reference counter"; } else { diff -r 08eca5d86aad -r 5425bb6f1ea5 NEWS --- a/NEWS Mon Nov 04 11:19:31 2013 +0100 +++ b/NEWS Mon Nov 04 11:46:23 2013 +0100 @@ -2,6 +2,10 @@ =============================== +* Switch from glog 0.3.2 to glog 0.3.3 +* Fixes and improvements thanks to cppcheck + + Version 0.7.1 (2013/10/30) ========================== diff -r 08eca5d86aad -r 5425bb6f1ea5 OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h --- a/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h Mon Nov 04 11:19:31 2013 +0100 +++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h Mon Nov 04 11:46:23 2013 +0100 @@ -598,7 +598,7 @@ * * @param other The original object. **/ - OrthancConnection(const OrthancConnection& other) : pimpl_(other.pimpl_), isReference_(true) { } + OrthancConnection(const OrthancConnection& other) : isReference_(true), pimpl_(other.pimpl_) { } inline OrthancConnection(const ::std::string& orthancUrl); inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password); inline ~OrthancConnection(); @@ -641,7 +641,7 @@ * * @param other The original object. **/ - Patient(const Patient& other) : pimpl_(other.pimpl_), isReference_(true) { } + Patient(const Patient& other) : isReference_(true), pimpl_(other.pimpl_) { } inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id); inline ~Patient(); inline void Reload(); @@ -679,7 +679,7 @@ * * @param other The original object. **/ - Series(const Series& other) : pimpl_(other.pimpl_), isReference_(true) { } + Series(const Series& other) : isReference_(true), pimpl_(other.pimpl_) { } inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id); inline ~Series(); inline void Reload(); @@ -726,7 +726,7 @@ * * @param other The original object. **/ - Study(const Study& other) : pimpl_(other.pimpl_), isReference_(true) { } + Study(const Study& other) : isReference_(true), pimpl_(other.pimpl_) { } inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id); inline ~Study(); inline void Reload(); @@ -764,7 +764,7 @@ * * @param other The original object. **/ - Instance(const Instance& other) : pimpl_(other.pimpl_), isReference_(true) { } + Instance(const Instance& other) : isReference_(true), pimpl_(other.pimpl_) { } inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id); inline ~Instance(); inline ::std::string GetId() const; @@ -832,7 +832,7 @@ typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(2); char* error = function(pimpl_); - ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + error = error; // Remove warning about unused variable } /** * @brief Returns the number of threads for this connection. @@ -1002,7 +1002,7 @@ typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(13); char* error = function(pimpl_); - ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + error = error; // Remove warning about unused variable } /** * @brief Reload the studies of this patient. @@ -1116,7 +1116,7 @@ typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(20); char* error = function(pimpl_); - ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + error = error; // Remove warning about unused variable } /** * @brief Reload the instances of this series. @@ -1377,7 +1377,7 @@ typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(36); char* error = function(pimpl_); - ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + error = error; // Remove warning about unused variable } /** * @brief Reload the series of this study. @@ -1491,7 +1491,7 @@ typedef char* (LAAW_ORTHANC_CLIENT_CALL_CONV* Function) (void*); Function function = (Function) ::OrthancClient::Internals::Library::GetInstance().GetFunction(43); char* error = function(pimpl_); - ::OrthancClient::Internals::Library::GetInstance().ThrowExceptionIfNeeded(error); + error = error; // Remove warning about unused variable } /** * @brief Get the %Orthanc identifier of this identifier. diff -r 08eca5d86aad -r 5425bb6f1ea5 OrthancServer/DicomProtocol/DicomUserConnection.cpp --- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp Mon Nov 04 11:19:31 2013 +0100 +++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp Mon Nov 04 11:46:23 2013 +0100 @@ -227,7 +227,7 @@ DcmDataset *responseIdentifiers /* pending response identifiers */ ) { - DicomFindAnswers& answers = *(DicomFindAnswers*) callbackData; + DicomFindAnswers& answers = *reinterpret_cast(callbackData); if (responseIdentifiers != NULL) { diff -r 08eca5d86aad -r 5425bb6f1ea5 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Mon Nov 04 11:19:31 2013 +0100 +++ b/OrthancServer/OrthancInitialization.cpp Mon Nov 04 11:46:23 2013 +0100 @@ -144,10 +144,10 @@ { RegisterUserMetadata(metadata, members[i]); } - catch (OrthancException& e) + catch (OrthancException&) { LOG(ERROR) << "Cannot register this user-defined metadata: " << info; - throw e; + throw; } } } diff -r 08eca5d86aad -r 5425bb6f1ea5 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Mon Nov 04 11:19:31 2013 +0100 +++ b/OrthancServer/main.cpp Mon Nov 04 11:46:23 2013 +0100 @@ -332,7 +332,7 @@ std::list luaScripts; GetGlobalListOfStringsParameter(luaScripts, "LuaScripts"); for (std::list::const_iterator - it = luaScripts.begin(); it != luaScripts.end(); it++) + it = luaScripts.begin(); it != luaScripts.end(); ++it) { std::string path = InterpretStringParameterAsPath(*it); LOG(WARNING) << "Installing the Lua scripts from: " << path; diff -r 08eca5d86aad -r 5425bb6f1ea5 Resources/CMake/GoogleLogConfiguration.cmake --- a/Resources/CMake/GoogleLogConfiguration.cmake Mon Nov 04 11:19:31 2013 +0100 +++ b/Resources/CMake/GoogleLogConfiguration.cmake Mon Nov 04 11:46:23 2013 +0100 @@ -1,8 +1,8 @@ if (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_LOG) - SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.2) + SET(GOOGLE_LOG_SOURCES_DIR ${CMAKE_BINARY_DIR}/glog-0.3.3) DownloadPackage( - "897fbff90d91ea2b6d6e78c8cea641cc" - "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/glog-0.3.2.tar.gz" + "a6fd2c22f8996846e34c763422717c18" + "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/glog-0.3.3.tar.gz" "${GOOGLE_LOG_SOURCES_DIR}") set(GOOGLE_LOG_HEADERS diff -r 08eca5d86aad -r 5425bb6f1ea5 THANKS --- a/THANKS Mon Nov 04 11:19:31 2013 +0100 +++ b/THANKS Mon Nov 04 11:46:23 2013 +0100 @@ -18,6 +18,7 @@ * Ryan Walklin (ryanwalklin@gmail.com), for Mac OS X build. * Peter Somlo (peter.somlo@gmail.com), for ClearCanvas support. * 12maksqwe@gmail.com, for fixing issue #8. +* Julien Nabet, for various suggestions for improving the source code. Artwork