.gitlab-ci.yml | 2 +- poppler/CairoOutputDev.cc | 8 ++++---- poppler/CairoRescaleBox.cc | 2 +- qt5/src/ArthurOutputDev.cc | 6 +++--- utils/ImageOutputDev.cc | 2 +- utils/pdftocairo.cc | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-)
New commits: commit 5a72f3cd65d4c9481b0b5b2535e51057c7b9b291 Author: Albert Astals Cid <[email protected]> Date: Wed Feb 6 18:31:55 2019 +0100 Use reinterpret_cast to silence cast-align warnings In ImageOutputDev it comes directly from malloc, and malloc guarantees alignment for basic types, so we're good In ArthurOutputDev it comes from QImage::bits that uses malloc internally, so we're good In cairo* it comes from cairo_image_surface_get_data that comes from pixman_image_get_data that returns a uint32_t * so we're only going to the original type alignment diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 55b5d5ca..0ee2e203 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,7 +79,7 @@ build_clazy: - dnf -y install curl make ninja-build openjpeg2-tools clazy clang redhat-rpm-config script: - mkdir -p build && cd build - - CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-cast-align -Wno-deprecated-declarations" cmake -G Ninja .. + - CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -G Ninja .. - CLAZY_CHECKS="level0,level1,level2,isempty-vs-count,qhash-with-char-pointer-key,tr-non-literal,no-non-pod-global-static" ninja build_android: diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 02a6f262..30c9f57a 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -1826,7 +1826,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, const double * bbox, bool alp cairo_destroy(maskCtx); /* convert to a luminocity map */ - uint32_t *source_data = (uint32_t*)cairo_image_surface_get_data(source); + uint32_t *source_data = reinterpret_cast<uint32_t *>(cairo_image_surface_get_data(source)); /* get stride in units of 32 bits */ ptrdiff_t stride = cairo_image_surface_get_stride(source)/4; for (int y=0; y<height; y++) { @@ -2594,7 +2594,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, buffer = cairo_image_surface_get_data (image); row_stride = cairo_image_surface_get_stride (image); for (y = 0; y < height; y++) { - dest = (unsigned int *) (buffer + y * row_stride); + dest = reinterpret_cast<unsigned int *>(buffer + y * row_stride); pix = imgStr->getLine(); colorMap->getRGBLine (pix, dest, width); } @@ -2746,7 +2746,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s buffer = cairo_image_surface_get_data (image); row_stride = cairo_image_surface_get_stride (image); for (y = 0; y < height; y++) { - dest = (unsigned int *) (buffer + y * row_stride); + dest = reinterpret_cast<unsigned int *>(buffer + y * row_stride); pix = imgStr->getLine(); colorMap->getRGBLine (pix, dest, width); } @@ -3154,7 +3154,7 @@ public: buffer = cairo_image_surface_get_data (image); stride = cairo_image_surface_get_stride (image); for (int y = 0; y < height; y++) { - uint32_t *dest = (uint32_t *) (buffer + y * stride); + uint32_t *dest = reinterpret_cast<uint32_t *>(buffer + y * stride); getRow(y, dest); } } else { diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc index 7f375a87..838d6348 100644 --- a/poppler/CairoRescaleBox.cc +++ b/poppler/CairoRescaleBox.cc @@ -279,7 +279,7 @@ bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, unsigned int *dest; int dst_stride; - dest = (unsigned int *)cairo_image_surface_get_data (dest_surface); + dest = reinterpret_cast<unsigned int *>(cairo_image_surface_get_data (dest_surface)); dst_stride = cairo_image_surface_get_stride (dest_surface); scanline = (uint32_t*)gmallocn (orig_width, sizeof(int)); diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc index 750dc1df..deb44514 100644 --- a/qt5/src/ArthurOutputDev.cc +++ b/qt5/src/ArthurOutputDev.cc @@ -1024,7 +1024,7 @@ void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, // TODO: Would using QImage::Format_Mono be more efficient here? QImage image(width, height, QImage::Format_ARGB32); - unsigned int *data = (unsigned int *)image.bits(); + unsigned int *data = reinterpret_cast<unsigned int *>(image.bits()); int stride = image.bytesPerLine()/4; QRgb fillColor = m_currentBrush.color().rgb(); @@ -1074,7 +1074,7 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, imgStr->reset(); image = QImage(width, height, QImage::Format_ARGB32); - data = (unsigned int *)image.bits(); + data = reinterpret_cast<unsigned int *>(image.bits()); stride = image.bytesPerLine()/4; for (y = 0; y < height; y++) { pix = imgStr->getLine(); @@ -1149,7 +1149,7 @@ void ArthurOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream * maskImageStr->reset(); QImage image(width, height, QImage::Format_ARGB32); - unsigned int *data = (unsigned int *)image.bits(); + unsigned int *data = reinterpret_cast<unsigned int *>(image.bits()); int stride = image.bytesPerLine()/4; std::vector<unsigned char> maskLine(maskWidth); diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 8390407a..16719384 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -428,7 +428,7 @@ void ImageOutputDev::writeImageFile(ImgWriter *writer, ImageFormat format, const case imgRGB48: { p = imgStr->getLine(); - unsigned short *rowp16 = (unsigned short*)row; + unsigned short *rowp16 = reinterpret_cast<unsigned short*>(row); for (int x = 0; x < width; ++x) { if (p) { colorMap->getRGB(p, &rgb); diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index 614cd0b7..e6d22f34 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -469,7 +469,7 @@ static void writePageImage(GooString *filename) unsigned char *row = (unsigned char *) gmallocn(width, 4); for (int y = 0; y < height; y++ ) { - uint32_t *pixel = (uint32_t *) (data + y*stride); + uint32_t *pixel = reinterpret_cast<uint32_t *>((data + y*stride)); unsigned char *rowp = row; int bit = 7; for (int x = 0; x < width; x++, pixel++) { _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
