- some coverity based cleanups

This commit is contained in:
SoftCoder 2017-10-08 20:31:42 -07:00
parent 9de36c32a3
commit d78f28983b
4 changed files with 11 additions and 2 deletions

View File

@ -65,16 +65,21 @@ FILENAME=$(echo "${PROJECT}" | tr '/' '_')_${DESCRIPTION}
export PATH="${PATH}:${COVERITY_ANALYSIS_ROOT}/bin"
sudo /sbin/sysctl vsyscall=emulate
# cleanup old build files
cd $CURRENTDIR
rm -rf build
./build-mg.sh -m 1
# Build using Coverity Scan build tool
echo "About to use cov-build to analyse code..."
cd build/
# cov-build --dir ${BUILDTOOL} make -j ${NUMCORES}
cov-build --dir ${BUILDTOOL} make -j ${NUMCORES}
# Create archive to upload to coverity
echo "About to send analyzed code to coverity website..."
tar czf ${FILENAME}.tar.gz ${BUILDTOOL}/
ls -la ${FILENAME}.tar.gz
# exit 1

View File

@ -2349,6 +2349,7 @@ unsigned int NetworkMessageSynchNetworkGameData::getPackedSizeHeader() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType=0;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormatHeader(),
packedData.messageType,

View File

@ -2188,12 +2188,15 @@ void BroadCastClientSocketThread::execute() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
try {
char buff[10024]=""; // Buffers the data to be broadcasted.
char buff[10025]=""; // Buffers the data to be broadcasted.
// Keep getting packets forever.
for( time_t elapsed = time(NULL); difftime((long int)time(NULL),elapsed) <= 5; ) {
alen = sizeof(struct sockaddr);
int nb=0;// The number of bytes read.
bool gotData = (nb = recvfrom(bcfd, buff, 10024, 0, (struct sockaddr *) &bcSender, &alen)) > 0;
if(nb >= 0) {
buff[nb]=0;
}
//printf("Broadcasting client nb = %d buff [%s] gotData = %d\n",nb,buff,gotData);

View File

@ -103,7 +103,7 @@ public:
BaseThread *base_thread = dynamic_cast<BaseThread *>(thread);
if(base_thread != NULL &&
(base_thread->getRunningStatus() == true || base_thread->getExecutingTask() == true)) {
if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = %p [%s]\n",__LINE__,thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a"));
if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = %p [%s]\n",__LINE__,thread,base_thread->getUniqueID().c_str());
base_thread->signalQuit();
sleep(10);