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 #179

Closed
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
4 changes: 2 additions & 2 deletions Source/DataStructureAndEncodingDefinition/gdcmElement.h
Original file line number Diff line number Diff line change
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here. This is suppressing a warning, not fixing anything...

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 3rd party code, so needs separate handling.

Is this reversal of logic fixed upstream already perhaps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it's 3rd party code but may be a usage of 3rd party library.
Also, it does not seem to be a reversal of logic. This code sample was edited 8 years ago.

I made this change to align logic with the following exception message which is ""params.Xthumbnail is > 0 but params.thumbnail == null_ptr""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it's 3rd party code but may be a usage of 3rd party library.

It definitely is: https://github.com/team-charls/charls

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
2 changes: 1 addition & 1 deletion Utilities/gdcmcharls/lookuptable.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CTable

CTable()
{
::memset(_rgtype, 0, sizeof(_rgtype));
::memset((void*)_rgtype, 0, sizeof(_rgtype));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, this isn't fixing anything, it's just suppressing the warning... and the warning looks correct to me.

}

void AddEntry(uint8_t bvalue, Code c)
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
12 changes: 8 additions & 4 deletions Utilities/socketxx/socket++/fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ Fork::~Fork ()
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)
{
ForkProcess* cur = Fork::ForkProcess::list;
while(cur != nullptr){
ForkProcess* next = cur->next;
if(cur->kill_child)
delete cur;

cur = next;
}

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

Expand Down
Loading