From b65e6c0ccca514db0ed070449ae68de6bf07fb02 Mon Sep 17 00:00:00 2001
From: billpriest <bill.priest@railspire.com>
Date: Thu, 21 Apr 2022 19:06:25 -0500
Subject: [PATCH] Changes to compile clean with c++-11.

Change from deprecated uintxx to uintxx_t.

Change-Id: I8fff998e56c05e83f8d1084228f5f2f19940d7cb
---
 .../imageformats/tiff/qtiffhandler.cpp        | 58 +++++++++----------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index bf4bc36..99ddc0f 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -116,7 +116,7 @@ public:
     QImageIOHandler::Transformations transformation;
     QImage::Format format;
     QSize size;
-    uint16 photometric;
+    uint16_t photometric;
     bool grayscale;
     bool headersRead;
     int currentDirectory;
@@ -250,8 +250,8 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device)
 
     TIFFSetDirectory(tiff, currentDirectory);
 
-    uint32 width;
-    uint32 height;
+    uint32_t width;
+    uint32_t height;
     if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width)
         || !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height)
         || !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) {
@@ -260,15 +260,15 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device)
     }
     size = QSize(width, height);
 
-    uint16 orientationTag;
+    uint16_t orientationTag;
     if (TIFFGetField(tiff, TIFFTAG_ORIENTATION, &orientationTag))
         transformation = exif2Qt(orientationTag);
 
     // BitsPerSample defaults to 1 according to the TIFF spec.
-    uint16 bitPerSample;
+    uint16_t bitPerSample;
     if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample))
         bitPerSample = 1;
-    uint16 samplesPerPixel; // they may be e.g. grayscale with 2 samples per pixel
+    uint16_t samplesPerPixel; // they may be e.g. grayscale with 2 samples per pixel
     if (!TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel))
         samplesPerPixel = 1;
 
@@ -288,8 +288,8 @@ bool QTiffHandlerPrivate::readHeaders(QIODevice *device)
         else
             format = QImage::Format_RGB32;
     else {
-        uint16 count;
-        uint16 *extrasamples;
+        uint16_t count;
+        uint16_t *extrasamples;
         // If there is any definition of the alpha-channel, libtiff will return premultiplied
         // data to us. If there is none, libtiff will not touch it and  we assume it to be
         // non-premultiplied, matching behavior of tested image editors, and how older Qt
@@ -377,7 +377,7 @@ bool QTiffHandler::read(QImage *image)
             }
             image->setColorTable(colortable);
         } else if (format == QImage::Format_Indexed8) {
-            const uint16 tableSize = 256;
+            const uint16_t tableSize = 256;
             QVector<QRgb> qtColorTable(tableSize);
             if (d->grayscale) {
                 for (int i = 0; i<tableSize; ++i) {
@@ -386,9 +386,9 @@ bool QTiffHandler::read(QImage *image)
                 }
             } else {
                 // create the color table
-                uint16 *redTable = 0;
-                uint16 *greenTable = 0;
-                uint16 *blueTable = 0;
+                uint16_t *redTable = 0;
+                uint16_t *greenTable = 0;
+                uint16_t *blueTable = 0;
                 if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
                     d->close();
                     return false;
@@ -448,7 +448,7 @@ bool QTiffHandler::read(QImage *image)
             }
             _TIFFfree(buf);
         } else {
-            for (uint32 y=0; y<height; ++y) {
+            for (uint32_t y=0; y<height; ++y) {
                 if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
                     d->close();
                     return false;
@@ -459,8 +459,8 @@ bool QTiffHandler::read(QImage *image)
             rgb48fixup(image);
     } else {
         const int stopOnError = 1;
-        if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), qt2Exif(d->transformation), stopOnError)) {
-            for (uint32 y=0; y<height; ++y)
+        if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32_t *>(image->bits()), qt2Exif(d->transformation), stopOnError)) {
+            for (uint32_t y=0; y<height; ++y)
                 convert32BitOrder(image->scanLine(y), width);
         } else {
             d->close();
@@ -471,7 +471,7 @@ bool QTiffHandler::read(QImage *image)
 
     float resX = 0;
     float resY = 0;
-    uint16 resUnit;
+    uint16_t resUnit;
     if (!TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit))
         resUnit = RESUNIT_INCH;
 
@@ -494,7 +494,7 @@ bool QTiffHandler::read(QImage *image)
         }
     }
 
-    uint32 count;
+    uint32_t count;
     void *profile;
     if (TIFFGetField(tiff, TIFFTAG_ICCPROFILE, &count, &profile)) {
         QByteArray iccProfile(reinterpret_cast<const char *>(profile), count);
@@ -618,7 +618,7 @@ bool QTiffHandler::write(const QImage &image)
     // configure image depth
     const QImage::Format format = image.format();
     if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) {
-        uint16 photometric = PHOTOMETRIC_MINISBLACK;
+        uint16_t  photometric = PHOTOMETRIC_MINISBLACK;
         if (image.colorTable().at(0) == 0xffffffff)
             photometric = PHOTOMETRIC_MINISWHITE;
         if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
@@ -640,7 +640,7 @@ bool QTiffHandler::write(const QImage &image)
             int chunkStart = y;
             int chunkEnd = y + chunk.height();
             while (y < chunkEnd) {
-                if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
+                if (TIFFWriteScanline(tiff, reinterpret_cast<uint32_t *>(chunk.scanLine(y - chunkStart)), y) != 1) {
                     TIFFClose(tiff);
                     return false;
                 }
@@ -655,7 +655,7 @@ bool QTiffHandler::write(const QImage &image)
         QVector<QRgb> colorTable = effectiveColorTable(image);
         bool isGrayscale = checkGrayscale(colorTable);
         if (isGrayscale) {
-            uint16 photometric = PHOTOMETRIC_MINISBLACK;
+            uint16_t photometric = PHOTOMETRIC_MINISBLACK;
             if (colorTable.at(0) == 0xffffffff)
                 photometric = PHOTOMETRIC_MINISWHITE;
             if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
@@ -677,9 +677,9 @@ bool QTiffHandler::write(const QImage &image)
             // allocate the color tables
             const int tableSize = colorTable.size();
             Q_ASSERT(tableSize <= 256);
-            QVarLengthArray<uint16> redTable(tableSize);
-            QVarLengthArray<uint16> greenTable(tableSize);
-            QVarLengthArray<uint16> blueTable(tableSize);
+            QVarLengthArray<uint16_t> redTable(tableSize);
+            QVarLengthArray<uint16_t> greenTable(tableSize);
+            QVarLengthArray<uint16_t> blueTable(tableSize);
 
             // set the color table
             for (int i = 0; i<tableSize; ++i) {
@@ -732,7 +732,7 @@ bool QTiffHandler::write(const QImage &image)
     } else if (format == QImage::Format_RGBA64
                || format == QImage::Format_RGBA64_Premultiplied) {
         const bool premultiplied = image.format() != QImage::Format_RGBA64;
-        const uint16 extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
+        const uint16_t extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
         if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
             || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
             || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
@@ -780,7 +780,7 @@ bool QTiffHandler::write(const QImage &image)
     } else {
         const bool premultiplied = image.format() != QImage::Format_ARGB32
                                 && image.format() != QImage::Format_RGBA8888;
-        const uint16 extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
+        const uint16_t extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
         if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
             || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
             || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
@@ -894,9 +894,9 @@ int QTiffHandler::currentImageNumber() const
 
 void QTiffHandler::convert32BitOrder(void *buffer, int width)
 {
-    uint32 *target = reinterpret_cast<uint32 *>(buffer);
-    for (int32 x=0; x<width; ++x) {
-        uint32 p = target[x];
+    uint32_t *target = reinterpret_cast<uint32_t *>(buffer);
+    for (int32_t x=0; x<width; ++x) {
+        uint32_t p = target[x];
         // convert between ARGB and ABGR
         target[x] = (p & 0xff000000)
                     | ((p & 0x00ff0000) >> 16)
@@ -913,7 +913,7 @@ void QTiffHandler::rgb48fixup(QImage *image)
     uchar *scanline = image->bits();
     const qsizetype bpl = image->bytesPerLine();
     for (int y = 0; y < h; ++y) {
-        quint16 *dst = reinterpret_cast<uint16 *>(scanline);
+        quint16 *dst = reinterpret_cast<uint16_t *>(scanline);
         for (int x = w - 1; x >= 0; --x) {
             dst[x * 4 + 3] = 0xffff;
             dst[x * 4 + 2] = dst[x * 3 + 2];
-- 
2.32.0

