summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-22 14:46:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-06 12:13:20 +0100
commitece0c0a5e7e0b18beb58ccd868bde54c7be64f78 (patch)
treefa4a0fdbda040d24f1a2d07a320635c76980f431 /src/gui/image/qimage.cpp
parentb19220d17fa66de5ded41690ffff263ee2af5c63 (diff)
Tidy nullptr usage
Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 869e206524..99d64737c5 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
static inline bool isLocked(QImageData *data)
{
- return data != 0 && data->is_locked;
+ return data != nullptr && data->is_locked;
}
#if defined(Q_CC_DEC) && defined(__alpha) && (__DECCXX_VER-0 >= 50190001)
@@ -99,15 +99,15 @@ static int next_qimage_serial_number()
}
QImageData::QImageData()
- : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(0),
+ : ref(0), width(0), height(0), depth(0), nbytes(0), devicePixelRatio(1.0), data(nullptr),
format(QImage::Format_ARGB32), bytes_per_line(0),
ser_no(next_qimage_serial_number()),
detach_no(0),
dpmx(qt_defaultDpiX() * 100 / qreal(2.54)),
dpmy(qt_defaultDpiY() * 100 / qreal(2.54)),
offset(0, 0), own_data(true), ro_data(false), has_alpha_clut(false),
- is_cached(false), is_locked(false), cleanupFunction(0), cleanupInfo(0),
- paintEngine(0)
+ is_cached(false), is_locked(false), cleanupFunction(nullptr), cleanupInfo(nullptr),
+ paintEngine(nullptr)
{
}
@@ -170,7 +170,7 @@ QImageData::~QImageData()
delete paintEngine;
if (data && own_data)
free(data);
- data = 0;
+ data = nullptr;
}
#if defined(_M_ARM)
@@ -746,7 +746,7 @@ bool QImageData::checkForAlphaPixels() const
QImage::QImage() noexcept
: QPaintDevice()
{
- d = 0;
+ d = nullptr;
}
/*!
@@ -955,7 +955,7 @@ QImage::QImage(const uchar *data, int width, int height, int bytesPerLine, Forma
QImage::QImage(const QString &fileName, const char *format)
: QPaintDevice()
{
- d = 0;
+ d = nullptr;
load(fileName, format);
}
@@ -981,10 +981,10 @@ extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *so
QImage::QImage(const char * const xpm[])
: QPaintDevice()
{
- d = 0;
+ d = nullptr;
if (!xpm)
return;
- if (!qt_read_xpm_image_or_array(0, xpm, *this))
+ if (!qt_read_xpm_image_or_array(nullptr, xpm, *this))
// Issue: Warning because the constructor may be ambigious
qWarning("QImage::QImage(), XPM is not supported");
}
@@ -1003,7 +1003,7 @@ QImage::QImage(const QImage &image)
: QPaintDevice()
{
if (image.paintingActive() || isLocked(image.d)) {
- d = 0;
+ d = nullptr;
image.copy().swap(*this);
} else {
d = image.d;
@@ -1593,13 +1593,13 @@ void QImage::setColor(int i, QRgb c)
uchar *QImage::scanLine(int i)
{
if (!d)
- return 0;
+ return nullptr;
detach();
// In case detach() ran out of memory
if (!d)
- return 0;
+ return nullptr;
return d->data + i * d->bytes_per_line;
}
@@ -1610,7 +1610,7 @@ uchar *QImage::scanLine(int i)
const uchar *QImage::scanLine(int i) const
{
if (!d)
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < height());
return d->data + i * d->bytes_per_line;
@@ -1633,7 +1633,7 @@ const uchar *QImage::scanLine(int i) const
const uchar *QImage::constScanLine(int i) const
{
if (!d)
- return 0;
+ return nullptr;
Q_ASSERT(i >= 0 && i < height());
return d->data + i * d->bytes_per_line;
@@ -1653,12 +1653,12 @@ const uchar *QImage::constScanLine(int i) const
uchar *QImage::bits()
{
if (!d)
- return 0;
+ return nullptr;
detach();
// In case detach ran out of memory...
if (!d)
- return 0;
+ return nullptr;
return d->data;
}
@@ -1672,7 +1672,7 @@ uchar *QImage::bits()
*/
const uchar *QImage::bits() const
{
- return d ? d->data : 0;
+ return d ? d->data : nullptr;
}
@@ -1688,7 +1688,7 @@ const uchar *QImage::bits() const
*/
const uchar *QImage::constBits() const
{
- return d ? d->data : 0;
+ return d ? d->data : nullptr;
}
/*!
@@ -3027,11 +3027,11 @@ QImage QImage::createHeuristicMask(bool clipTight) const
while(!done) {
done = true;
ypn = m.scanLine(0);
- ypc = 0;
+ ypc = nullptr;
for (y = 0; y < h; y++) {
ypp = ypc;
ypc = ypn;
- ypn = (y == h-1) ? 0 : m.scanLine(y+1);
+ ypn = (y == h-1) ? nullptr : m.scanLine(y+1);
const QRgb *p = (const QRgb *)scanLine(y);
for (x = 0; x < w; x++) {
// slowness here - it's possible to do six of these tests
@@ -3053,11 +3053,11 @@ QImage QImage::createHeuristicMask(bool clipTight) const
if (!clipTight) {
ypn = m.scanLine(0);
- ypc = 0;
+ ypc = nullptr;
for (y = 0; y < h; y++) {
ypp = ypc;
ypc = ypn;
- ypn = (y == h-1) ? 0 : m.scanLine(y+1);
+ ypn = (y == h-1) ? nullptr : m.scanLine(y+1);
const QRgb *p = (const QRgb *)scanLine(y);
for (x = 0; x < w; x++) {
if ((*p & 0x00ffffff) != background) {
@@ -4122,7 +4122,7 @@ void QImage::setText(const QString &key, const QString &value)
QPaintEngine *QImage::paintEngine() const
{
if (!d)
- return 0;
+ return nullptr;
if (!d->paintEngine) {
QPaintDevice *paintDevice = const_cast<QImage *>(this);