Message ID | 20240114171723.14092-6-dev@benjarobin.fr (mailing list archive) |
---|---|
State | Accepted |
Commit | 950fceeb9eebf06df8fc0af7493d230960a90dab |
Headers | show |
Series | Fix kernelshark issues introduced by the migration to Qt6 | expand |
On 1/14/24 19:16, Benjamin ROBIN wrote: > Use const_iterator instead. Fix range-loop-detach Clazy warning > Please provide a better explanation of the problem you are trying to solve with this patch. Thanks! Y. > Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr> > --- > src/KsGLWidget.cpp | 5 +++-- > src/plugins/KVMComboDialog.cpp | 6 ++++-- > 2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/src/KsGLWidget.cpp b/src/KsGLWidget.cpp > index 9e3dac3..0a44e77 100644 > --- a/src/KsGLWidget.cpp > +++ b/src/KsGLWidget.cpp > @@ -137,9 +137,10 @@ void KsGLWidget::paintGL() > /* Draw the time axis. */ > _drawAxisX(size); > > - for (auto const &stream: _graphs) > - for (auto const &g: stream) > + for (auto it = _graphs.cbegin(), end = _graphs.cend(); it != end; ++it) { > + for (auto const &g: it.value()) > g->draw(size); > + } > > for (auto const &s: _shapes) { > if (!s) > diff --git a/src/plugins/KVMComboDialog.cpp b/src/plugins/KVMComboDialog.cpp > index 2b95a53..6be68d4 100644 > --- a/src/plugins/KVMComboDialog.cpp > +++ b/src/plugins/KVMComboDialog.cpp > @@ -308,13 +308,15 @@ void KsComboPlotDialog::_applyPress() > int nPlots(0); > > _plotMap[guestId] = _streamCombos(guestId); > - for (auto const &stream: _plotMap) > - for (auto const &combo: stream) { > + > + for (auto it = _plotMap.cbegin(), end = _plotMap.cend(); it != end; ++it) { > + for (auto const &combo: it.value()) { > allCombosVec.append(2); > combo[0] >> allCombosVec; > combo[1] >> allCombosVec; > ++nPlots; > } > + } > > emit apply(nPlots, allCombosVec); > }
diff --git a/src/KsGLWidget.cpp b/src/KsGLWidget.cpp index 9e3dac3..0a44e77 100644 --- a/src/KsGLWidget.cpp +++ b/src/KsGLWidget.cpp @@ -137,9 +137,10 @@ void KsGLWidget::paintGL() /* Draw the time axis. */ _drawAxisX(size); - for (auto const &stream: _graphs) - for (auto const &g: stream) + for (auto it = _graphs.cbegin(), end = _graphs.cend(); it != end; ++it) { + for (auto const &g: it.value()) g->draw(size); + } for (auto const &s: _shapes) { if (!s) diff --git a/src/plugins/KVMComboDialog.cpp b/src/plugins/KVMComboDialog.cpp index 2b95a53..6be68d4 100644 --- a/src/plugins/KVMComboDialog.cpp +++ b/src/plugins/KVMComboDialog.cpp @@ -308,13 +308,15 @@ void KsComboPlotDialog::_applyPress() int nPlots(0); _plotMap[guestId] = _streamCombos(guestId); - for (auto const &stream: _plotMap) - for (auto const &combo: stream) { + + for (auto it = _plotMap.cbegin(), end = _plotMap.cend(); it != end; ++it) { + for (auto const &combo: it.value()) { allCombosVec.append(2); combo[0] >> allCombosVec; combo[1] >> allCombosVec; ++nPlots; } + } emit apply(nPlots, allCombosVec); }
Use const_iterator instead. Fix range-loop-detach Clazy warning Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr> --- src/KsGLWidget.cpp | 5 +++-- src/plugins/KVMComboDialog.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-)