Misc: fix compiler warning: implicit declaration of function

This commit is contained in:
oltolm 2026-02-04 22:22:16 +01:00
parent a8fbe8f28f
commit 60351c19cc
7 changed files with 41 additions and 40 deletions

View File

@ -124,7 +124,7 @@ private:
PIMAGE_DATA_DIRECTORY directories;
};
void CompatPatchesInstall(LdrWatcher* watcher)
static void CompatPatchesInstall(LdrWatcher* watcher)
{
watcher->Install({{L"EZFRD64.dll", L"811EZFRD64.DLL"}, [](const LdrDllLoadEvent& event) {
// *EZFRD64 is included in software packages for cheapo third-party gamepads

View File

@ -12,7 +12,7 @@
namespace Win32TAPHelper
{
bool IsTAPDevice(const TCHAR* guid)
static bool IsTAPDevice(const TCHAR* guid)
{
HKEY netcard_key;
LONG status;
@ -88,7 +88,7 @@ bool IsTAPDevice(const TCHAR* guid)
return false;
}
bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
static bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
{
LONG status;
HKEY control_net_key;
@ -155,7 +155,7 @@ bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
return !guids.empty();
}
bool OpenTAP(HANDLE& adapter, const std::basic_string<TCHAR>& device_guid)
static bool OpenTAP(HANDLE& adapter, const std::basic_string<TCHAR>& device_guid)
{
auto const device_path = USERMODEDEVICEDIR + device_guid + TAPSUFFIX;

View File

@ -69,8 +69,9 @@ enum class AuthenticationMethod : bool
// BluetoothAuthenticateDeviceEx requires a bunch of rigmarole.. maybe some other day.
#pragma warning(push)
#pragma warning(disable : 4995)
bool AuthenticateWiimote(HANDLE radio_handle, const BLUETOOTH_RADIO_INFO& radio_info,
BLUETOOTH_DEVICE_INFO_STRUCT* btdi, AuthenticationMethod auth_method)
static bool AuthenticateWiimote(HANDLE radio_handle, const BLUETOOTH_RADIO_INFO& radio_info,
BLUETOOTH_DEVICE_INFO_STRUCT* btdi,
AuthenticationMethod auth_method)
{
// When pressing the sync button, the remote expects the host's address as the pass key.
// When pressing 1+2 it expects its own address.
@ -106,7 +107,7 @@ bool AuthenticateWiimote(HANDLE radio_handle, const BLUETOOTH_RADIO_INFO& radio_
}
#pragma warning(pop)
std::optional<USBUtils::DeviceInfo> GetDeviceInfo(const WCHAR* hid_iface)
static std::optional<USBUtils::DeviceInfo> GetDeviceInfo(const WCHAR* hid_iface)
{
// libusb opens without read/write access to get attributes, so we'll do that too.
constexpr auto open_access = 0;
@ -296,15 +297,15 @@ u32 RemoveWiimoteBluetoothDevices(std::invocable<BLUETOOTH_DEVICE_INFO> auto&& s
// If they are *not* authenticated there's apparently no feasible way to reconnect them.
// We remove these problematic remembered devices so we can reconnect them.
// Otherwise, the user would need to manually deleting the device in control panel.
u32 RemoveUnusableWiimoteBluetoothDevices()
static u32 RemoveUnusableWiimoteBluetoothDevices()
{
return RemoveWiimoteBluetoothDevices([](const BLUETOOTH_DEVICE_INFO& btdi) {
return btdi.fRemembered && !btdi.fConnected && !btdi.fAuthenticated;
});
}
u32 DiscoverAndPairWiimotes(u8 inquiry_length,
std::optional<AuthenticationMethod> auth_method = std::nullopt)
static u32 DiscoverAndPairWiimotes(u8 inquiry_length,
std::optional<AuthenticationMethod> auth_method = std::nullopt)
{
u32 success_count = 0;
EnumerateBluetoothWiimotes(
@ -374,7 +375,7 @@ void WiimoteScannerWindows::Update()
}
// See http://wiibrew.org/wiki/Wiimote for the Report IDs and its sizes
size_t GetReportSize(u8 rid)
static size_t GetReportSize(u8 rid)
{
using namespace WiimoteCommon;

View File

@ -59,7 +59,7 @@ void LogToFile(const char* fmt, ...)
va_end(args);
}
bool ProgressCallback(s64 total, s64 now, s64, s64)
static bool ProgressCallback(s64 total, s64 now, s64, s64)
{
UI::SetCurrentProgress(static_cast<int>(now), static_cast<int>(total));
return true;
@ -78,7 +78,7 @@ std::string HexEncode(const u8* buffer, size_t size)
return out;
}
bool HexDecode(const std::string& hex, u8* buffer, size_t size)
static bool HexDecode(const std::string& hex, u8* buffer, size_t size)
{
if (hex.size() != size * 2)
return false;
@ -107,7 +107,7 @@ bool HexDecode(const std::string& hex, u8* buffer, size_t size)
return true;
}
std::optional<std::string> GzipInflate(const std::string& data)
static std::optional<std::string> GzipInflate(const std::string& data)
{
z_stream zstrm;
zstrm.zalloc = nullptr;
@ -155,7 +155,7 @@ Manifest::Hash ComputeHash(const std::string& contents)
return out;
}
bool VerifySignature(const std::string& data, const std::string& b64_signature)
static bool VerifySignature(const std::string& data, const std::string& b64_signature)
{
u8 signature[64]; // ed25519 sig size.
size_t sig_size;
@ -174,7 +174,7 @@ bool VerifySignature(const std::string& data, const std::string& b64_signature)
pub_key.data());
}
void FlushLog()
static void FlushLog()
{
log_file.Flush();
log_file.Close();
@ -204,8 +204,8 @@ void TodoList::Log() const
}
}
bool DownloadContent(const std::vector<TodoList::DownloadOp>& to_download,
const std::string& content_base_url, const std::string& temp_path)
static bool DownloadContent(const std::vector<TodoList::DownloadOp>& to_download,
const std::string& content_base_url, const std::string& temp_path)
{
Common::HttpRequest req(std::chrono::seconds(30), ProgressCallback);
@ -266,14 +266,14 @@ bool DownloadContent(const std::vector<TodoList::DownloadOp>& to_download,
return true;
}
bool PlatformVersionCheck(const std::vector<TodoList::UpdateOp>& to_update,
const std::string& install_base_path, const std::string& temp_dir)
static bool PlatformVersionCheck(const std::vector<TodoList::UpdateOp>& to_update,
const std::string& install_base_path, const std::string& temp_dir)
{
UI::SetDescription("Checking platform...");
return Platform::VersionCheck(to_update, install_base_path, temp_dir);
}
TodoList ComputeActionsToDo(Manifest this_manifest, Manifest next_manifest)
static TodoList ComputeActionsToDo(Manifest this_manifest, Manifest next_manifest)
{
TodoList todo;
@ -317,7 +317,7 @@ TodoList ComputeActionsToDo(Manifest this_manifest, Manifest next_manifest)
return todo;
}
void CleanUpTempDir(const std::string& temp_dir, const TodoList& todo)
static void CleanUpTempDir(const std::string& temp_dir, const TodoList& todo)
{
// This is best-effort cleanup, we ignore most errors.
for (const auto& download : todo.to_download)
@ -325,7 +325,7 @@ void CleanUpTempDir(const std::string& temp_dir, const TodoList& todo)
File::DeleteDir(temp_dir);
}
bool BackupFile(const std::string& path)
static bool BackupFile(const std::string& path)
{
std::string backup_path = path + ".bak";
LogToFile("Backing up existing %s to .bak.\n", path.c_str());
@ -337,8 +337,8 @@ bool BackupFile(const std::string& path)
return true;
}
bool DeleteObsoleteFiles(const std::vector<TodoList::DeleteOp>& to_delete,
const std::string& install_base_path)
static bool DeleteObsoleteFiles(const std::vector<TodoList::DeleteOp>& to_delete,
const std::string& install_base_path)
{
for (const auto& op : to_delete)
{
@ -370,8 +370,8 @@ bool DeleteObsoleteFiles(const std::vector<TodoList::DeleteOp>& to_delete,
return true;
}
bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
const std::string& install_base_path, const std::string& temp_path)
static bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
const std::string& install_base_path, const std::string& temp_path)
{
#ifdef _WIN32
const auto self_path = std::filesystem::path(Common::GetModuleName(nullptr).value());
@ -479,8 +479,8 @@ bool UpdateFiles(const std::vector<TodoList::UpdateOp>& to_update,
return true;
}
bool PerformUpdate(const TodoList& todo, const std::string& install_base_path,
const std::string& content_base_url, const std::string& temp_path)
static bool PerformUpdate(const TodoList& todo, const std::string& install_base_path,
const std::string& content_base_url, const std::string& temp_path)
{
LogToFile("Starting download step...\n");
if (!DownloadContent(todo.to_download, content_base_url, temp_path))
@ -505,7 +505,7 @@ bool PerformUpdate(const TodoList& todo, const std::string& install_base_path,
return true;
}
void FatalError(const std::string& message)
static void FatalError(const std::string& message)
{
LogToFile("%s\n", message.c_str());
@ -513,7 +513,7 @@ void FatalError(const std::string& message)
UI::Error(message);
}
std::optional<Manifest> ParseManifest(const std::string& manifest)
static std::optional<Manifest> ParseManifest(const std::string& manifest)
{
Manifest parsed;
size_t pos = 0;
@ -556,7 +556,7 @@ std::optional<Manifest> ParseManifest(const std::string& manifest)
}
// Not showing a progress bar here because this part is just too quick
std::optional<Manifest> FetchAndParseManifest(const std::string& url)
static std::optional<Manifest> FetchAndParseManifest(const std::string& url)
{
Common::HttpRequest http;
@ -614,7 +614,7 @@ struct Options
std::optional<std::string> log_file;
};
std::optional<Options> ParseCommandLine(std::vector<std::string>& args)
static std::optional<Options> ParseCommandLine(std::vector<std::string>& args)
{
using optparse::OptionParser;

View File

@ -23,7 +23,7 @@ Gfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
return std::make_unique<D3DVertexFormat>(vtx_decl);
}
DXGI_FORMAT VarToD3D(ComponentFormat t, int size, bool integer)
static DXGI_FORMAT VarToD3D(ComponentFormat t, int size, bool integer)
{
using FormatMap = Common::EnumMap<DXGI_FORMAT, ComponentFormat::InvalidFloat7>;
static constexpr auto f = [](FormatMap a) { return a; }; // Deduction helper

View File

@ -246,9 +246,9 @@ static VersionCheckResult OSVersionCheck(const BuildInfo& build_info)
return result;
}
std::optional<BuildInfos> InitBuildInfos(const std::vector<TodoList::UpdateOp>& to_update,
const std::string& install_base_path,
const std::string& temp_dir)
static std::optional<BuildInfos> InitBuildInfos(const std::vector<TodoList::UpdateOp>& to_update,
const std::string& install_base_path,
const std::string& temp_dir)
{
const auto op_it = std::ranges::find(to_update, "build_info.txt", &TodoList::UpdateOp::filename);
if (op_it == to_update.cend())
@ -278,7 +278,7 @@ std::optional<BuildInfos> InitBuildInfos(const std::vector<TodoList::UpdateOp>&
return build_infos;
}
bool CheckBuildInfo(const BuildInfos& build_infos)
static bool CheckBuildInfo(const BuildInfos& build_infos)
{
// The existing BuildInfo may have been modified. Be careful not to overly trust its contents!

View File

@ -55,7 +55,7 @@ constexpr int PADDING_HEIGHT = 5;
namespace UI
{
bool InitWindow()
static bool InitWindow()
{
InitCommonControls();
@ -206,7 +206,7 @@ void SetDescription(const std::string& text)
SetWindowText(label_handle, UTF8ToWString(text).c_str());
}
void MessageLoop()
static void MessageLoop()
{
HRESULT result = CoInitializeEx(nullptr, COINIT_MULTITHREADED);