impr: Replace hex::unused with std::ignore

This commit is contained in:
WerWolv
2024-12-14 21:35:54 +01:00
parent 3f316e42f2
commit 7f75706584
43 changed files with 173 additions and 139 deletions

View File

@@ -79,7 +79,7 @@ namespace hex::paths {
#elif defined(OS_MACOS)
return getDataPaths(includeSystemFolders);
#elif defined(OS_LINUX) || defined(OS_WEB)
hex::unused(includeSystemFolders);
std::ignore = includeSystemFolders;
return {xdg::ConfigHomeDir() / "imhex"};
#endif
}

View File

@@ -51,13 +51,11 @@ namespace hex::fs {
}
#if defined(OS_WINDOWS)
hex::unused(
ShellExecuteW(nullptr, L"open", filePath.c_str(), nullptr, nullptr, SW_SHOWNORMAL)
);
std::ignore = ShellExecuteW(nullptr, L"open", filePath.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
#elif defined(OS_MACOS)
hex::unused(system(
std::ignore = system(
hex::format("open {}", wolv::util::toUTF8String(filePath)).c_str()
));
);
#elif defined(OS_LINUX)
executeCmd({"xdg-open", wolv::util::toUTF8String(filePath)});
#endif
@@ -73,9 +71,9 @@ namespace hex::fs {
auto args = fmt::format(L"\"{}\"", dirPath.c_str());
ShellExecuteW(nullptr, L"open", L"explorer.exe", args.c_str(), nullptr, SW_SHOWNORMAL);
#elif defined(OS_MACOS)
hex::unused(system(
std::ignore = system(
hex::format("open {}", wolv::util::toUTF8String(dirPath)).c_str()
));
);
#elif defined(OS_LINUX)
executeCmd({"xdg-open", wolv::util::toUTF8String(dirPath)});
#endif
@@ -91,12 +89,12 @@ namespace hex::fs {
auto args = fmt::format(L"/select,\"{}\"", selectedFilePath.c_str());
ShellExecuteW(nullptr, L"open", L"explorer.exe", args.c_str(), nullptr, SW_SHOWNORMAL);
#elif defined(OS_MACOS)
hex::unused(system(
std::ignore = system(
hex::format(
R"(osascript -e 'tell application "Finder" to reveal POSIX file "{}"')",
wolv::util::toUTF8String(selectedFilePath)
).c_str()
));
);
system(R"(osascript -e 'tell application "Finder" to activate')");
#elif defined(OS_LINUX)
// Fallback to only opening the folder for now

View File

@@ -41,17 +41,21 @@ namespace hex {
}
void HttpRequest::setProxyUrl(std::string proxy) {
hex::unused(proxy);
std::ignore = proxy;
}
void HttpRequest::setProxyState(bool state) {
hex::unused(state);
std::ignore = state;
}
void HttpRequest::checkProxyErrors() { }
int HttpRequest::progressCallback(void *contents, curl_off_t dlTotal, curl_off_t dlNow, curl_off_t ulTotal, curl_off_t ulNow) {
hex::unused(contents, dlTotal, dlNow, ulTotal, ulNow);
std::ignore = contents;
std::ignore = dlTotal;
std::ignore = dlNow;
std::ignore = ulTotal;
std::ignore = ulNow;
return -1;
}
}

View File

@@ -28,7 +28,9 @@ namespace hex {
void close() override { }
void readRaw(u64 offset, void *buffer, size_t size) override {
hex::unused(offset, buffer, size);
std::ignore = offset;
std::ignore = buffer;
std::ignore = size;
}
void writeRaw(u64 offset, const void *buffer, size_t size) override {
@@ -44,7 +46,7 @@ namespace hex {
}
void resizeRaw(u64 newSize) override {
hex::unused(newSize);
std::ignore = newSize;
}
void insertRaw(u64 offset, u64 size) override {

View File

@@ -336,13 +336,13 @@ namespace hex {
void startProgram(const std::string &command) {
#if defined(OS_WINDOWS)
hex::unused(system(hex::format("start {0}", command).c_str()));
std::ignore = system(hex::format("start {0}", command).c_str());
#elif defined(OS_MACOS)
hex::unused(system(hex::format("open {0}", command).c_str()));
std::ignore = system(hex::format("open {0}", command).c_str());
#elif defined(OS_LINUX)
executeCmd({"xdg-open", command});
#elif defined(OS_WEB)
hex::unused(command);
std::ignore = command;
#endif
}
@@ -839,7 +839,7 @@ namespace hex {
return dlopen(info.dli_fname, RTLD_LAZY);
#else
hex::unused(symbol);
std::ignore = symbol;
return nullptr;
#endif
}