Placate some GCC warnings (#6563)

This commit is contained in:
Lawrence Lee
2022-09-05 18:05:35 -07:00
parent 6819b32be7
commit 4b97a5cf3c
4 changed files with 17 additions and 19 deletions

View File

@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#include <cstdint>
#include <functional>
#include <strings.h>
@@ -601,7 +602,7 @@ FrameData::FrameData(rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
// ----------------------- Special file type detection (HDR, PixelShift) ------------------------
uint16 bitspersample = 0, samplesperpixel = 0, sampleformat = 0, photometric = 0, compression = 0;
uint16_t bitspersample = 0, samplesperpixel = 0, sampleformat = 0, photometric = 0, compression = 0;
const rtexif::Tag* const bps = frameRootDir->findTag("BitsPerSample");
const rtexif::Tag* const spp = frameRootDir->findTag("SamplesPerPixel");
const rtexif::Tag* const sf = frameRootDir->findTag("SampleFormat");

View File

@@ -21,6 +21,7 @@
#include <glib/gstdio.h>
#include <tiff.h>
#include <tiffio.h>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <fcntl.h>
@@ -664,7 +665,7 @@ int ImageIO::getTIFFSampleFormat (const Glib::ustring &fname, IIOSampleFormat &s
return IMIO_CANNOTREADFILE;
}
uint16 bitspersample = 0, samplesperpixel = 0, sampleformat = 0;
uint16_t bitspersample = 0, samplesperpixel = 0, sampleformat = 0;
int hasTag = TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
hasTag &= TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
@@ -689,7 +690,7 @@ int ImageIO::getTIFFSampleFormat (const Glib::ustring &fname, IIOSampleFormat &s
sampleformat = SAMPLEFORMAT_UINT;
}
uint16 config;
uint16_t config;
TIFFGetField(in, TIFFTAG_PLANARCONFIG, &config);
if (config == PLANARCONFIG_CONTIG) {
@@ -701,14 +702,14 @@ int ImageIO::getTIFFSampleFormat (const Glib::ustring &fname, IIOSampleFormat &s
return IMIO_VARIANTNOTSUPPORTED;
}
uint16 photometric;
uint16_t photometric;
if (!TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric)) {
TIFFClose(in);
return IMIO_VARIANTNOTSUPPORTED;
}
uint16 compression;
uint16_t compression;
if (photometric == PHOTOMETRIC_LOGLUV)
if (!TIFFGetField(in, TIFFTAG_COMPRESSION, &compression)) {
@@ -786,7 +787,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname)
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
uint16 bitspersample, samplesperpixel;
uint16_t bitspersample, samplesperpixel;
int hasTag = TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample);
hasTag &= TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
@@ -798,7 +799,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname)
return IMIO_VARIANTNOTSUPPORTED;
}
uint16 config;
uint16_t config;
TIFFGetField(in, TIFFTAG_PLANARCONFIG, &config);
if (config != PLANARCONFIG_CONTIG) {
@@ -819,7 +820,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname)
*/
if (settings->verbose) {
printf("Information of \"%s\":\n", fname.c_str());
uint16 tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit;
uint16_t tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit;
if (TIFFGetField(in, TIFFTAG_DEFAULTSCALE, &tiffDefaultScale)) {
printf(" DefaultScale: %d\n", tiffDefaultScale);
}
@@ -836,7 +837,7 @@ int ImageIO::loadTIFF (const Glib::ustring &fname)
else
printf(" No LinearResponseLimit value!\n");
uint16 tiffMinValue, tiffMaxValue;
uint16_t tiffMinValue, tiffMaxValue;
if (TIFFGetField(in, TIFFTAG_SMINSAMPLEVALUE, &tiffMinValue)) {
printf(" MinValue: %d\n", tiffMinValue);
}
@@ -1556,15 +1557,15 @@ int ImageIO::saveTIFF (const Glib::ustring &fname, int bps, bool isFloat, bool u
*/
if (applyExifPatch) {
unsigned char b[10];
uint16 tagCount = 0;
uint16_t tagCount = 0;
lseek(fileno, 4, SEEK_SET);
read(fileno, b, 4);
uint32 ifd0Offset = rtexif::sget4(b, exifRoot->getOrder());
uint32_t ifd0Offset = rtexif::sget4(b, exifRoot->getOrder());
lseek(fileno, ifd0Offset, SEEK_SET);
read(fileno, b, 2);
tagCount = rtexif::sget2(b, exifRoot->getOrder());
for (size_t i = 0; i < tagCount ; ++i) {
uint16 tagID = 0;
uint16_t tagID = 0;
read(fileno, b, 2);
tagID = rtexif::sget2(b, exifRoot->getOrder());
if (tagID == 0x8769) {