From 18e1440947a69972c697fc272870586dba2388b4 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 13 Mar 2025 20:28:29 +0100 Subject: [PATCH] Codefix: move or pass by reference instead of copy --- src/screenshot.cpp | 2 +- src/screenshot.h | 2 +- src/script/api/script_admin.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 9d03244edc..1d7898b7b9 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -454,7 +454,7 @@ static bool RealMakeScreenshot(ScreenshotType t, const std::string &name, uint32 * @return true iff the screenshot was successfully made. * @see MakeScreenshotWithConfirm */ -bool MakeScreenshot(ScreenshotType t, std::string name, uint32_t width, uint32_t height) +bool MakeScreenshot(ScreenshotType t, const std::string &name, uint32_t width, uint32_t height) { if (t == SC_CRASHLOG) { /* Video buffer might or might not be locked. */ diff --git a/src/screenshot.h b/src/screenshot.h index c2c46d43d6..6e8a53ea9d 100644 --- a/src/screenshot.h +++ b/src/screenshot.h @@ -26,7 +26,7 @@ enum ScreenshotType : uint8_t { void SetupScreenshotViewport(ScreenshotType t, struct Viewport *vp, uint32_t width = 0, uint32_t height = 0); bool MakeHeightmapScreenshot(const char *filename); void MakeScreenshotWithConfirm(ScreenshotType t); -bool MakeScreenshot(ScreenshotType t, std::string name, uint32_t width = 0, uint32_t height = 0); +bool MakeScreenshot(ScreenshotType t, const std::string &name, uint32_t width = 0, uint32_t height = 0); bool MakeMinimapWorldScreenshot(); extern std::string _screenshot_format_name; diff --git a/src/script/api/script_admin.cpp b/src/script/api/script_admin.cpp index 957057f955..5f11aa18cb 100644 --- a/src/script/api/script_admin.cpp +++ b/src/script/api/script_admin.cpp @@ -91,7 +91,7 @@ bool ScriptAdminMakeJSON(nlohmann::json &json, HSQUIRRELVM vm, SQInteger index, return false; } - json[key] = std::move(value); + json[std::move(key)] = std::move(value); } sq_pop(vm, 1); return true;