8000 Fix warnings reported by LGTM.com by Scrumplex · Pull Request #808 · PolyMC/PolyMC · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix warnings reported by LGTM.com #808

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

Merged
merged 1 commit into from
Jul 8, 2022
Merged
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
2 changes: 2 additions & 0 deletions launcher/minecraft/auth/AccountTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ QString AccountTask::getStateMessage() const
bool AccountTask::changeState(AccountTaskState newState, QString reason)
{
m_taskState = newState;
// FIXME: virtual method invoked in constructor.
// We want that behavior, but maybe make it less weird?
setStatus(getStateMessage());
switch(newState) {
case AccountTaskState::STATE_CREATED: {
Expand Down
2 changes: 1 addition & 1 deletion launcher/modplatform/flame/FlameAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class FlameAPI : public NetworkModAPI {
};

public:
static auto getMappedModLoader(const ModLoaderTypes loaders) -> const int
static auto getMappedModLoader(const ModLoaderTypes loaders) -> int
{
// https://docs.curseforge.com/?http#tocS_ModLoaderType
if (loaders & Forge)
Expand Down
5 changes: 5 additions & 0 deletions launcher/translations/POTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ POTranslator::POTranslator(const QString& filename, QObject* parent) : QTranslat
d->reload();
}

POTranslator::~POTranslator()
{
delete d;
}

QString POTranslator::translate(const char* context, const char* sourceText, const char* disambiguation, int n) const
{
if(disambiguation)
Expand Down
1 change: 1 addition & 0 deletions launcher/translations/POTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class POTranslator : public QTranslator
Q_OBJECT
public:
explicit POTranslator(const QString& filename, QObject * parent = nullptr);
virtual ~POTranslator();
QString translate(const char * context, const char * sourceText, const char * disambiguation, int n) const override;
bool isEmpty() const override;
private:
Expand Down
8 changes: 4 additions & 4 deletions libraries/LocalPeer/src/LocalPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions libraries/classparser/src/annotations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
4 changes: 2 additions & 2 deletions libraries/classparser/src/classfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class classfile : public util::membuffer
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);
Expand Down Expand Up @@ -153,4 +153,4 @@ class classfile : public util::membuffer
// FIXME: doesn't free up memory on delete
java::annotation_table visible_class_annotations;
};
}
}
5 changes: 3 additions & 2 deletions libraries/classparser/src/constants.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include "errors.h"
#include "membuffer.h"
#include <sstream>

namespace java
Expand Down Expand Up @@ -90,7 +91,7 @@ class constant
break;
default:
// invalid constant type!
throw new classfile_exception();
throw classfile_exception();
}
}
constant(int)
Expand Down Expand Up @@ -210,7 +211,7 @@ class constant_pool
{
if (constant_index == 0 || constant_index > constants.size())
{
throw new classfile_exception();
throw classfile_exception();
}
return constants[constant_index - 1];
}
Expand Down
0