fix msbuild warnings

This commit is contained in:
Sak32009 2024-08-24 19:57:23 +02:00
parent 00f7e73e98
commit 935d3405a9
4 changed files with 15 additions and 11 deletions

View File

@ -578,7 +578,7 @@ int Local_Storage::store_file_data(std::string folder, std::string file, const c
myfile.open(std::filesystem::u8path(folder + file), std::ios::binary | std::ios::out); myfile.open(std::filesystem::u8path(folder + file), std::ios::binary | std::ios::out);
if (!myfile.is_open()) return -1; if (!myfile.is_open()) return -1;
myfile.write(data, length); myfile.write(data, length);
int position = myfile.tellp(); int position = static_cast<int>(myfile.tellp());
myfile.close(); myfile.close();
return position; return position;
} }
@ -666,7 +666,8 @@ int Local_Storage::get_file_data(const std::string &full_path, char *data, unsig
myfile.read (data, max_length); myfile.read (data, max_length);
myfile.close(); myfile.close();
reset_LastError(); reset_LastError();
return myfile.gcount();
return static_cast<int>(myfile.gcount());
} }
int Local_Storage::get_data(std::string folder, std::string file, char *data, unsigned int max_length, unsigned int offset) int Local_Storage::get_data(std::string folder, std::string file, char *data, unsigned int max_length, unsigned int offset)
@ -700,7 +701,7 @@ int Local_Storage::count_files(std::string folder)
folder.append(PATH_SEPARATOR); folder.append(PATH_SEPARATOR);
} }
return get_filenames_recursive(save_directory + appid + folder).size(); return static_cast<int>(get_filenames_recursive(save_directory + appid + folder).size());
} }
bool Local_Storage::file_exists(std::string folder, std::string file) bool Local_Storage::file_exists(std::string folder, std::string file)

View File

@ -1384,7 +1384,7 @@ void Steam_Matchmaking::RunCallbacks()
PRINT_DEBUG("Lobby " "%" PRIu64 " use %u", l.room_id(), use); PRINT_DEBUG("Lobby " "%" PRIu64 " use %u", l.room_id(), use);
if (use) PUSH_BACK_IF_NOT_IN(filtered_lobbies, (uint64)l.room_id()); if (use) PUSH_BACK_IF_NOT_IN(filtered_lobbies, (uint64)l.room_id());
if (filtered_lobbies.size() >= filter_max_results_copy) { if (filtered_lobbies.size() >= static_cast<size_t>(filter_max_results_copy)) {
PRINT_DEBUG("returning lobby search results, count=%zu", filtered_lobbies.size()); PRINT_DEBUG("returning lobby search results, count=%zu", filtered_lobbies.size());
searching = false; searching = false;
LobbyMatchList_t data{}; LobbyMatchList_t data{};

View File

@ -807,7 +807,7 @@ void Steam_User_Stats::load_achievements_icons()
auto now1 = std::chrono::high_resolution_clock::now(); auto now1 = std::chrono::high_resolution_clock::now();
#endif #endif
size_t idx = 0; int idx = 0;
for (; for (;
idx < settings->paginated_achievements_icons && last_loaded_ach_icon < defined_achievements.size(); idx < settings->paginated_achievements_icons && last_loaded_ach_icon < defined_achievements.size();
++idx, ++last_loaded_ach_icon) { ++idx, ++last_loaded_ach_icon) {
@ -819,7 +819,7 @@ void Steam_User_Stats::load_achievements_icons()
#ifndef EMU_RELEASE_BUILD #ifndef EMU_RELEASE_BUILD
auto now2 = std::chrono::high_resolution_clock::now(); auto now2 = std::chrono::high_resolution_clock::now();
auto dd = (unsigned)std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count(); auto dd = (unsigned)std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count();
PRINT_DEBUG("attempted to load %zu achievements icons in %u ms", idx * 2, dd); PRINT_DEBUG("attempted to load %d achievements icons in %u ms", idx * 2, dd);
#endif #endif
} }

View File

@ -1,7 +1,8 @@
#define WIN32_LEAN_AND_MEAN
// #include "dll.h" // #include "dll.h"
#define WIN32_LEAN_AND_MEAN
#include "Windows.h" #include "Windows.h"
#ifdef _WIN64 #ifdef _WIN64
#define DLL_NAME "steam_api64.dll" #define DLL_NAME "steam_api64.dll"
#else #else
@ -11,8 +12,10 @@
extern "C" __declspec(dllexport) void *CreateInterface(const char *pName, int *pReturnCode) extern "C" __declspec(dllexport) void *CreateInterface(const char *pName, int *pReturnCode)
{ {
// PRINT_DEBUG("%s", pName); // PRINT_DEBUG("%s", pName);
HMODULE steam_api = LoadLibraryA(DLL_NAME); HMODULE steam_api = LoadLibraryA(DLL_NAME);
void *(__stdcall* create_interface)(const char*) = (void * (__stdcall *)(const char*))GetProcAddress(steam_api, "SteamInternal_CreateInterface");
void *(__stdcall * create_interface)(const char *) = reinterpret_cast<void *(__stdcall *)(const char *)>(GetProcAddress(steam_api, "SteamInternal_CreateInterface"));
return create_interface(pName); return create_interface(pName);
} }