Merge pull request #808 from Scrumplex/fix-lgtm-warnings

This commit is contained in:
Sefa Eyeoglu
2022-07-09 01:10:59 +02:00
committed by GitHub
8 changed files with 20 additions and 11 deletions

View File

@ -162,15 +162,15 @@ bool LocalPeer::sendMessage(const QByteArray &message, int timeout)
QLocalSocket socket;
bool connOk = false;
for(int i = 0; i < 2; i++) {
int tries = 2;
for(int i = 0; i < tries; i++) {
// Try twice, in case the other instance is just starting up
socket.connectToServer(socketName);
connOk = socket.waitForConnected(timeout/2);
if (connOk || i)
if (!connOk && i < (tries - 1))
{
break;
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
if (!connOk)
{

View File

@ -79,7 +79,7 @@ element_value *element_value::readElementValue(util::membuffer &input,
}
return new element_value_array(ARRAY, vals, pool);
default:
throw new java::classfile_exception();
throw java::classfile_exception();
}
}
}
}

View File

@ -17,7 +17,7 @@ public:
is_synthetic = false;
read_be(magic);
if (magic != 0xCAFEBABE)
throw new classfile_exception();
throw classfile_exception();
read_be(minor_version);
read_be(major_version);
constants.load(*this);
@ -153,4 +153,4 @@ public:
// FIXME: doesn't free up memory on delete
java::annotation_table visible_class_annotations;
};
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "errors.h"
#include "membuffer.h"
#include <sstream>
namespace java
@ -90,7 +91,7 @@ public:
break;
default:
// invalid constant type!
throw new classfile_exception();
throw classfile_exception();
}
}
constant(int)
@ -210,7 +211,7 @@ public:
{
if (constant_index == 0 || constant_index > constants.size())
{
throw new classfile_exception();
throw classfile_exception();
}
return constants[constant_index - 1];
}