From 160b5ac92a846038372225ab79e29166fd152949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 25 Aug 2022 03:28:05 +0200 Subject: Fix MSVC compatibility. --- c/data.cpp | 2 +- c/datalistview.cpp | 2 +- c/episodelistview.cpp | 4 ++-- c/ext.cpp | 6 ++++-- c/layout.cpp | 2 +- c/main.cpp | 10 +++++++--- c/resource.rc | 6 +++--- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/c/data.cpp b/c/data.cpp index 0ac27ce..4b8033a 100644 --- a/c/data.cpp +++ b/c/data.cpp @@ -112,7 +112,7 @@ void WaitFor(void (*f)(unsigned char*)) static int i = 0; if (sig & DONE) { - extern EpisodeListView* const g_elv; + extern EpisodeListView* g_elv; KillTimer(nullptr, iTimer); i = 0; sig = READY; /* Reset signals. */ diff --git a/c/datalistview.cpp b/c/datalistview.cpp index ec9592d..b63a342 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -88,7 +88,7 @@ void DataListView::ShowEpisode(const int iEpisode) LVFINDINFO lvfi; lvfi.flags = LVFI_PARAM; lvfi.lParam = iEpisode; - extern EpisodeListView* const g_elv; + extern EpisodeListView* g_elv; int iItem = ListView_FindItem(g_elv->hWnd, -1, &lvfi); if (iItem != -1) ListView_EnsureVisible(g_elv->hWnd, iItem, TRUE); diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 72a8618..8185b51 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -121,7 +121,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam) case LVN_ITEMCHANGED: /* Select/focus episode. */ if ((nm->uChanged & LVIF_STATE) && (nm->uNewState & LVIS_FOCUSED)) { - extern DataListView* const g_dlv; + extern DataListView* g_dlv; g_dlv->ShowEpisode(nm->lParam); } return 0; @@ -217,7 +217,7 @@ void EpisodeListView::RestoreFocus() { int i, iEpisode, iItem; LVFINDINFO lvfi; - extern DataListView* const g_dlv; + extern DataListView* g_dlv; iItem = 0; iEpisode = g_cfg.iFocus; diff --git a/c/ext.cpp b/c/ext.cpp index 04ab096..d8f3eb9 100644 --- a/c/ext.cpp +++ b/c/ext.cpp @@ -8,7 +8,7 @@ extern CfgA& g_cfg; extern FileView g_fvElv; extern FileView g_fvDlv; -void OpenOnline(int iEp) +bool OpenOnline(int iEp) { wchar_t url[sizeof(g_cfg.url)+4]; Swprintf(url, L"%s%d", g_cfg.url, iEp); @@ -16,9 +16,10 @@ void OpenOnline(int iEp) ShellExecute(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) throw Win32Error(); + return true; } -void OpenWiki(int iEp) +bool OpenWiki(int iEp) { const DlvDataA& d = g_fvDlv.At(iEp-1); wchar_t url[sizeof(d.wiki)+35]; @@ -27,6 +28,7 @@ void OpenWiki(int iEp) ShellExecute(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) throw Win32Error(); + return true; } static inline bool MatchFileName(wchar_t (&file)[MAX_PATH], const wchar_t* const siEp) noexcept diff --git a/c/layout.cpp b/c/layout.cpp index 5b3ff00..36edf32 100644 --- a/c/layout.cpp +++ b/c/layout.cpp @@ -32,7 +32,7 @@ void UpdateLayout(int w, int h) /* Resize status bar parts. */ const int aParts[] = {rc.right-Dpi(55), rc.right}; SendMessage(g_hWndStatus, SB_SETPARTS, - reinterpret_cast(sizeof(aParts)), reinterpret_cast(aParts)); + sizeof(aParts), reinterpret_cast(aParts)); SendMessage(g_hWnd, WM_SETREDRAW, TRUE, 0); RedrawWindow(g_hWnd, nullptr, nullptr, diff --git a/c/main.cpp b/c/main.cpp index 9919200..05cd3d7 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -12,7 +12,7 @@ #include "test.h" #include "util.h" -#ifdef DEBUG +#ifdef _DEBUG #define XMAIN 30 #define YMAIN 30 #else @@ -79,7 +79,11 @@ static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); /* Try to style application according to current Windows theme. */ static void UpdateTheme(); -int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, const int nCmdShow) +int WINAPI WinMain( + _In_ const HINSTANCE hInstance, + _In_opt_ const HINSTANCE, + _In_ char* const, + _In_ const int nCmdShow) { setbuf(stdout, nullptr); LIBXML_TEST_VERSION; @@ -129,7 +133,7 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons g_elv->Update(); g_elv->RestoreFocus(); -#ifdef DEBUG +#ifdef _DEBUG RunTests(); #endif diff --git a/c/resource.rc b/c/resource.rc index 37df1e1..f25bb63 100644 --- a/c/resource.rc +++ b/c/resource.rc @@ -65,7 +65,7 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About" FONT 8, "MS Shell Dlg 2" BEGIN - DEFPUSHBUTTON "&OK", IDOK, ABOUTW-OKW-HPAD, ABOUTH-OKH-VPAD, OKW, OKH - LTEXT "Episode Browser\r\nCopyright 2021 John Ankarström", - IDC_ABOUTTEXT, HPAD, VPAD, ABOUTW-OKW-HPAD*2, ABOUTH-VPAD +DEFPUSHBUTTON "&OK", IDOK, ABOUTW-OKW-HPAD, ABOUTH-OKH-VPAD, OKW, OKH +LTEXT "Episode Browser\r\nCopyright 2021 John Ankarström", +IDC_ABOUTTEXT, HPAD, VPAD, ABOUTW-OKW-HPAD-HPAD, ABOUTH-VPAD END \ No newline at end of file -- cgit v1.2.3