Mercurial > hg > orthanc-postgresql
changeset 130:5ced32a226b1
cppcheck, and fix issue #62
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Aug 2017 17:53:43 +0200 (2017-08-11) |
parents | cdc12000160c |
children | 0e4d107e754e |
files | Core/PostgreSQLException.h Core/PostgreSQLLargeObject.cpp Core/PostgreSQLResult.h NEWS UnitTestsSources/PostgreSQLWrapperTests.cpp |
diffstat | 5 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/PostgreSQLException.h Fri Jan 06 11:03:20 2017 +0100 +++ b/Core/PostgreSQLException.h Fri Aug 11 17:53:43 2017 +0200 @@ -34,7 +34,7 @@ { } - PostgreSQLException(const std::string& message) : + explicit PostgreSQLException(const std::string& message) : std::runtime_error("Error in PostgreSQL: " + message) { }
--- a/Core/PostgreSQLLargeObject.cpp Fri Jan 06 11:03:20 2017 +0100 +++ b/Core/PostgreSQLLargeObject.cpp Fri Aug 11 17:53:43 2017 +0200 @@ -151,14 +151,14 @@ for (size_t position = 0; position < size_; ) { size_t remaining = size_ - position; - size_t nbytes = lo_read(pg_, fd_, target + position, remaining); + int nbytes = lo_read(pg_, fd_, target + position, remaining); if (nbytes < 0) { throw PostgreSQLException("Unable to read the large object in the database"); } - position += nbytes; + position += static_cast<size_t>(nbytes); } } };
--- a/Core/PostgreSQLResult.h Fri Jan 06 11:03:20 2017 +0100 +++ b/Core/PostgreSQLResult.h Fri Aug 11 17:53:43 2017 +0200 @@ -39,7 +39,7 @@ void CheckColumn(unsigned int column, /*Oid*/ unsigned int expectedType) const; public: - PostgreSQLResult(PostgreSQLStatement& statement); + explicit PostgreSQLResult(PostgreSQLStatement& statement); ~PostgreSQLResult() {
--- a/NEWS Fri Jan 06 11:03:20 2017 +0100 +++ b/NEWS Fri Aug 11 17:53:43 2017 +0200 @@ -3,6 +3,7 @@ * Upgrade to PostgreSQL 9.6.1 client library for static builds * Performance warning if runtime debug assertions are turned on +* Fix issue 62 (use correct type for lo_read() value) Release 2.0 (2015/12/02)
--- a/UnitTestsSources/PostgreSQLWrapperTests.cpp Fri Jan 06 11:03:20 2017 +0100 +++ b/UnitTestsSources/PostgreSQLWrapperTests.cpp Fri Aug 11 17:53:43 2017 +0200 @@ -74,7 +74,7 @@ static void CheckDicomTag(const OrthancPluginDicomTag& tag) { for (std::list<OrthancPluginDicomTag>::const_iterator - it = expectedDicomTags.begin(); it != expectedDicomTags.end(); it++) + it = expectedDicomTags.begin(); it != expectedDicomTags.end(); ++it) { if (it->group == tag.group && it->element == tag.element &&