Skip to content

Commit

Permalink
Merge pull request etternagame#1169 from nico-abram/msvc_warns
Browse files Browse the repository at this point in the history
Fix remaining MSVC warnings
  • Loading branch information
nico-abram authored May 14, 2022
2 parents 18baf86 + 48b798d commit d6d6318
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Etterna/Actor/Menus/OptionsList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ OptionsList::ExportRow(const std::string& sRow)
std::vector<bool> aSelections;
aSelections = m_bSelections[sRow];

m_Rows[sRow]->ExportOption(m_pn, aSelections);
(void)m_Rows[sRow]->ExportOption(m_pn, aSelections);
}

void
Expand Down Expand Up @@ -650,7 +650,7 @@ OptionsList::SelectionsChanged(const std::string& sRowName)
m_pLinked->ExportRow(sRowName);
}

ExportRow(sRowName);
(void)ExportRow(sRowName);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/MinaCalc/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Calc::CalcMain(const std::vector<NoteInfo>& NoteInfo,
/* finished all modifications to skillset values, set overall using
* sigmoidal aggregation, but only let it buff files, don't set anything
* below the highest skillset th */
auto agg = aggregate_skill(iteration_skillet_values, 0.25, 1.11, 0.0, 10.24);
float agg = aggregate_skill(iteration_skillet_values, 0.25L, (float)1.11, 0.0, (float)10.24);
auto highest = max_val(iteration_skillet_values);
iteration_skillet_values[Skill_Overall] = agg > highest ? agg : highest;

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Misc/Difficulty.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct Playlist

[[nodiscard]] auto CreateNode() const -> XNode*;
void LoadFromNode(const XNode* node);
auto GetNumCharts() -> int { return chartlist.size(); }
auto GetNumCharts() -> size_t { return chartlist.size(); }
auto GetKeys() -> std::vector<std::string>;
auto GetName() -> std::string { return name; }
auto GetAverageRating() -> float;
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Misc/OptionRowHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ class OptionRowHandlerSteps : public OptionRowHandler
if (*d == GAMESTATE->m_PreferredDifficulty) {
vbSelOut[i] = true;
matched = true;
ExportOption(p, vbSelectedOut); // current steps changed
(void)ExportOption(p, vbSelectedOut); // current steps changed
break;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Etterna/Singletons/NetworkSyncManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2108,10 +2108,11 @@ LuaFunction(IsSMOnlineLoggedIn, NSMAN->loggedIn)
{
auto& reqs = p->requests;
auto reqPtrToRemove = Luna<ChartRequest>::check(L, 1, true);
remove_if(
auto new_end = remove_if(
reqs.begin(), reqs.end(), [reqPtrToRemove](ChartRequest* req) {
return req == reqPtrToRemove;
});
reqs.erase(new_end, reqs.end());
// Keep it in case lua keeps a reference to it
p->staleRequests.push_back(reqPtrToRemove);
return 0;
Expand Down
8 changes: 4 additions & 4 deletions src/Etterna/Singletons/ScoreManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,12 +793,12 @@ ScoreManager::CalcPlayerRating(float& prating,
}

std::vector<float> ssrs = SortTopSSRPtrs(ss, profileID, true);
pskillsets[ss] = aggregate_skill(ssrs, 0.1, 1.05, 0.0, 10.24);
pskillsets[ss] = aggregate_skill(ssrs, 0.1L, (float)1.05, 0.0, (float)10.24);
CLAMP(pskillsets[ss], 0.F, 100.F);
skillz.push_back(pskillsets[ss]);
}

prating = aggregate_skill(skillz, 0.1, 1.125, 0.0, 10.24);
prating = aggregate_skill(skillz, 0.1L, (float)1.125, 0.0, (float)10.24);
pskillsets[Skill_Overall] = prating;
}

Expand Down Expand Up @@ -895,11 +895,11 @@ ScoreManager::GetPlayerRatingOverTime(const std::string& profileID) {
}

std::vector<float> ssrs = ssrsInUse[ss];
skillz[ss] = aggregate_skill(ssrs, 0.1, 1.05, 0.0, 10.24);
skillz[ss] = aggregate_skill(ssrs, 0.1L, (float)1.05, 0.0, (float)10.24);
CLAMP(skillz[ss], 0.F, 100.F);
}
skillz[Skill_Overall] =
aggregate_skill(skillz, 0.1, 1.125, 0.0, 10.24);
aggregate_skill(skillz, 0.1L, (float)1.125, 0.0, (float)10.24);
ssrsByDate.emplace(date, skillz);
}
};
Expand Down
7 changes: 6 additions & 1 deletion src/Etterna/Singletons/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1731,9 +1731,14 @@ class LunaPlaylist : public Luna<Playlist>
return 1;
}

static auto GetNumCharts(T* p, lua_State* L) -> int
{
lua_pushnumber(L, p->GetNumCharts());
return 1;
}

DEFINE_METHOD(GetAverageRating, GetAverageRating());
DEFINE_METHOD(GetName, GetName());
DEFINE_METHOD(GetNumCharts, GetNumCharts())
LunaPlaylist()
{
ADD_METHOD(AddChart);
Expand Down
2 changes: 1 addition & 1 deletion src/arch/Dialog/DialogDriver_Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ ErrorWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
}

// TODO: Return a different brush if the default is not desired
return (BOOL)hbr;
return (INT_PTR)hbr;
}
}
return FALSE;
Expand Down
12 changes: 6 additions & 6 deletions src/arch/InputHandler/InputHandler_Win32_MIDI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ static HMIDIIN g_device;
static void CALLBACK
midiCallback(HMIDIIN g_device,
UINT status,
DWORD instancePtr,
DWORD data,
DWORD_PTR instancePtr,
DWORD_PTR data,
DWORD timestamp);

static std::string
Expand All @@ -40,8 +40,8 @@ InputHandler_Win32_MIDI::InputHandler_Win32_MIDI()

MMRESULT result = midiInOpen(&g_device,
device_id,
(DWORD)&midiCallback,
(DWORD)this,
(DWORD_PTR)&midiCallback,
(DWORD_PTR)this,
CALLBACK_FUNCTION);
if (result != MMSYSERR_NOERROR) {
Locator::getLogger()->warn("Error opening MIDI device: {}", GetMidiError(result).c_str());
Expand Down Expand Up @@ -84,8 +84,8 @@ InputHandler_Win32_MIDI::GetDevicesAndDescriptions(
static void CALLBACK
midiCallback(HMIDIIN device,
UINT status,
DWORD instancePtr,
DWORD data,
DWORD_PTR instancePtr,
DWORD_PTR data,
DWORD timestamp)
{
if (status == MIM_DATA) {
Expand Down
2 changes: 1 addition & 1 deletion src/arch/LoadingWindow/LoadingWindow_Win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ LoadingWindow_Win32::SetIcon(const RageSurface* pIcon)
if (m_hIcon != nullptr)
// XXX: GCL_HICON isn't available on x86-64 Windows
#if _WIN64
SetClassLongPtr(hwnd, GCLP_HICON, (LONG)m_hIcon);
SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)m_hIcon);
#else
SetClassLong(hwnd, GCL_HICON, (LONG)m_hIcon);
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/archutils/Win32/GraphicsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ GraphicsWindow::CreateGraphicsWindow(const VideoModeParams& p,
if (g_hIcon != nullptr) {
#if _WIN64
SetClassLongPtr(
g_hWndMain, GCLP_HICON, (LONG)LoadIcon(nullptr, IDI_APPLICATION));
g_hWndMain, GCLP_HICON, (LONG_PTR)LoadIcon(nullptr, IDI_APPLICATION));
#else
SetClassLong(
g_hWndMain, GCL_HICON, (LONG)LoadIcon(NULL, IDI_APPLICATION));
Expand All @@ -361,7 +361,7 @@ GraphicsWindow::CreateGraphicsWindow(const VideoModeParams& p,
g_hIcon = IconFromFile(p.sIconFile);
if (g_hIcon != nullptr)
#if _WIN64
SetClassLongPtr(g_hWndMain, GCLP_HICON, (LONG)g_hIcon);
SetClassLongPtr(g_hWndMain, GCLP_HICON, (LONG_PTR)g_hIcon);
#else
SetClassLong(g_hWndMain, GCL_HICON, (LONG)g_hIcon);
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/archutils/Win32/arch_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ eventually go away) C4355: 'this' : used in base member initializer list

/* Pull in NT-only definitions. Note that we support Win98 and WinME; you can
* make NT calls, but be sure to fall back on 9x if they're not supported. */
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400
#endif

// If this isn't defined to 0, VC fails to define things like stat and alloca.
#define __STDC__ 0
Expand Down

0 comments on commit d6d6318

Please sign in to comment.