add/preserve `const` in `dynamic_cast` (#4655)

This commit is contained in:
Oliver Stöneberg 2022-12-19 20:01:12 +01:00 committed by GitHub
parent 9da574f4a0
commit 6fedbb4f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -373,7 +373,7 @@ void ResultsView::readErrorsXml(const QString &filename)
void ResultsView::updateDetails(const QModelIndex &index)
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(mUI->mTree->model());
const QStandardItemModel *model = qobject_cast<const QStandardItemModel*>(mUI->mTree->model());
QStandardItem *item = model->itemFromIndex(index);
if (!item) {

View File

@ -382,7 +382,7 @@ QChartView *StatsDialog::createChart(const QString &statsFile, const QString &to
qreal maxY = 0;
for (QAbstractSeries *s : chart->series()) {
s->attachAxis(axisY);
if (QLineSeries *ls = dynamic_cast<QLineSeries*>(s)) {
if (const QLineSeries *ls = dynamic_cast<const QLineSeries*>(s)) {
for (QPointF p : ls->points()) {
if (p.y() > maxY)
maxY = p.y();

View File

@ -960,7 +960,7 @@ bool CheckBufferOverrun::analyseWholeProgram(const CTU::FileInfo *ctu, const std
const std::map<std::string, std::list<const CTU::FileInfo::CallBase *>> callsMap = ctu->getCallsMap();
for (Check::FileInfo *fi1 : fileInfo) {
const MyFileInfo *fi = dynamic_cast<MyFileInfo*>(fi1);
const MyFileInfo *fi = dynamic_cast<const MyFileInfo*>(fi1);
if (!fi)
continue;
for (const CTU::FileInfo::UnsafeUsage &unsafeUsage : fi->unsafeArrayIndex)

View File

@ -3199,7 +3199,7 @@ bool CheckClass::analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<C
std::unordered_map<std::string, MyFileInfo::NameLoc> all;
for (Check::FileInfo *fi1 : fileInfo) {
const MyFileInfo *fi = dynamic_cast<MyFileInfo*>(fi1);
const MyFileInfo *fi = dynamic_cast<const MyFileInfo*>(fi1);
if (!fi)
continue;
for (const MyFileInfo::NameLoc &nameLoc : fi->classDefinitions) {

View File

@ -597,7 +597,7 @@ bool CheckNullPointer::analyseWholeProgram(const CTU::FileInfo *ctu, const std::
const std::map<std::string, std::list<const CTU::FileInfo::CallBase *>> callsMap = ctu->getCallsMap();
for (Check::FileInfo *fi1 : fileInfo) {
const MyFileInfo *fi = dynamic_cast<MyFileInfo*>(fi1);
const MyFileInfo *fi = dynamic_cast<const MyFileInfo*>(fi1);
if (!fi)
continue;
for (const CTU::FileInfo::UnsafeUsage &unsafeUsage : fi->unsafeUsage) {

View File

@ -1703,7 +1703,7 @@ bool CheckUninitVar::analyseWholeProgram(const CTU::FileInfo *ctu, const std::li
const std::map<std::string, std::list<const CTU::FileInfo::CallBase *>> callsMap = ctu->getCallsMap();
for (Check::FileInfo *fi1 : fileInfo) {
const MyFileInfo *fi = dynamic_cast<MyFileInfo*>(fi1);
const MyFileInfo *fi = dynamic_cast<const MyFileInfo*>(fi1);
if (!fi)
continue;
for (const CTU::FileInfo::UnsafeUsage &unsafeUsage : fi->unsafeUsage) {