generic: replace QVarLengthArray<T> with std::vector<T>

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-07-30 18:58:58 +00:00
parent c9e54bd352
commit 57bb3cb166
3 changed files with 13 additions and 14 deletions

View file

@ -30,14 +30,12 @@
#include <QShortcut>
#include <QMenu>
#include <QDesktopWidget>
#include <QVarLengthArray>
#include <QDrag>
#include <QPainter>
#include <QtGui/qevent.h>
#include <QResizeEvent>
#include <klocale.h>
#include <KDebug>
#include <kdebug.h>
#include <kglobal.h>
#include <kicon.h>
#include <kimageio.h>
@ -56,7 +54,6 @@
#include <kstandarddirs.h>
#include <kstartupinfo.h>
#include <kvbox.h>
#include <qdebug.h>
#include "regiongrabber.h"
#include "freeregiongrabber.h"
@ -65,11 +62,13 @@
#include "ui_ksnapshotwidget.h"
#ifdef HAVE_X11_EXTENSIONS_XFIXES_H
#include <X11/extensions/Xfixes.h>
#include <X11/Xatom.h>
#include <QX11Info>
# include <X11/extensions/Xfixes.h>
# include <X11/Xatom.h>
# include <QX11Info>
#endif
#include <vector>
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;

View file

@ -19,9 +19,9 @@
#include "page_p.h"
#include <cstring>
#include <vector>
#include <QtCore/qalgorithms.h>
#include <QVarLengthArray>
using namespace Okular;
@ -1563,8 +1563,8 @@ static RegionTextList XYCutForBoundingBoxes(const QList<WordWithCharacters> &wor
int size_proj_y = node.area().height();
int size_proj_x = node.area().width();
//dynamic memory allocation
QVarLengthArray<int> proj_on_xaxis(size_proj_x);
QVarLengthArray<int> proj_on_yaxis(size_proj_y);
std::vector<int> proj_on_xaxis(size_proj_x);
std::vector<int> 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;

View file

@ -14,7 +14,6 @@
#include <qpainter.h>
#include <qpalette.h>
#include <qpixmap.h>
#include <qvarlengtharray.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <QApplication>
@ -22,6 +21,7 @@
// system includes
#include <math.h>
#include <vector>
// 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<unsigned int> xOffset( destWidth );
std::vector<unsigned int> xOffset( destWidth );
for ( int x = 0; x < destWidth; x++ )
xOffset[ x ] = ((x + destLeft) * srcWidth) / scaledWidth;