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

Fix compiler warnings #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dirk-zimoch
Copy link
Contributor

No description provided.

This can lead to memory deleted twice.
Recent compilers complain about using memset on a class with non-trivial
copy-assignment operator. However, this is used in the the impementation
of that operator. Cast to void* to silence the warning.
@@ -114,7 +114,7 @@ inline void gdd::setStatSevr(aitInt16 stat, aitInt16 sevr)
{ status.s.aitStat = stat; status.s.aitSevr = sevr; }

inline gdd& gdd::operator=(const gdd& v)
{ memcpy(this,&v,sizeof(gdd)); return *this; }
{ memcpy(static_cast<void*>(this),&v,sizeof(gdd)); return *this; }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recent compilers complain about using memset on a class with non-trivial
copy-assignment operator. However, this is used in the the impementation
of that operator. Cast to void* to silence the warning.

pdd->unreference();
delete [] buf;
Copy link
Contributor Author

@dirk-zimoch dirk-zimoch Feb 6, 2025

Choose a reason for hiding this comment

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

don't unreferenced pdd with borrowed memory buf

This can lead to double delete.

@@ -24,7 +24,6 @@
casCoreClient::casCoreClient ( caServerI & serverInternal ) :
eventSys ( *this )
{
assert ( & serverInternal );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Address of variable can never be NULL.

@@ -423,7 +423,7 @@ void casDGIntfIO::sendBeaconIO ( char & msg, unsigned length,
osiSockAddrNode *pAddr = reinterpret_cast<osiSockAddrNode *>(pNode);

ssize_t status = sendto(this->beaconSock, &msg, length, 0, &pAddr->addr.sa, sizeof(pAddr->addr.ia));
if ( status != length ) {
if ( status != static_cast<ssize_t>(length) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Signed/unsigned mismatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant