OSDN Git Service

generic: replace QVarLengthArray<T> with std::vector<T>
authorIvailo Monev <xakepa10@gmail.com>
Sun, 30 Jul 2023 18:58:58 +0000 (18:58 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 30 Jul 2023 18:58:58 +0000 (18:58 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
ksnapshot/ksnapshot.cpp
okular/core/textpage.cpp
okular/ui/pagepainter.cpp

index 7433c2c..c24ae0a 100644 (file)
 #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"
 #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;
 
index 2e706de..174b7a8 100644 (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;
index 2493f14..5834a57 100644 (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;