reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit a7acc4fbef9521d9cbef6940cd0051790212a542
parent 4c1330e1942027577e9728b0daee766ad7663b1b
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 28 Nov 2019 15:05:07 -0500

listview: cleanup c-style casts

Diffstat:
Msrc/listview.cpp | 12++++++------
Msrc/listview.hpp | 4++--
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/listview.cpp b/src/listview.cpp @@ -33,8 +33,8 @@ static int adjustWidth(const int points) #ifdef _WIN32 if(points < 1) return points; - else - return (int)ceil(points * 0.863); // magic number to make pretty sizes... + else // magic number to make pretty sizes... + return static_cast<int>(std::ceil(points * 0.863)); #else return points; #endif @@ -179,7 +179,7 @@ void ListView::sort() { static const auto compare = [](LPARAM aRow, LPARAM bRow, LPARAM param) { - const int indexDiff = (int)(aRow - bRow); + const int indexDiff = static_cast<int>(aRow - bRow); ListView *view = reinterpret_cast<ListView *>(param); @@ -198,7 +198,7 @@ void ListView::sort() return ret ? ret : indexDiff; }; - ListView_SortItems(handle(), compare, (LPARAM)this); + ListView_SortItems(handle(), compare, reinterpret_cast<LPARAM>(this)); m_dirty = (m_dirty | NeedReindexFlag) & ~NeedSortFlag; } @@ -272,7 +272,7 @@ void ListView::filter() } std::sort(hide.begin(), hide.end()); - for(int i = 0; i < (int)hide.size(); ++i) { + for(int i = 0; i < static_cast<int>(hide.size()); ++i) { ListView_DeleteItem(handle(), hide[i] - i); m_dirty |= NeedReindexFlag; } @@ -556,7 +556,7 @@ int ListView::translateBack(const int internalIndex) const item.mask |= LVIF_PARAM; if(ListView_GetItem(handle(), &item)) - return (int)item.lParam; + return static_cast<int>(item.lParam); else return -1; } diff --git a/src/listview.hpp b/src/listview.hpp @@ -110,7 +110,7 @@ public: Row *createRow(void *data = nullptr); Row *row(size_t index) const { return m_rows[index].get(); } void removeRow(int index); - int rowCount() const { return (int)m_rows.size(); } + int rowCount() const { return static_cast<int>(m_rows.size()); } int visibleRowCount() const; bool empty() const { return m_rows.empty(); } @@ -138,7 +138,7 @@ public: const Column &column(int index) const { return m_cols[index]; } void resizeColumn(int index, int width); int columnWidth(int index) const; - int columnCount() const { return (int)m_cols.size(); } + int columnCount() const { return static_cast<int>(m_cols.size()); } void sortByColumn(int index, SortOrder order = AscendingOrder, bool user = false); void setFilter(const std::string &);