Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/application
diff options
context:
space:
mode:
authorKai Blaschke <kai.blaschke@kb-dev.net>2024-02-19 16:55:19 +0100
committerKai Blaschke <kai.blaschke@kb-dev.net>2024-02-19 16:55:19 +0100
commit431a9c00a56cf4c603be1cf5f773b193621d8150 (patch)
tree95843aeea9fb6dc18279ee05ff6961f40b19798f /source/application
parent30e1871d3f44629e00a1f66d8164e3e62c7f889f (diff)
Fixed a huge amount of Clang warnings
On Linux and macOS, using Clang to compile OpenStarbound produces about 400 MB worth of warnings during the build, making the compiler output unreadable and slowing the build down considerably. 99% of the warnings were unqualified uses of std::move and std::forward, which are now all properly qualified. Fixed a few other minor warnings about non-virtual destructors and some uses of std::move preventing copy elision on temporary objects. Most remaining warnings are now unused parameters.
Diffstat (limited to 'source/application')
-rw-r--r--source/application/StarApplication.cpp4
-rw-r--r--source/application/StarMainApplication_sdl.cpp14
-rw-r--r--source/application/StarP2PNetworkingService_pc.cpp14
-rw-r--r--source/application/StarPlatformServices_pc.cpp2
-rw-r--r--source/application/StarRenderer.cpp14
-rw-r--r--source/application/StarRenderer_opengl20.cpp12
-rw-r--r--source/application/StarTextureAtlas.hpp6
7 files changed, 35 insertions, 31 deletions
diff --git a/source/application/StarApplication.cpp b/source/application/StarApplication.cpp
index e894673..319b669 100644
--- a/source/application/StarApplication.cpp
+++ b/source/application/StarApplication.cpp
@@ -7,11 +7,11 @@ namespace Star {
void Application::startup(StringList const&) {}
void Application::applicationInit(ApplicationControllerPtr appController) {
- m_appController = move(appController);
+ m_appController = std::move(appController);
}
void Application::renderInit(RendererPtr renderer) {
- m_renderer = move(renderer);
+ m_renderer = std::move(renderer);
}
void Application::windowChanged(WindowMode, Vec2U) {}
diff --git a/source/application/StarMainApplication_sdl.cpp b/source/application/StarMainApplication_sdl.cpp
index 48b7fa5..08d3813 100644
--- a/source/application/StarMainApplication_sdl.cpp
+++ b/source/application/StarMainApplication_sdl.cpp
@@ -206,7 +206,7 @@ ControllerButton controllerButtonFromSdlControllerButton(uint8_t button) {
class SdlPlatform {
public:
SdlPlatform(ApplicationUPtr application, StringList cmdLineArgs) {
- m_application = move(application);
+ m_application = std::move(application);
// extract application path from command line args
String applicationPath = cmdLineArgs.first();
@@ -215,7 +215,7 @@ public:
StringList platformArguments;
eraseWhere(cmdLineArgs, [&platformArguments](String& argument) {
if (argument.beginsWith("+platform")) {
- platformArguments.append(move(argument));
+ platformArguments.append(std::move(argument));
return true;
}
return false;
@@ -461,7 +461,7 @@ private:
Maybe<String> string;
if (SDL_HasClipboardText()) {
if (auto text = SDL_GetClipboardText()) {
- if (*text != NULL)
+ if (*text != '\0')
string.emplace(text);
SDL_free(text);
}
@@ -482,7 +482,7 @@ private:
}
void setApplicationTitle(String title) override {
- parent->m_windowTitle = move(title);
+ parent->m_windowTitle = std::move(title);
if (parent->m_sdlWindow)
SDL_SetWindowTitle(parent->m_sdlWindow, parent->m_windowTitle.utf8Ptr());
}
@@ -817,10 +817,10 @@ private:
else
operations = { FlipImageOperation{ FlipImageOperation::Mode::FlipY } };
- auto newImage = std::make_shared<Image>(move(processImageOperations(operations, *image)));
+ auto newImage = std::make_shared<Image>(processImageOperations(operations, *image));
// Fix fully transparent pixels inverting the underlying display pixel on Windows (allowing this could be made configurable per cursor later!)
newImage->forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) { if (!pixel[3]) pixel[0] = pixel[1] = pixel[2] = 0; });
- entry->image = move(newImage);
+ entry->image = std::move(newImage);
auto size = entry->image->size();
@@ -907,7 +907,7 @@ private:
int runMainApplication(ApplicationUPtr application, StringList cmdLineArgs) {
try {
{
- SdlPlatform platform(move(application), move(cmdLineArgs));
+ SdlPlatform platform(std::move(application), std::move(cmdLineArgs));
platform.run();
}
Logger::info("Application: stopped gracefully");
diff --git a/source/application/StarP2PNetworkingService_pc.cpp b/source/application/StarP2PNetworkingService_pc.cpp
index 0170eb0..f13bb62 100644
--- a/source/application/StarP2PNetworkingService_pc.cpp
+++ b/source/application/StarP2PNetworkingService_pc.cpp
@@ -19,9 +19,9 @@ PcP2PNetworkingService::PcP2PNetworkingService(PcPlatformServicesStatePtr state)
: m_callbackConnectionFailure(this, &PcP2PNetworkingService::steamOnConnectionFailure),
m_callbackJoinRequested(this, &PcP2PNetworkingService::steamOnJoinRequested),
m_callbackSessionRequest(this, &PcP2PNetworkingService::steamOnSessionRequest),
- m_state(move(state)) {
+ m_state(std::move(state)) {
#else
- : m_state(move(state)) {
+ : m_state(std::move(state)) {
#endif
#ifdef STAR_ENABLE_DISCORD_INTEGRATION
@@ -224,7 +224,7 @@ Either<String, P2PSocketUPtr> PcP2PNetworkingService::connectToPeer(P2PNetworkin
if (type == "discord") {
auto remoteUserId = lexicalCast<discord::UserId>(peerId.extract("_"));
auto lobbyId = lexicalCast<discord::LobbyId>(peerId.extract("_"));
- String lobbySecret = move(peerId);
+ String lobbySecret = std::move(peerId);
return makeRight(discordConnectRemote(remoteUserId, lobbyId, lobbySecret));
}
}
@@ -242,7 +242,7 @@ void PcP2PNetworkingService::addPendingJoin(String connectionString) {
if (connectionString.extract(":") != "connect")
throw ApplicationException::format("malformed connection string '{}'", connectionString);
- String target = move(connectionString);
+ String target = std::move(connectionString);
String targetType = target.extract("_");
if (targetType == "address")
@@ -357,7 +357,7 @@ void PcP2PNetworkingService::steamReceiveAll() {
SteamNetworking()->ReadP2PPacket(data.ptr(), messageSize, &messageSize, &messageRemoteUser);
if (auto openSocket = m_steamOpenSockets.value(messageRemoteUser.ConvertToUint64())) {
MutexLocker socketLocker(openSocket->mutex);
- openSocket->incoming.append(move(data));
+ openSocket->incoming.append(std::move(data));
}
}
}
@@ -474,7 +474,7 @@ P2PSocketUPtr PcP2PNetworkingService::discordConnectRemote(discord::UserId remot
}
});
- return unique_ptr<P2PSocket>(move(socket));
+ return unique_ptr<P2PSocket>(std::move(socket));
}
void PcP2PNetworkingService::discordOnReceiveMessage(discord::LobbyId lobbyId, discord::UserId userId, discord::NetworkChannelId channel, uint8_t* data, uint32_t size) {
@@ -507,7 +507,7 @@ void PcP2PNetworkingService::discordOnLobbyMemberConnect(discord::LobbyId lobbyI
socket->mode = DiscordSocketMode::Connected;
m_discordOpenSockets[userId] = socket.get();
- m_pendingIncomingConnections.append(move(socket));
+ m_pendingIncomingConnections.append(std::move(socket));
Logger::info("Accepted new discord connection from remote user {}", userId);
}
}
diff --git a/source/application/StarPlatformServices_pc.cpp b/source/application/StarPlatformServices_pc.cpp
index 7023129..8f940b3 100644
--- a/source/application/StarPlatformServices_pc.cpp
+++ b/source/application/StarPlatformServices_pc.cpp
@@ -118,7 +118,7 @@ PcPlatformServicesUPtr PcPlatformServices::create(String const& path, StringList
for (auto& argument : platformArguments) {
if (argument.beginsWith("+platform:connect:")) {
Logger::info("PC platform services joining from command line argument '{}'", argument);
- p2pNetworkingService->addPendingJoin(move(argument));
+ p2pNetworkingService->addPendingJoin(std::move(argument));
} else {
throw ApplicationException::format("Unrecognized PC platform services command line argument '{}'", argument);
}
diff --git a/source/application/StarRenderer.cpp b/source/application/StarRenderer.cpp
index f4aa4fe..764dd4a 100644
--- a/source/application/StarRenderer.cpp
+++ b/source/application/StarRenderer.cpp
@@ -19,7 +19,7 @@ RenderQuad::RenderQuad(Vec2F posA, Vec2F posB, Vec2F posC, Vec2F posD, Vec4B col
d = { posD, { 0, 0 }, color, param1 };
}
-RenderQuad::RenderQuad(TexturePtr tex, Vec2F minPosition, float textureScale, Vec4B color, float param1) : texture(move(tex)) {
+RenderQuad::RenderQuad(TexturePtr tex, Vec2F minPosition, float textureScale, Vec4B color, float param1) : texture(std::move(tex)) {
Vec2F size = Vec2F(texture->size());
a = { minPosition, { 0, 0 }, color, param1};
b = { { (minPosition[0] + size[0] * textureScale), minPosition[1] }, { size[0], 0 }, color, param1 };
@@ -27,7 +27,7 @@ RenderQuad::RenderQuad(TexturePtr tex, Vec2F minPosition, float textureScale, Ve
d = { { minPosition[0], (minPosition[1] + size[1] * textureScale) }, { 0, size[1] }, color, param1 };
}
-RenderQuad::RenderQuad(TexturePtr tex, RectF const& screenCoords, Vec4B color, float param1) : texture(move(tex)) {
+RenderQuad::RenderQuad(TexturePtr tex, RectF const& screenCoords, Vec4B color, float param1) : texture(std::move(tex)) {
Vec2F size = Vec2F(texture->size());
a = { screenCoords.min(), { 0, 0 }, color, param1 };
b = { { screenCoords.xMax(), screenCoords.yMin(), }, { size[0], 0.f }, color, param1 };
@@ -35,7 +35,7 @@ RenderQuad::RenderQuad(TexturePtr tex, RectF const& screenCoords, Vec4B color, f
d = { { screenCoords.xMin(), screenCoords.yMax(), }, { 0.f, size[1] }, color, param1 };
}
-RenderQuad::RenderQuad(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec2F posD, Vec2F uvD, Vec4B color, float param1) : texture(move(tex)) {
+RenderQuad::RenderQuad(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec2F posD, Vec2F uvD, Vec4B color, float param1) : texture(std::move(tex)) {
a = { posA, uvA, color, param1 };
b = { posB, uvB, color, param1 };
c = { posC, uvC, color, param1 };
@@ -43,7 +43,7 @@ RenderQuad::RenderQuad(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F
}
RenderQuad::RenderQuad(TexturePtr tex, RenderVertex vA, RenderVertex vB, RenderVertex vC, RenderVertex vD)
- : texture(move(tex)), a(move(vA)), b(move(vB)), c(move(vC)), d(move(vD)) {}
+ : texture(std::move(tex)), a(std::move(vA)), b(std::move(vB)), c(std::move(vC)), d(std::move(vD)) {}
RenderQuad::RenderQuad(RectF const& rect, Vec4B color, float param1)
: a{ rect.min(), {}, color, param1 }
@@ -64,18 +64,18 @@ RenderTriangle::RenderTriangle(Vec2F posA, Vec2F posB, Vec2F posC, Vec4B color,
c = { posC, { 0, 0 }, color, param1 };
}
-RenderTriangle::RenderTriangle(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec4B color, float param1) : texture(move(tex)) {
+RenderTriangle::RenderTriangle(TexturePtr tex, Vec2F posA, Vec2F uvA, Vec2F posB, Vec2F uvB, Vec2F posC, Vec2F uvC, Vec4B color, float param1) : texture(std::move(tex)) {
a = { posA, uvA, color, param1 };
b = { posB, uvB, color, param1 };
c = { posC, uvC, color, param1 };
}
RenderQuad renderTexturedRect(TexturePtr texture, Vec2F minPosition, float textureScale, Vec4B color, float param1) {
- return RenderQuad(move(texture), minPosition, textureScale, color, param1);
+ return RenderQuad(std::move(texture), minPosition, textureScale, color, param1);
}
RenderQuad renderTexturedRect(TexturePtr texture, RectF const& screenCoords, Vec4B color, float param1) {
- return RenderQuad(move(texture), screenCoords, color, param1);
+ return RenderQuad(std::move(texture), screenCoords, color, param1);
}
RenderQuad renderFlatRect(RectF const& rect, Vec4B color, float param1) {
diff --git a/source/application/StarRenderer_opengl20.cpp b/source/application/StarRenderer_opengl20.cpp
index f85f0e8..18f771b 100644
--- a/source/application/StarRenderer_opengl20.cpp
+++ b/source/application/StarRenderer_opengl20.cpp
@@ -416,7 +416,7 @@ List<RenderPrimitive>& OpenGl20Renderer::immediatePrimitives() {
}
void OpenGl20Renderer::render(RenderPrimitive primitive) {
- m_immediatePrimitives.append(move(primitive));
+ m_immediatePrimitives.append(std::move(primitive));
}
void OpenGl20Renderer::renderBuffer(RenderBufferPtr const& renderBuffer, Mat3F const& transformation) {
@@ -672,7 +672,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
glBufferData(GL_ARRAY_BUFFER, accumulationBuffer.size(), accumulationBuffer.ptr(), GL_STREAM_DRAW);
}
- vertexBuffers.emplace_back(move(vb));
+ vertexBuffers.emplace_back(std::move(vb));
currentTextures.clear();
currentTextureSizes.clear();
@@ -701,7 +701,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
if (auto gt = as<GlGroupedTexture>(texture.get()))
gt->incrementBufferUseCount();
- usedTextures.add(move(texture));
+ usedTextures.add(std::move(texture));
return {float(textureIndex), Vec2F(glTexture->glTextureCoordinateOffset())};
};
@@ -723,14 +723,14 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
Texture* lastTexture = nullptr;
for (auto& primitive : primitives) {
if (auto tri = primitive.ptr<RenderTriangle>()) {
- tie(textureIndex, textureOffset) = addCurrentTexture(move(tri->texture));
+ tie(textureIndex, textureOffset) = addCurrentTexture(std::move(tri->texture));
appendBufferVertex(tri->a, textureIndex, textureOffset);
appendBufferVertex(tri->b, textureIndex, textureOffset);
appendBufferVertex(tri->c, textureIndex, textureOffset);
} else if (auto quad = primitive.ptr<RenderQuad>()) {
- tie(textureIndex, textureOffset) = addCurrentTexture(move(quad->texture));
+ tie(textureIndex, textureOffset) = addCurrentTexture(std::move(quad->texture));
appendBufferVertex(quad->a, textureIndex, textureOffset);
appendBufferVertex(quad->b, textureIndex, textureOffset);
@@ -742,7 +742,7 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
} else if (auto poly = primitive.ptr<RenderPoly>()) {
if (poly->vertexes.size() > 2) {
- tie(textureIndex, textureOffset) = addCurrentTexture(move(poly->texture));
+ tie(textureIndex, textureOffset) = addCurrentTexture(std::move(poly->texture));
for (size_t i = 1; i < poly->vertexes.size() - 1; ++i) {
appendBufferVertex(poly->vertexes[0], textureIndex, textureOffset);
diff --git a/source/application/StarTextureAtlas.hpp b/source/application/StarTextureAtlas.hpp
index db5a163..595f6ba 100644
--- a/source/application/StarTextureAtlas.hpp
+++ b/source/application/StarTextureAtlas.hpp
@@ -33,6 +33,8 @@ public:
TextureAtlasSet(unsigned cellSize, unsigned atlasNumCells);
+ virtual ~TextureAtlasSet() = default;
+
// The constant square size of all atlas textures
Vec2U atlasTextureSize() const;
@@ -88,6 +90,8 @@ private:
};
struct TextureEntry : Texture {
+ virtual ~TextureEntry() = default;
+
Vec2U imageSize() const override;
AtlasTextureHandle const& atlasTexture() const override;
@@ -168,7 +172,7 @@ auto TextureAtlasSet<AtlasTextureHandle>::addTexture(Image const& image, bool bo
return nullptr;
auto textureEntry = make_shared<TextureEntry>();
- textureEntry->textureImage = move(finalImage);
+ textureEntry->textureImage = std::move(finalImage);
textureEntry->atlasPlacement = *placement;
m_textures.add(textureEntry);