From f6cb2fd2fbe62f0a80122c2dc97b8b1463a44d19 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 18 Aug 2019 10:14:53 +0200 Subject: [PATCH] GModel: Have create_index() take a const void* This is just for convenience really. It lets you skip const_casting in all the code that calls this API, which you would basically always be doing otherwise. --- Libraries/LibGUI/GModel.cpp | 4 ++-- Libraries/LibGUI/GModel.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/LibGUI/GModel.cpp b/Libraries/LibGUI/GModel.cpp index 46e1037c29..36e35abd56 100644 --- a/Libraries/LibGUI/GModel.cpp +++ b/Libraries/LibGUI/GModel.cpp @@ -46,9 +46,9 @@ void GModel::set_selected_index(const GModelIndex& index) }); } -GModelIndex GModel::create_index(int row, int column, void* data) const +GModelIndex GModel::create_index(int row, int column, const void* data) const { - return GModelIndex(*this, row, column, data); + return GModelIndex(*this, row, column, const_cast(data)); } GModelIndex GModel::sibling(int row, int column, const GModelIndex& parent) const diff --git a/Libraries/LibGUI/GModel.h b/Libraries/LibGUI/GModel.h index 0aee640eac..bfdc9125c8 100644 --- a/Libraries/LibGUI/GModel.h +++ b/Libraries/LibGUI/GModel.h @@ -97,7 +97,7 @@ protected: void for_each_view(Function); void did_update(); - GModelIndex create_index(int row, int column, void* data = nullptr) const; + GModelIndex create_index(int row, int column, const void* data = nullptr) const; private: HashTable m_views;