From 853a598befbb8823c5868c792f51cda3466fada1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 17 Aug 2022 18:23:06 +0200 Subject: Add cEp to CfgA. --- c/data.h | 13 ++++++++----- c/episodelistview.h | 2 +- c/test.cpp | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) (limited to 'c') diff --git a/c/data.h b/c/data.h index 7e86955..3e099ea 100644 --- a/c/data.h +++ b/c/data.h @@ -44,10 +44,10 @@ struct CfgA unsigned char version = 'a'; unsigned char bViewWatched = 1; unsigned char bViewTVOriginal = 1; - unsigned char pad = 0; - int iSortCol = 1; - int iFocus = 0; - int heightDlv = 0; + signed char iSortCol = 1; + unsigned short cEp = 0; + unsigned short iFocus = 0; + unsigned short heightDlv = 0; wchar_t limitScreenwriter[64] = {0}; wchar_t root[260] = {0}; wchar_t glob[64] = {0}; @@ -174,8 +174,11 @@ inline bool FromProlog(const int iEp, ElvDataA& e) noexcept else return false; - if (Pl("episode_data","episode_rating",iEp,reinterpret_cast(&e.rating))) + int rating; + if (Pl("episode_data","episode_rating",iEp,&rating)) { + e.rating = rating; Swprintf(e.sRating, L"%d", e.rating); + } if (Pl("episode_data","tv_original",iEp)) e.bTVOriginal = true; diff --git a/c/episodelistview.h b/c/episodelistview.h index 62ce42e..88c8c9e 100644 --- a/c/episodelistview.h +++ b/c/episodelistview.h @@ -33,7 +33,7 @@ struct EpisodeListView : public ListView void Update(); LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override; private: - int m_iSortCol; + signed char m_iSortCol; static int CALLBACK SortProc(LPARAM lParam1, LPARAM lParam2, LPARAM extra); FileView m_fv{L"elvdata.dat", ELVMAX}; }; diff --git a/c/test.cpp b/c/test.cpp index b8cf20a..92644ba 100644 --- a/c/test.cpp +++ b/c/test.cpp @@ -152,6 +152,21 @@ TESTS } //DeleteFile(L"tmp.dat"); } + + // TEST(MigrateCfg) + // { + // FileView fva{L"cfga.dat", 1}; + // FileView fvb = FileView::Initialized(L"cfgb.dat", 1); + // fvb->bViewWatched = fva->bViewWatched; + // fvb->bViewTVOriginal = fva->bViewTVOriginal; + // fvb->iSortCol = fva->iSortCol; + // fvb->iFocus = fva->iFocus; + // fvb->heightDlv = fva->heightDlv; + // Wcscpy(fvb->limitScreenwriter, fva->limitScreenwriter); + // Wcscpy(fvb->root, fva->root); + // Wcscpy(fvb->glob, fva->glob); + // Wcscpy(fvb->url, fva->url); + // } }; int RunTests() @@ -163,6 +178,7 @@ int RunTests() IO{}, //MigrateElvDataFromPrologToDisk{}, SampleConfigurationToDisk{}, + //MigrateCfg{} }; printf("Results (%llu tests):\n", sizeof(tests)/sizeof(*tests)); -- cgit v1.2.3