From 57bb3cb166e636f01740787f3f38651cc820b18e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 30 Jul 2023 18:58:58 +0000 Subject: [PATCH] generic: replace QVarLengthArray with std::vector Signed-off-by: Ivailo Monev --- ksnapshot/ksnapshot.cpp | 17 ++++++++--------- okular/core/textpage.cpp | 6 +++--- okular/ui/pagepainter.cpp | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp index 7433c2c7..c24ae0a8 100644 --- a/ksnapshot/ksnapshot.cpp +++ b/ksnapshot/ksnapshot.cpp @@ -30,14 +30,12 @@ #include #include #include -#include #include #include -#include +#include #include - -#include +#include #include #include #include @@ -56,7 +54,6 @@ #include #include #include -#include #include "regiongrabber.h" #include "freeregiongrabber.h" @@ -65,11 +62,13 @@ #include "ui_ksnapshotwidget.h" #ifdef HAVE_X11_EXTENSIONS_XFIXES_H -#include -#include -#include +# include +# include +# include #endif +#include + class KSnapshotWidget : public QWidget, public Ui::KSnapshotWidget { public: @@ -697,7 +696,7 @@ void KSnapshot::grabPointerImage(int offsetx, int offsety) //Annoyingly, xfixes specifies the data to be 32bit, but places it in an unsigned long * //which can be 64 bit. So we need to iterate over a 64bit structure to put it in a 32bit //structure. - QVarLengthArray< quint32 > pixels( xcursorimg->width * xcursorimg->height ); + std::vector< quint32 > pixels( xcursorimg->width * xcursorimg->height ); for (int i = 0; i < xcursorimg->width * xcursorimg->height; ++i) pixels[i] = xcursorimg->pixels[i] & 0xffffffff; diff --git a/okular/core/textpage.cpp b/okular/core/textpage.cpp index 2e706de3..174b7a81 100644 --- a/okular/core/textpage.cpp +++ b/okular/core/textpage.cpp @@ -19,9 +19,9 @@ #include "page_p.h" #include +#include #include -#include using namespace Okular; @@ -1563,8 +1563,8 @@ static RegionTextList XYCutForBoundingBoxes(const QList &wor int size_proj_y = node.area().height(); int size_proj_x = node.area().width(); //dynamic memory allocation - QVarLengthArray proj_on_xaxis(size_proj_x); - QVarLengthArray proj_on_yaxis(size_proj_y); + std::vector proj_on_xaxis(size_proj_x); + std::vector proj_on_yaxis(size_proj_y); for( int j = 0 ; j < size_proj_y ; ++j ) proj_on_yaxis[j] = 0; for( int j = 0 ; j < size_proj_x ; ++j ) proj_on_xaxis[j] = 0; diff --git a/okular/ui/pagepainter.cpp b/okular/ui/pagepainter.cpp index 2493f145..5834a57f 100644 --- a/okular/ui/pagepainter.cpp +++ b/okular/ui/pagepainter.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -22,6 +21,7 @@ // system includes #include +#include // local includes #include "core/area.h" @@ -825,7 +825,7 @@ void PagePainter::scalePixmapOnImage ( QImage & dest, const QPixmap * src, unsigned int * srcData = (unsigned int *)srcImage.bits(); // precalc the x correspondancy conversion in a lookup table - QVarLengthArray xOffset( destWidth ); + std::vector xOffset( destWidth ); for ( int x = 0; x < destWidth; x++ ) xOffset[ x ] = ((x + destLeft) * srcWidth) / scaledWidth;