[Gdcm-hackers] gdcm-git:Grassroots DICOM branch release updated. 4ecd77a6bbccd32eaa939d0b06d441ec7a
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: malat <ma...@us...> - 2023-04-04 08:32:57
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, release has been updated
via 4ecd77a6bbccd32eaa939d0b06d441ec7a07da6e (commit)
from 617b57a9b31b3ac604c64e06c9a1f2b84ff98125 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceforge.net/p/gdcm/gdcm/ci/4ecd77a6bbccd32eaa939d0b06d441ec7a07da6e/
commit 4ecd77a6bbccd32eaa939d0b06d441ec7a07da6e
Author: Sean McBride <se...@ro...>
Date: Sat Mar 25 11:11:39 2023 -0400
Fixed numerous cppcheck warnings
Specifically:
constParameter,GDCM/Source/Common/gdcmEvent.h:52,style,Parameter 'e' can be declared as reference to const
identicalConditionAfterEarlyExit,GDCM/Testing/Source/DataDictionary/Cxx/TestDictEntry.cxx:50,warning,Identical condition '!(pt2<pt3)', second condition is always false
shiftNegativeLHS,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:465,portability,Shifting a negative value is technically undefined behaviour
shiftNegativeLHS,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:521,portability,Shifting a negative value is technically undefined behaviour
uninitMemberVar,GDCM/Source/MediaStorageAndFileFormat/gdcmScanner2.h:59,warning,Member variable 'Scanner2::Progress' is not initialized in the constructor.
uninitMemberVar,GDCM/Source/MediaStorageAndFileFormat/gdcmStrictScanner2.h:56,warning,Member variable 'StrictScanner2::Progress' is not initialized in the constructor.
unreadVariable,GDCM/Source/Common/zipstreamimpl.hpp:146,style,Variable 'written_byte_size' is assigned a value that is never used.
unreadVariable,GDCM/Source/Common/zipstreamimpl.hpp:148,style,Variable 'remainder' is assigned a value that is never used.
unreadVariable,GDCM/Source/Common/zipstreamimpl.hpp:245,style,Variable 'written_byte_size' is assigned a value that is never used.
unreadVariable,GDCM/Source/Common/zipstreamimpl.hpp:251,style,Variable 'remainder' is assigned a value that is never used.
unreadVariable,GDCM/Source/DataStructureAndEncodingDefinition/gdcmBasicOffsetTable.h:47,style,Variable 'seqDelItem' is assigned a value that is never used.
unreadVariable,GDCM/Source/DataStructureAndEncodingDefinition/gdcmFragment.h:65,style,Variable 'itemStart' is assigned a value that is never used.
unreadVariable,GDCM/Source/DataStructureAndEncodingDefinition/gdcmFragment.h:66,style,Variable 'seqDelItem' is assigned a value that is never used.
unreadVariable,GDCM/Source/DataStructureAndEncodingDefinition/gdcmFragment.h:94,style,Variable 'itemStart' is assigned a value that is never used.
unreadVariable,GDCM/Source/DataStructureAndEncodingDefinition/gdcmFragment.h:95,style,Variable 'seqDelItem' is assigned a value that is never used.
uselessAssignmentPtrArg,GDCM/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx:1009,warning,Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
variableScope,GDCM/Source/Common/gdcmSystem.cxx:609,style,The scope of the variable 'extended' can be reduced.
variableScope,GDCM/Source/Common/gdcmSystem.cxx:623,style,The scope of the variable 'res' can be reduced.
variableScope,GDCM/Source/Common/gdcmUnpacker12Bits.cxx:26,style,The scope of the variable 'b0' can be reduced.
variableScope,GDCM/Source/Common/gdcmUnpacker12Bits.cxx:26,style,The scope of the variable 'b1' can be reduced.
variableScope,GDCM/Source/Common/gdcmUnpacker12Bits.cxx:26,style,The scope of the variable 'b2' can be reduced.
variableScope,GDCM/Source/Common/gdcmUnpacker12Bits.cxx:45,style,The scope of the variable 'b0' can be reduced.
variableScope,GDCM/Source/Common/gdcmUnpacker12Bits.cxx:45,style,The scope of the variable 'b1' can be reduced.
variableScope,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:160,style,The scope of the variable 'B' can be reduced.
variableScope,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:160,style,The scope of the variable 'G' can be reduced.
variableScope,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:160,style,The scope of the variable 'R' can be reduced.
variableScope,GDCM/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx:123,style,The scope of the variable 'x' can be reduced.
diff --git a/Source/Common/gdcmEvent.h b/Source/Common/gdcmEvent.h
index 3913de404..7f2c50dab 100644
--- a/Source/Common/gdcmEvent.h
+++ b/Source/Common/gdcmEvent.h
@@ -49,7 +49,7 @@ public :
};
/// Generic inserter operator for Event and its subclasses.
-inline std::ostream& operator<<(std::ostream& os, Event &e)
+inline std::ostream& operator<<(std::ostream& os, const Event &e)
{
e.Print(os);
return os;
diff --git a/Source/Common/gdcmSystem.cxx b/Source/Common/gdcmSystem.cxx
index cbf6ff5fd..5d31526d0 100644
--- a/Source/Common/gdcmSystem.cxx
+++ b/Source/Common/gdcmSystem.cxx
@@ -606,10 +606,10 @@ const char *System::GetCurrentResourcesDirectory()
*/
inline int getlastdigit(unsigned char *data, unsigned long size)
{
- int extended, carry = 0;
+ int carry = 0;
for(unsigned int i=0;i<size;i++)
{
- extended = (carry << 8) + data[i];
+ int extended = (carry << 8) + data[i];
data[i] = (unsigned char)(extended / 10);
carry = extended % 10;
}
@@ -620,14 +620,13 @@ inline int getlastdigit(unsigned char *data, unsigned long size)
size_t System::EncodeBytes(char *out, const unsigned char *data, int size)
{
bool zero = false;
- int res;
std::string sres;
unsigned char buffer[32];
unsigned char *addr = buffer;
memcpy(addr, data, size);
while(!zero)
{
- res = getlastdigit(addr, size);
+ int res = getlastdigit(addr, size);
const char v = (char)('0' + res);
sres.insert(sres.begin(), v);
zero = true;
diff --git a/Source/Common/gdcmUnpacker12Bits.cxx b/Source/Common/gdcmUnpacker12Bits.cxx
index 93e0fcb2a..12e292d35 100644
--- a/Source/Common/gdcmUnpacker12Bits.cxx
+++ b/Source/Common/gdcmUnpacker12Bits.cxx
@@ -23,13 +23,12 @@ bool Unpacker12Bits::Unpack(char *out, const char *in, size_t n)
short *q = (short*)(void*)out;
const unsigned char *p = (const unsigned char*)in;
const unsigned char *end = p+n;
- unsigned char b0,b1,b2;
while (p!=end)
{
- b0 = *p++;
- b1 = *p++;
- b2 = *p++;
+ unsigned char b0 = *p++;
+ unsigned char b1 = *p++;
+ unsigned char b2 = *p++;
*q++ = (short)(((b1 & 0xf) << 8) + b0);
*q++ = (short)((b1>>4) + (b2<<4));
}
@@ -42,12 +41,11 @@ bool Unpacker12Bits::Pack(char *out, const char *in, size_t n)
unsigned char *q = (unsigned char*)out;
const unsigned short *p = (const unsigned short*)(const void*)in;
const unsigned short *end = (const unsigned short*)(const void*)(in+n);
- unsigned short b0,b1;
while(p!=end)
{
- b0 = *p++;
- b1 = *p++;
+ unsigned short b0 = *p++;
+ unsigned short b1 = *p++;
*q++ = (unsigned char)(b0 & 0xff);
*q++ = (unsigned char)((b0 >> 8) + ((b1 & 0xf) << 4));
diff --git a/Source/Common/zipstreamimpl.hpp b/Source/Common/zipstreamimpl.hpp
index 699a94e0a..39781c569 100644
--- a/Source/Common/zipstreamimpl.hpp
+++ b/Source/Common/zipstreamimpl.hpp
@@ -143,9 +143,7 @@ basic_zip_streambuf<charT, traits>::overflow(int_type c)
template <class charT, class traits>
std::streamsize basic_zip_streambuf<charT, traits>::flush()
{
- std::streamsize written_byte_size = 0, total_written_byte_size = 0;
-
- size_t remainder = 0;
+ std::streamsize total_written_byte_size = 0;
// updating crc
_crc = crc32(_crc, _zip_stream.next_in,
@@ -156,14 +154,15 @@ std::streamsize basic_zip_streambuf<charT, traits>::flush()
_err = deflate(&_zip_stream, Z_FINISH);
if(_err == Z_OK || _err == Z_STREAM_END)
{
- written_byte_size = static_cast<std::streamsize>(_output_buffer.size()) - _zip_stream.avail_out;
+ std::streamsize written_byte_size = static_cast<std::streamsize>(_output_buffer.size()) - _zip_stream.avail_out;
total_written_byte_size += written_byte_size;
// output buffer is full, dumping to ostream
_ostream.write( (const char_type*) &(_output_buffer[0]),
static_cast<std::streamsize>(written_byte_size/sizeof(char_type)*sizeof(char)));
// checking if some bytes were not written.
- if((remainder = written_byte_size%sizeof(char_type)) != 0)
+ size_t remainder = written_byte_size%sizeof(char_type);
+ if(remainder != 0)
{
// copy to the beginning of the stream
std::streamsize theDiff = written_byte_size-remainder;
@@ -242,13 +241,12 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
char_type *buffer,
std::streamsize buffer_size)
{
- std::streamsize written_byte_size = 0, total_written_byte_size = 0;
+ std::streamsize total_written_byte_size = 0;
_zip_stream.next_in = (byte_buffer_type) buffer;
_zip_stream.avail_in = static_cast<uInt>(buffer_size * sizeof(char_type));
_zip_stream.avail_out = static_cast<uInt>(_output_buffer.size());
_zip_stream.next_out = &_output_buffer[0];
- size_t remainder = 0;
// updating crc
_crc = crc32(_crc, _zip_stream.next_in,
@@ -260,7 +258,7 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
if (_err == Z_OK || _err == Z_STREAM_END)
{
- written_byte_size= static_cast<std::streamsize>(_output_buffer.size()) -
+ std::streamsize written_byte_size = static_cast<std::streamsize>(_output_buffer.size()) -
_zip_stream.avail_out;
total_written_byte_size += written_byte_size;
// output buffer is full, dumping to ostream
@@ -269,7 +267,8 @@ bool basic_zip_streambuf<charT, traits>::zip_to_stream(
static_cast<std::streamsize>(written_byte_size / sizeof(char_type)));
// checking if some bytes were not written.
- if((remainder = written_byte_size % sizeof(char_type)) != 0)
+ size_t remainder = written_byte_size % sizeof(char_type);
+ if(remainder != 0)
{
// copy to the beginning of the stream
std::streamsize theDiff = written_byte_size-remainder;
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmBasicOffsetTable.h b/Source/DataStructureAndEncodingDefinition/gdcmBasicOffsetTable.h
index dd031a18d..51d3514b7 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmBasicOffsetTable.h
+++ b/Source/DataStructureAndEncodingDefinition/gdcmBasicOffsetTable.h
@@ -44,7 +44,6 @@ public:
std::istream &Read(std::istream &is) {
// Superclass
const Tag itemStart(0xfffe, 0xe000);
- const Tag seqDelItem(0xfffe,0xe0dd);
if( !TagField.Read<TSwap>(is) )
{
assert(0 && "Should not happen");
diff --git a/Source/DataStructureAndEncodingDefinition/gdcmFragment.h b/Source/DataStructureAndEncodingDefinition/gdcmFragment.h
index 576585f9c..8c0fdceb9 100644
--- a/Source/DataStructureAndEncodingDefinition/gdcmFragment.h
+++ b/Source/DataStructureAndEncodingDefinition/gdcmFragment.h
@@ -62,9 +62,6 @@ public:
template <typename TSwap>
std::istream &ReadPreValue(std::istream &is)
{
- const Tag itemStart(0xfffe, 0xe000);
- const Tag seqDelItem(0xfffe,0xe0dd);
-
TagField.Read<TSwap>(is);
if( !is )
{
@@ -79,6 +76,8 @@ public:
throw Exception( "Problem #2" );
}
#ifdef GDCM_SUPPORT_BROKEN_IMPLEMENTATION
+ const Tag itemStart(0xfffe, 0xe000);
+ const Tag seqDelItem(0xfffe,0xe0dd);
if( TagField != itemStart && TagField != seqDelItem )
{
throw Exception( "Problem #3" );
@@ -90,9 +89,6 @@ public:
template <typename TSwap>
std::istream &ReadValue(std::istream &is)
{
- // Superclass
- const Tag itemStart(0xfffe, 0xe000);
- const Tag seqDelItem(0xfffe,0xe0dd);
// Self
SmartPointer<ByteValue> bv = new ByteValue;
bv->SetLength(ValueLengthField);
diff --git a/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx b/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx
index 7bdad285f..d1aeb8449 100644
--- a/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmBitmap.cxx
@@ -1006,7 +1006,6 @@ bool Bitmap::GetBufferInternal(char *buffer, bool &lossyflag) const
//if( !success ) success = TryDeltaEncodingCodec(buffer);
if( !success )
{
- buffer = nullptr;
//throw Exception( "No codec found for this image");
}
@@ -1023,7 +1022,6 @@ bool Bitmap::GetBuffer2(std::ostream &os) const
//if( !success ) success = TryRLECodec2(buffer);
if( !success )
{
- //buffer = 0;
throw Exception( "No codec found for this image");
}
diff --git a/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx b/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx
index d73b08913..899d62e4a 100644
--- a/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx
@@ -157,14 +157,13 @@ assert(0); // Do not use this code !
const unsigned char *a = copy + 0;
const unsigned char *b = copy + size;
const unsigned char *c = copy + size + size;
- int R, G, B;
unsigned char *p = (unsigned char*)dummy_buffer;
for (unsigned long j = 0; j < size; ++j)
{
- R = 38142 *(*a-16) + 52298 *(*c -128);
- G = 38142 *(*a-16) - 26640 *(*c -128) - 12845 *(*b -128);
- B = 38142 *(*a-16) + 66093 *(*b -128);
+ int R = 38142 *(*a-16) + 52298 *(*c -128);
+ int G = 38142 *(*a-16) - 26640 *(*c -128) - 12845 *(*b -128);
+ int B = 38142 *(*a-16) + 66093 *(*b -128);
R = (R+16384)>>15;
G = (G+16384)>>15;
@@ -461,8 +460,7 @@ bool ImageCodec::CleanupUnusedBits(char * data8, size_t datalen)
smask = (uint16_t)(
smask << ( 16 - (PF.GetBitsAllocated() - PF.GetBitsStored() + 1) ));
// nmask : to propagate sign bit on negative values
- int16_t nmask = (int16_t)0x8000;
- nmask = (int16_t)(nmask >> ( PF.GetBitsAllocated() - PF.GetBitsStored() - 1 ));
+ int16_t nmask = (int16_t)(0x8000U >> ( PF.GetBitsAllocated() - PF.GetBitsStored() - 1 ));
uint16_t *start = (uint16_t*)data;
for( uint16_t *p = start ; p != start + datalen / 2; ++p )
@@ -517,8 +515,7 @@ bool ImageCodec::DoOverlayCleanup(std::istream &is, std::ostream &os)
smask = (uint16_t)(
smask << ( 16 - (PF.GetBitsAllocated() - PF.GetBitsStored() + 1) ));
// nmask : to propagate sign bit on negative values
- int16_t nmask = (int16_t)0x8000;
- nmask = (int16_t)(nmask >> ( PF.GetBitsAllocated() - PF.GetBitsStored() - 1 ));
+ int16_t nmask = (int16_t)(0x8000U >> ( PF.GetBitsAllocated() - PF.GetBitsStored() - 1 ));
uint16_t c;
while( is.read((char*)&c,2) )
diff --git a/Source/MediaStorageAndFileFormat/gdcmScanner2.h b/Source/MediaStorageAndFileFormat/gdcmScanner2.h
index 655ada8d0..568bca7ce 100644
--- a/Source/MediaStorageAndFileFormat/gdcmScanner2.h
+++ b/Source/MediaStorageAndFileFormat/gdcmScanner2.h
@@ -56,7 +56,7 @@ class GDCM_EXPORT Scanner2 : public Subject
{
friend std::ostream& operator<<(std::ostream &_os, const Scanner2 &s);
public:
- Scanner2():Values(),Filenames(),PublicMappings(),PrivateMappings() {}
+ Scanner2():Values(),Filenames(),PublicMappings(),PrivateMappings(),Progress(0.0) {}
~Scanner2() override;
/// struct to map a filename to a value
diff --git a/Source/MediaStorageAndFileFormat/gdcmStrictScanner2.h b/Source/MediaStorageAndFileFormat/gdcmStrictScanner2.h
index 7ac0a8e40..df5311eb8 100644
--- a/Source/MediaStorageAndFileFormat/gdcmStrictScanner2.h
+++ b/Source/MediaStorageAndFileFormat/gdcmStrictScanner2.h
@@ -53,7 +53,7 @@ class GDCM_EXPORT StrictScanner2 : public Subject {
friend std::ostream &operator<<(std::ostream &_os, const StrictScanner2 &s);
public:
- StrictScanner2() : Values(), Filenames(), PublicMappings(), PrivateMappings() {}
+ StrictScanner2() : Values(), Filenames(), PublicMappings(), PrivateMappings(), Progress(0.0) {}
~StrictScanner2() override;
/// struct to map a filename to a value
diff --git a/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx b/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx
index 2d777a312..4d4a9d55c 100644
--- a/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx
+++ b/Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx
@@ -120,11 +120,10 @@ const char* UIDGenerator::Generate()
{
int idx = 0;
bool found = false;
- std::bitset<8> x;
while( !found && idx < 16 ) /* 16 is insane ... oh well */
{
// too bad ! randbytesbuf is too long, let's try to truncate the high bits a little
- x = uuid[idx];
+ std::bitset<8> x = uuid[idx];
unsigned int i = 0;
while( ( Unique.size() + len > 64 ) && i < 8 )
{
diff --git a/Testing/Source/DataDictionary/Cxx/TestDictEntry.cxx b/Testing/Source/DataDictionary/Cxx/TestDictEntry.cxx
index 762392592..1b8b8f87f 100644
--- a/Testing/Source/DataDictionary/Cxx/TestDictEntry.cxx
+++ b/Testing/Source/DataDictionary/Cxx/TestDictEntry.cxx
@@ -47,10 +47,6 @@ int TestDictEntry(int, char *[])
return 1;
}
- if( ! (pt2 < pt3) )
- {
- return 1;
- }
if( ! (pt2 < pt4) )
{
return 1;
-----------------------------------------------------------------------
Summary of changes:
Source/Common/gdcmEvent.h | 2 +-
Source/Common/gdcmSystem.cxx | 7 +++----
Source/Common/gdcmUnpacker12Bits.cxx | 12 +++++-------
Source/Common/zipstreamimpl.hpp | 17 ++++++++---------
.../gdcmBasicOffsetTable.h | 1 -
.../DataStructureAndEncodingDefinition/gdcmFragment.h | 8 ++------
Source/MediaStorageAndFileFormat/gdcmBitmap.cxx | 2 --
Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx | 13 +++++--------
Source/MediaStorageAndFileFormat/gdcmScanner2.h | 2 +-
Source/MediaStorageAndFileFormat/gdcmStrictScanner2.h | 2 +-
Source/MediaStorageAndFileFormat/gdcmUIDGenerator.cxx | 3 +--
Testing/Source/DataDictionary/Cxx/TestDictEntry.cxx | 4 ----
12 files changed, 27 insertions(+), 46 deletions(-)
hooks/post-receive
--
Grassroots DICOM
|