Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce number of warnings #177

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Source/DataStructureAndEncodingDefinition/gdcmByteValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <iterator>
#include <iomanip>
#include <algorithm>
#include <cstring>

namespace gdcm_ns
{
Expand All @@ -34,14 +35,15 @@ using namespace gdcm;
class GDCM_EXPORT ByteValue : public Value
{
public:
ByteValue(const char* array = nullptr, VL const &vl = 0):
Internal(array, array+vl),Length(vl) {
ByteValue(const char* array = nullptr, VL const &vl = 0): Length(vl) {
if( vl.IsOdd() )
{
gdcmDebugMacro( "Odd length" );
Internal.resize(vl+1);
++Length;
}
Internal.resize(Length);
if(array)
std::memcpy(Internal.data(), array, Length);
}

/// \warning casting to uint32_t
Expand Down
8 changes: 4 additions & 4 deletions Source/DataStructureAndEncodingDefinition/gdcmElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static void x16printf(char *buf, int size, Float f) {
strcpy(buf, mant);
return;
}
strncpy(buf, mant, iexp + 1);
memcpy(buf, mant, iexp + 1);
buf[iexp + 1] = '.';
strncpy(buf + iexp + 2, mant + iexp + 1, size - iexp - 1);
buf[size] = 0;
Expand All @@ -409,7 +409,7 @@ static void x16printf(char *buf, int size, Float f) {
for(j=0; j< -1 - iexp; j++) {
buf[j+1] = '0';
}
strncpy(buf - iexp, mant, size + 1 + iexp);
memcpy(buf - iexp, mant, size + 1 + iexp);
buf[size] = 0;
clean(buf);
}
Expand Down Expand Up @@ -607,7 +607,7 @@ class Element<TVR, VM::VM1_n>
Save = true; // ????
if( Internal )
{
memcpy(internal, Internal, len);
memcpy((void*)internal, (void*)Internal, Length);
delete[] Internal;
}
Internal = internal;
Expand All @@ -622,7 +622,7 @@ class Element<TVR, VM::VM1_n>
bool save = false) {
if( save ) {
SetLength(len); // realloc
memcpy(Internal, array, len/*/sizeof(Type)*/);
memcpy((void*)Internal, (void*)array, len/*/sizeof(Type)*/);
assert( Save == false );
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Source/MediaStorageAndFileFormat/gdcmDataSetHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ VR DataSetHelper::ComputeVR(File const &file, DataSet const &ds, const Tag& tag)
{
// For Pixel Data:
// if( !ds.FindDataElement( bitsallocated ) ) return VR::UN;
Attribute<0x0028,0x0100> at;
// Attribute<0x0028,0x0100> at;
// at.SetFromDataElement( ds.GetDataElement( bitsallocated ) );
}
(void)v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int TestAT()
list[0] = Tag(0x0010,0x0010);
list[1] = Tag(0x0010,0x0020);
list[2] = Tag(0x0020,0x0013);
memcpy(&a, list, sizeof(list));
memcpy((void*)&a, (void*)list, sizeof(list));
a.Print( std::cout );
std::cout << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion Utilities/gdcmcharls/jpegmarkersegment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ unique_ptr<JpegMarkerSegment> JpegMarkerSegment::CreateJpegFileInterchangeFormat
content.push_back(static_cast<uint8_t>(params.Ythumbnail));
if (params.Xthumbnail > 0)
{
if (params.thumbnail)
if (!params.thumbnail)
throw CreateSystemError(ApiResult::InvalidJlsParameters, "params.Xthumbnail is > 0 but params.thumbnail == null_ptr");

content.insert(content.end(), static_cast<uint8_t*>(params.thumbnail),
Expand Down
1 change: 1 addition & 0 deletions Utilities/gdcmrle/io.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ int source::read_into_segments( char * out, int len, image_info const & ii )
int nvalues = read(out + 0 * llen, llen);
assert( nvalues == llen ); (void)nvalues;
bool b = seek(pos + 1 * plane);
(void)b;
assert(b);
nvalues = read(out + 1 * llen, llen);
assert( nvalues == llen ); (void)nvalues;
Expand Down
7 changes: 5 additions & 2 deletions Utilities/socketxx/socket++/fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ Fork::KillForks::~KillForks ()
// First, kill all children whose kill_child flag is set.
// Second, wait for other children to die.
{
for (ForkProcess* cur = Fork::ForkProcess::list; cur; cur = cur->next)
if (cur->kill_child)

for (ForkProcess* cur = Fork::ForkProcess::list; cur != nullptr; cur = cur->next)
if (cur->kill_child) {
delete cur;
break;
}

while (Fork::ForkProcess::list && wait (nullptr) > 0) {}
}
Expand Down
Loading