From 96f00a4d2947b783921092ce10034e770e3d8bc5 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 19 Feb 2020 16:46:23 +0100 Subject: [PATCH] CI: Enable clazy qstring-arg check --- .gitlab-ci.yml | 6 +++--- autotests/kjsfunctionstest.cpp | 2 +- autotests/modifyannotationpropertiestest.cpp | 2 +- autotests/parttest.cpp | 8 ++++---- core/script/kjs_event.cpp | 3 +++ core/script/kjs_util.cpp | 5 ++--- generators/chm/lib/ebook_chm.cpp | 18 +++++++++--------- generators/dvi/TeXFont_PFB.cpp | 2 +- generators/dvi/TeXFont_PK.cpp | 12 ++++++------ generators/dvi/fontpool.cpp | 2 +- generators/fax/faxdocument.cpp | 18 +++++++++--------- generators/poppler/CMakeLists.txt | 13 ++++++++----- generators/tiff/generator_tiff.cpp | 4 ++-- shell/shellutils.cpp | 2 +- ui/guiutils.cpp | 2 +- ui/pagepainter.cpp | 4 ++-- ui/presentationwidget.cpp | 4 ++-- 17 files changed, 56 insertions(+), 51 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 24fa16af6..2b2dabade 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,11 +44,11 @@ build_clang_tidy: - echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list - apt-get update - apt-get build-dep --yes --no-install-recommends okular - - apt-get install --yes --no-install-recommends ninja-build clang clang-tidy python python-yaml libkf5crash-dev libkf5purpose-dev libegl-dev jq + - apt-get install --yes --no-install-recommends ninja-build clazy clang clang-tidy python python-yaml libkf5crash-dev libkf5purpose-dev libegl-dev jq script: - - srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clang++ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json - - ninja + - srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json + - CLAZY_CHECKS="qstring-arg" ninja # Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later - sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h - "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\"" diff --git a/autotests/kjsfunctionstest.cpp b/autotests/kjsfunctionstest.cpp index 0d424c927..7f0856320 100644 --- a/autotests/kjsfunctionstest.cpp +++ b/autotests/kjsfunctionstest.cpp @@ -91,10 +91,10 @@ private slots: void testAlert(); void testPrintD(); void testPrintD_data(); -#endif private: Okular::Document *m_document; QMap m_fields; +#endif }; #ifdef HAVE_POPPLER_0_79 diff --git a/autotests/modifyannotationpropertiestest.cpp b/autotests/modifyannotationpropertiestest.cpp index 605ed5772..548eac5c5 100644 --- a/autotests/modifyannotationpropertiestest.cpp +++ b/autotests/modifyannotationpropertiestest.cpp @@ -19,7 +19,7 @@ static const QColor RED = QColor(255, 0, 0); static const QColor GREEN = QColor(0, 255, 0.0); -static const QColor BLUE = QColor(0, 0, 255); +// static const QColor BLUE = QColor(0, 0, 255); class ModifyAnnotationPropertiesTest : public QObject { diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp index 84c3a16ec..7c6067e46 100644 --- a/autotests/parttest.cpp +++ b/autotests/parttest.cpp @@ -887,8 +887,8 @@ void PartTest::testSaveAs() QString annotName; QTemporaryFile archiveSave( QStringLiteral( "%1/okrXXXXXX.okular" ).arg( QDir::tempPath() ) ); - QTemporaryFile nativeDirectSave( QStringLiteral( "%1/okrXXXXXX.%2" ).arg( QDir::tempPath() ).arg ( extension ) ); - QTemporaryFile nativeFromArchiveFile( QStringLiteral( "%1/okrXXXXXX.%2" ).arg( QDir::tempPath() ).arg ( extension ) ); + QTemporaryFile nativeDirectSave( QStringLiteral( "%1/okrXXXXXX.%2" ).arg( QDir::tempPath(), extension ) ); + QTemporaryFile nativeFromArchiveFile( QStringLiteral( "%1/okrXXXXXX.%2" ).arg( QDir::tempPath(), extension ) ); QVERIFY( archiveSave.open() ); archiveSave.close(); QVERIFY( nativeDirectSave.open() ); @@ -1071,10 +1071,10 @@ void PartTest::testSaveAsUndoStackAnnotations() // when saving to a file format not supporting those. However, this button is only sensible // and available for "Save As", but not for "Save". By alternately saving to saveFile1 and // saveFile2 we always force "Save As", so closeDialogHelper keeps working. - QTemporaryFile saveFile1( QStringLiteral( "%1/okrXXXXXX_1.%2" ).arg( QDir::tempPath() ).arg ( extension ) ); + QTemporaryFile saveFile1( QStringLiteral( "%1/okrXXXXXX_1.%2" ).arg( QDir::tempPath(), extension ) ); QVERIFY( saveFile1.open() ); saveFile1.close(); - QTemporaryFile saveFile2( QStringLiteral( "%1/okrXXXXXX_2.%2" ).arg( QDir::tempPath() ).arg ( extension ) ); + QTemporaryFile saveFile2( QStringLiteral( "%1/okrXXXXXX_2.%2" ).arg( QDir::tempPath(), extension ) ); QVERIFY( saveFile2.open() ); saveFile2.close(); diff --git a/core/script/kjs_event.cpp b/core/script/kjs_event.cpp index c39bb9f94..94bbba3d6 100644 --- a/core/script/kjs_event.cpp +++ b/core/script/kjs_event.cpp @@ -86,6 +86,9 @@ static KJSObject eventGetTarget( KJSContext *ctx, void *object ) return JSField::wrapField( ctx, target, event->targetPage() ); break; } + default: + { + } } return KJSUndefined(); } diff --git a/core/script/kjs_util.cpp b/core/script/kjs_util.cpp index 83521d5b2..594c08f78 100644 --- a/core/script/kjs_util.cpp +++ b/core/script/kjs_util.cpp @@ -104,9 +104,8 @@ static KJSObject printd( KJSContext *context, void *, } QLocale locale( "en_US" ); - QStringList str = arguments.at( 1 ).toString( context ).split( QRegularExpression( "\\W") ); - QString myStr = QStringLiteral( "%1/%2/%3 %4:%5:%6" ).arg( str[1] ). - arg( str[2] ).arg( str[3] ).arg( str[4] ).arg( str[5] ).arg( str[6] ); + const QStringList str = arguments.at( 1 ).toString( context ).split( QRegularExpression( "\\W") ); + QString myStr = QStringLiteral( "%1/%2/%3 %4:%5:%6" ).arg( str[1], str[2], str[3], str[4], str[5], str[6] ); QDateTime date = locale.toDateTime( myStr, QStringLiteral( "MMM/d/yyyy H:m:s" ) ); diff --git a/generators/chm/lib/ebook_chm.cpp b/generators/chm/lib/ebook_chm.cpp index 948de2e26..28a282707 100644 --- a/generators/chm/lib/ebook_chm.cpp +++ b/generators/chm/lib/ebook_chm.cpp @@ -612,8 +612,8 @@ bool EBook_CHM::getInfoFromWindows() if ( !RetrieveObject(&ui, buffer, 0, WIN_HEADER_LEN) ) return false; - unsigned int entries = get_int32_le( (unsigned int *)(buffer) ); - unsigned int entry_size = get_int32_le( (unsigned int *)(buffer + 0x04) ); + unsigned int entries = get_int32_le( reinterpret_cast(buffer) ); + unsigned int entry_size = get_int32_le( reinterpret_cast(buffer + 0x04) ); QVector uptr(entries * entry_size); unsigned char* raw = (unsigned char*) uptr.data(); @@ -628,10 +628,10 @@ bool EBook_CHM::getInfoFromWindows() { unsigned int offset = i * entry_size; - unsigned int off_title = get_int32_le( (unsigned int *)(raw + offset + 0x14) ); - unsigned int off_home = get_int32_le( (unsigned int *)(raw + offset + 0x68) ); - unsigned int off_hhc = get_int32_le( (unsigned int *)(raw + offset + 0x60) ); - unsigned int off_hhk = get_int32_le( (unsigned int *)(raw + offset + 0x64) ); + unsigned int off_title = get_int32_le( reinterpret_cast(raw + offset + 0x14) ); + unsigned int off_home = get_int32_le( reinterpret_cast(raw + offset + 0x68) ); + unsigned int off_hhc = get_int32_le( reinterpret_cast(raw + offset + 0x60) ); + unsigned int off_hhk = get_int32_le( reinterpret_cast(raw + offset + 0x64) ); factor = off_title / 4096; @@ -901,9 +901,9 @@ void EBook_CHM::fillTopicsUrlMap() for ( LONGUINT64 i = 0; i < m_chmTOPICS.length; i += TOPICS_ENTRY_LEN ) { - unsigned int off_title = get_int32_le( (unsigned int *)(topics.data() + i + 4) ); - unsigned int off_url = get_int32_le( (unsigned int *)(topics.data() + i + 8) ); - off_url = get_int32_le( (unsigned int *)( urltbl.data() + off_url + 8) ) + 8; + unsigned int off_title = get_int32_le( reinterpret_cast(topics.data() + i + 4) ); + unsigned int off_url = get_int32_le( reinterpret_cast(topics.data() + i + 8) ); + off_url = get_int32_le( reinterpret_cast( urltbl.data() + off_url + 8) ) + 8; QUrl url = pathToUrl( (const char*) urlstr.data() + off_url ); diff --git a/generators/dvi/TeXFont_PFB.cpp b/generators/dvi/TeXFont_PFB.cpp index f6df76a8a..46656418a 100644 --- a/generators/dvi/TeXFont_PFB.cpp +++ b/generators/dvi/TeXFont_PFB.cpp @@ -253,7 +253,7 @@ glyph* TeXFont_PFB::getGlyph(quint16 ch, bool generateCharacterPixmap, const QCo for(unsigned int y=0; ybitmap.rows; y++) { quint8 *srcScanLine = slot->bitmap.buffer + y*slot->bitmap.pitch; - unsigned int *destScanLine = (unsigned int *)imgi.scanLine(y); + unsigned int *destScanLine = reinterpret_cast(imgi.scanLine(y)); for(unsigned int col=0; colbitmap.width; col++) { quint16 data = *srcScanLine; // The value stored in "data" now has the following meaning: diff --git a/generators/dvi/TeXFont_PK.cpp b/generators/dvi/TeXFont_PK.cpp index 0b9a45518..95b3ce5e2 100644 --- a/generators/dvi/TeXFont_PK.cpp +++ b/generators/dvi/TeXFont_PK.cpp @@ -295,7 +295,7 @@ glyph* TeXFont_PK::getGlyph(quint16 ch, bool generateCharacterPixmap, const QCol quint8 *srcScanLine = xydata; for(int y=0; y(im32.scanLine(y)); for(int col=0; col(((char *) a) + b)) +#define SUB(a, b) (reinterpret_cast(((char *) a) - b)) @@ -534,7 +534,7 @@ void TeXFont_PK::read_PK_char(unsigned int ch) characterBitmaps[ch]->bits = new char[size != 0 ? size : 1]; } - cp = (quint32 *) characterBitmaps[ch]->bits; + cp = reinterpret_cast(characterBitmaps[ch]->bits); /* * read character data into *cp @@ -618,7 +618,7 @@ void TeXFont_PK::read_PK_char(unsigned int ch) } paint_switch = 1 - paint_switch; } - if (cp != ((quint32 *) (characterBitmaps[ch]->bits + bytes_wide * characterBitmaps[ch]->h))) + if (cp != (reinterpret_cast (characterBitmaps[ch]->bits + bytes_wide * characterBitmaps[ch]->h))) oops(i18n("Wrong number of bits stored: char. %1, font %2", ch, parent->filename)); if (rows_left != 0 || h_bit != characterBitmaps[ch]->w) oops(i18n("Bad pk file (%1), too many bits", parent->filename)); @@ -704,7 +704,7 @@ void TeXFont_PK::read_PK_char(unsigned int ch) } paint_switch = 1 - paint_switch; } - if (cp != ((quint32 *) (characterBitmaps[ch]->bits + bytes_wide * characterBitmaps[ch]->h))) + if (cp != (reinterpret_cast (characterBitmaps[ch]->bits + bytes_wide * characterBitmaps[ch]->h))) oops(i18n("Wrong number of bits stored: char. %1, font %2", ch, parent->filename)); if (rows_left != 0 || h_bit != characterBitmaps[ch]->w) oops(i18n("Bad pk file (%1), too many bits", parent->filename)); diff --git a/generators/dvi/fontpool.cpp b/generators/dvi/fontpool.cpp index effa1a092..be9dbd858 100644 --- a/generators/dvi/fontpool.cpp +++ b/generators/dvi/fontpool.cpp @@ -61,7 +61,7 @@ fontPool::fontPool(bool useFontHinting) // extension, alpha channels are either supported, or silently // ignored. QImage start(1, 1, QImage::Format_ARGB32); // Generate a 1x1 image, black with alpha=0x10 - quint32 *destScanLine = (quint32 *)start.scanLine(0); + quint32 *destScanLine = reinterpret_cast(start.scanLine(0)); *destScanLine = 0x80000000; QPixmap intermediate = QPixmap::fromImage(start); QPixmap dest(1,1); diff --git a/generators/fax/faxdocument.cpp b/generators/fax/faxdocument.cpp index cdeb41a6a..630a8770a 100644 --- a/generators/fax/faxdocument.cpp +++ b/generators/fax/faxdocument.cpp @@ -22,7 +22,7 @@ static const char FAXMAGIC[] = "\000PC Research, Inc\000\000\000\000\000\000"; /* rearrange input bits into t16bits lsb-first chunks */ static void normalize( pagenode *pn, int revbits, int swapbytes, size_t length ) { - t32bits *p = (t32bits *) pn->data; + t32bits *p = reinterpret_cast( pn->data ); switch ( (revbits<<1) | swapbytes ) { @@ -101,8 +101,8 @@ static unsigned char* getstrip( pagenode *pn, int strip ) data = new uchar[ roundup ]; /* clear the last 2 t32bits, to force the expander to terminate even if the file ends in the middle of a fax line */ - *((t32bits *) data + roundup/4 - 2) = 0; - *((t32bits *) data + roundup/4 - 1) = 0; + *(reinterpret_cast( data + roundup/4 - 2)) = 0; + *(reinterpret_cast( data + roundup/4 - 1)) = 0; /* we expect to get it in one gulp... */ if ( !file.seek(offset) || (size_t) file.read( (char *)data, pn->length ) != pn->length ) @@ -112,7 +112,7 @@ static unsigned char* getstrip( pagenode *pn, int strip ) } file.close(); - pn->data = (t16bits *)data; + pn->data = reinterpret_cast(data); if ( pn->strips == nullptr && memcmp( data, FAXMAGIC, sizeof( FAXMAGIC ) - 1 ) == 0 ) { @@ -137,7 +137,7 @@ static unsigned char* getstrip( pagenode *pn, int strip ) if ( pn->strips == nullptr ) pn->rowsperstrip = pn->size.height(); - pn->dataOrig = (t16bits *)data; + pn->dataOrig = reinterpret_cast(data); return data; } @@ -156,8 +156,8 @@ static void draw_line( pixnum *run, int lineNum, pagenode *pn ) if ( lineNum >= pn->size.height() ) return; - p = (t32bits *)(pn->imageData + lineNum*(2-pn->vres)*pn->bytes_per_line); - p1 =(t32bits *)(pn->vres ? nullptr : p + pn->bytes_per_line/sizeof(*p)); + p = reinterpret_cast(pn->imageData + lineNum*(2-pn->vres)*pn->bytes_per_line); + p1 =reinterpret_cast(pn->vres ? nullptr : p + pn->bytes_per_line/sizeof(*p)); r = run; acc = 0; @@ -277,8 +277,8 @@ bool FaxDocument::load() for ( int y= height - 1; y >= 0; --y ) { quint32 offset = y * bytes_per_line; - quint32 *source = (quint32 *) (d->mPageNode.imageData + offset); - quint32 *dest = (quint32 *) (bytes.data() + offset); + quint32 *source = reinterpret_cast (d->mPageNode.imageData + offset); + quint32 *dest = reinterpret_cast (bytes.data() + offset); for ( int x= (bytes_per_line/4) - 1; x >= 0; --x ) { quint32 dv = 0, sv = *source; diff --git a/generators/poppler/CMakeLists.txt b/generators/poppler/CMakeLists.txt index 367ea28e6..d8b106742 100644 --- a/generators/poppler/CMakeLists.txt +++ b/generators/poppler/CMakeLists.txt @@ -10,7 +10,7 @@ check_cxx_source_compiles(" #include int main() { - Poppler::Page *p; + Poppler::Page *p = nullptr; p->renderToImage(0, 0, 0, 0, 0, 0, Poppler::Page::Rotate0, nullptr, nullptr, nullptr, QVariant()); return 0; } @@ -22,10 +22,10 @@ check_cxx_source_compiles(" #include int main() { - Poppler::FormField *f; + Poppler::FormField *f = nullptr; f->setReadOnly(true); f->setVisible(true); - Poppler::Link *l; + Poppler::Link *l = nullptr; l->nextLinks(); } " HAVE_POPPLER_0_64) @@ -35,7 +35,7 @@ check_cxx_source_compiles(" #include int main() { - Poppler::FormField *f; + Poppler::FormField *f = nullptr; f->additionalAction(Poppler::Annotation::CursorEnteringAction); } " HAVE_POPPLER_0_65) @@ -46,6 +46,7 @@ check_cxx_source_compiles(" int main() { auto f = &Poppler::SignatureValidationInfo::reason; + (void)f; } " HAVE_POPPLER_0_68) @@ -65,6 +66,7 @@ check_cxx_source_compiles(" int main() { QString s = Poppler::Version::string(); + (void)s; return 0; } " HAVE_POPPLER_0_73) @@ -75,7 +77,7 @@ check_cxx_source_compiles(" int main() { Poppler::FormFieldIcon icon(nullptr); - Poppler::FormFieldButton *button; + Poppler::FormFieldButton *button = nullptr; button->setIcon( icon ); return 0; } @@ -87,6 +89,7 @@ int main() { Poppler::FontInfo info; QString substituteName = info.substituteName(); + (void)substituteName; return 0; } " HAVE_POPPLER_0_80) diff --git a/generators/tiff/generator_tiff.cpp b/generators/tiff/generator_tiff.cpp index 3ed6bee96..b07090a49 100644 --- a/generators/tiff/generator_tiff.cpp +++ b/generators/tiff/generator_tiff.cpp @@ -251,7 +251,7 @@ QImage TIFFGenerator::image( Okular::PixmapRequest * request ) orientation = ORIENTATION_TOPLEFT; QImage image( width, height, QImage::Format_RGB32 ); - uint32 * data = (uint32 *)image.bits(); + uint32 * data = reinterpret_cast(image.bits()); // read data if ( TIFFReadRGBAImageOriented( d->tiff, width, height, data, orientation ) != 0 ) @@ -389,7 +389,7 @@ bool TIFFGenerator::print( QPrinter& printer ) continue; QImage image( width, height, QImage::Format_RGB32 ); - uint32 * data = (uint32 *)image.bits(); + uint32 * data = reinterpret_cast(image.bits()); // read data if ( TIFFReadRGBAImageOriented( d->tiff, width, height, data, ORIENTATION_TOPLEFT ) != 0 ) diff --git a/shell/shellutils.cpp b/shell/shellutils.cpp index cda621c31..a904aeb21 100644 --- a/shell/shellutils.cpp +++ b/shell/shellutils.cpp @@ -77,7 +77,7 @@ QString serializeOptions(const QCommandLineParser &args) QString serializeOptions(bool startInPresentation, bool showPrintDialog, bool showPrintDialogAndExit, bool unique, bool noRaise, const QString &page, const QString &find) { - return QStringLiteral("%1:%2:%3:%4:%5:%6:%7").arg(startInPresentation).arg(showPrintDialog).arg(showPrintDialogAndExit).arg(unique).arg(noRaise).arg(page).arg(QString(find.toLatin1().toBase64())); + return QStringLiteral("%1:%2:%3:%4:%5:%6:%7").arg(startInPresentation).arg(showPrintDialog).arg(showPrintDialogAndExit).arg(unique).arg(noRaise).arg(page, QString::fromLatin1(find.toLatin1().toBase64())); } bool unserializeOptions(const QString &serializedOptions, bool *presentation, bool *print, bool *print_and_exit, bool *unique, bool *noraise, QString *page, QString *find) diff --git a/ui/guiutils.cpp b/ui/guiutils.cpp index 43edf82a1..ef675ced6 100644 --- a/ui/guiutils.cpp +++ b/ui/guiutils.cpp @@ -269,7 +269,7 @@ void colorizeImage( QImage & grayImage, const QColor & color, unsigned int destA grayImage = grayImage.convertToFormat( QImage::Format_ARGB32_Premultiplied ); // iterate over all pixels changing the alpha component value - unsigned int * data = (unsigned int *)grayImage.bits(); + unsigned int * data = reinterpret_cast(grayImage.bits()); unsigned int pixels = grayImage.width() * grayImage.height(); int red = color.red(), green = color.green(), diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp index d0dee1f2e..0fa62fea2 100644 --- a/ui/pagepainter.cpp +++ b/ui/pagepainter.cpp @@ -372,7 +372,7 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula break; case Okular::SettingsCore::EnumRenderMode::BlackWhite: // Manual Gray and Contrast - unsigned int * data = (unsigned int *)backImage.bits(); + unsigned int * data = reinterpret_cast(backImage.bits()); int val, pixels = backImage.width() * backImage.height(), con = Okular::Settings::bWContrast(), thr = 255 - Okular::Settings::bWThreshold(); for( int i = 0; i < pixels; ++i ) @@ -850,7 +850,7 @@ static inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } void PagePainter::changeImageAlpha( QImage & image, unsigned int destAlpha ) { // iterate over all pixels changing the alpha component value - unsigned int * data = (unsigned int *)image.bits(); + unsigned int * data = reinterpret_cast(image.bits()); unsigned int pixels = image.width() * image.height(); int source, sourceAlpha; diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index c54aa0554..d0d0cbc0a 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -1302,8 +1302,8 @@ void PresentationWidget::generateOverlay() color = pal.color( QPalette::Active, QPalette::Highlight ); int sRed = color.red(), sGreen = color.green(), sBlue = color.blue(); // pointers - unsigned int * data = (unsigned int *)image.bits(), - * shadowData = (unsigned int *)shadow.bits(), + unsigned int * data = reinterpret_cast(image.bits()), + * shadowData = reinterpret_cast(shadow.bits()), pixels = image.width() * image.height(); // cache data (reduce computation time to 26%!) int c1 = -1, c2 = -1, cR = 0, cG = 0, cB = 0, cA = 0;