Fix comparison of integer expressions of different signedness warnings

This commit is contained in:
Nyall Dawson
2024-01-12 08:11:23 +10:00
committed by Jakub Melka
parent bbecbf6311
commit 577866aa2f
11 changed files with 16 additions and 16 deletions

View File

@ -324,7 +324,7 @@ PDFImageData PDFCCITTFaxDecoder::decode()
if (isUsing2DEncoding) if (isUsing2DEncoding)
{ {
int b1_index = 0; size_t b1_index = 0;
// 2D encoding // 2D encoding
while (codingLine[a0_index] < m_parameters.columns) while (codingLine[a0_index] < m_parameters.columns)

View File

@ -2132,7 +2132,7 @@ std::vector<PDFColorComponent> PDFIndexedColorSpace::transformColorsToBaseColorS
const char* bytePointer = m_colors.constData() + byteOffset; const char* bytePointer = m_colors.constData() + byteOffset;
for (int i = 0; i < colorComponentCount; ++i) for (std::size_t i = 0; i < colorComponentCount; ++i)
{ {
const unsigned char value = *bytePointer++; const unsigned char value = *bytePointer++;
const PDFColorComponent component = static_cast<PDFColorComponent>(value) / 255.0f; const PDFColorComponent component = static_cast<PDFColorComponent>(value) / 255.0f;

View File

@ -773,7 +773,7 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
pageIndex1 = textItem->pageIndex; pageIndex1 = textItem->pageIndex;
} }
if (textCompareItem.charIndex + textCompareItem.charCount <= textItem->characterBoundingRects.size()) if (static_cast< std::size_t >( textCompareItem.charIndex ) + textCompareItem.charCount <= textItem->characterBoundingRects.size())
{ {
const size_t startIndex = textCompareItem.charIndex; const size_t startIndex = textCompareItem.charIndex;
const size_t endIndex = startIndex + textCompareItem.charCount; const size_t endIndex = startIndex + textCompareItem.charCount;
@ -801,7 +801,7 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
pageIndex2 = textItem->pageIndex; pageIndex2 = textItem->pageIndex;
} }
if (textCompareItem.charIndex + textCompareItem.charCount <= textItem->characterBoundingRects.size()) if (static_cast< std::size_t >(textCompareItem.charIndex) + textCompareItem.charCount <= textItem->characterBoundingRects.size())
{ {
const size_t startIndex = textCompareItem.charIndex; const size_t startIndex = textCompareItem.charIndex;
const size_t endIndex = startIndex + textCompareItem.charCount; const size_t endIndex = startIndex + textCompareItem.charCount;

View File

@ -283,9 +283,9 @@ PDFDocumentManipulator::ProcessedPages PDFDocumentManipulator::collectObjectsAnd
std::vector<pdf::PDFObjectReference> objectsToMerge; std::vector<pdf::PDFObjectReference> objectsToMerge;
objectsToMerge.reserve(std::distance(it, itEnd)); objectsToMerge.reserve(std::distance(it, itEnd));
for (int pageIndex : pageIndices) for (PDFInteger pageIndex : pageIndices)
{ {
if (pageIndex < 0 || pageIndex >= currentPages.size()) if (pageIndex < 0 || pageIndex >= static_cast< PDFInteger >(currentPages.size()))
{ {
throw PDFException(tr("Missing page (%1) in a document.").arg(pageIndex)); throw PDFException(tr("Missing page (%1) in a document.").arg(pageIndex));
} }

View File

@ -2104,7 +2104,7 @@ void PDFFontCache::setCacheShrinkEnabled(const void* source, bool enabled)
} }
} }
void PDFFontCache::setCacheLimits(int fontCacheLimit, int instancedFontCacheLimit) void PDFFontCache::setCacheLimits(std::size_t fontCacheLimit, std::size_t instancedFontCacheLimit)
{ {
if (m_fontCacheLimit != fontCacheLimit || m_realizedFontCacheLimit != instancedFontCacheLimit) if (m_fontCacheLimit != fontCacheLimit || m_realizedFontCacheLimit != instancedFontCacheLimit)
{ {

View File

@ -452,7 +452,7 @@ public:
void setCacheShrinkEnabled(const void* source, bool enabled); void setCacheShrinkEnabled(const void* source, bool enabled);
/// Set font cache limits /// Set font cache limits
void setCacheLimits(int fontCacheLimit, int instancedFontCacheLimit); void setCacheLimits(std::size_t fontCacheLimit, std::size_t instancedFontCacheLimit);
/// If shrinking is enabled, then erase font, if cache limit is exceeded. /// If shrinking is enabled, then erase font, if cache limit is exceeded.
void shrink(); void shrink();

View File

@ -1305,7 +1305,7 @@ bool PDFSignatureHandler_adbe_pkcs7_rsa_sha1::getMessageDigestAlgorithm(ASN1_OCT
return false; return false;
} }
Q_ASSERT(signatureSize < decryptedBuffer.size()); Q_ASSERT(static_cast<std::size_t>(signatureSize) < decryptedBuffer.size());
const unsigned char* decryptedBufferPtr = decryptedBuffer.data(); const unsigned char* decryptedBufferPtr = decryptedBuffer.data();
if (X509_SIG* x509_sig = d2i_X509_SIG(nullptr, &decryptedBufferPtr, signatureSize)) if (X509_SIG* x509_sig = d2i_X509_SIG(nullptr, &decryptedBufferPtr, signatureSize))

View File

@ -112,7 +112,7 @@ QByteArray PDFAscii85DecodeFilter::apply(const QByteArray& data,
std::array<uint32_t, 5> scannedChars; std::array<uint32_t, 5> scannedChars;
scannedChars.fill(84); scannedChars.fill(84);
scannedChars[0] = scannedChar - 33; scannedChars[0] = scannedChar - 33;
int validBytes = 0; std::size_t validBytes = 0;
for (auto it2 = std::next(scannedChars.begin()); it2 != scannedChars.end(); ++it2) for (auto it2 = std::next(scannedChars.begin()); it2 != scannedChars.end(); ++it2)
{ {
uint32_t character = getChar(); uint32_t character = getChar();
@ -141,7 +141,7 @@ QByteArray PDFAscii85DecodeFilter::apply(const QByteArray& data,
} }
Q_ASSERT(validBytes <= decodedBytesUnpacked.size()); Q_ASSERT(validBytes <= decodedBytesUnpacked.size());
for (int i = 0; i < validBytes; ++i) for (std::size_t i = 0; i < validBytes; ++i)
{ {
result.push_back(decodedBytesUnpacked[i]); result.push_back(decodedBytesUnpacked[i]);
} }

View File

@ -527,8 +527,8 @@ void PDFFloatBitmap::blend(const PDFFloatBitmap& source,
Q_ASSERT(blendRegion.left() >= 0); Q_ASSERT(blendRegion.left() >= 0);
Q_ASSERT(blendRegion.top() >= 0); Q_ASSERT(blendRegion.top() >= 0);
Q_ASSERT(blendRegion.right() < source.getWidth()); Q_ASSERT(static_cast<std::size_t>( blendRegion.right() ) < source.getWidth());
Q_ASSERT(blendRegion.bottom() < source.getHeight()); Q_ASSERT(static_cast< std::size_t >( blendRegion.bottom() ) < source.getHeight());
const PDFPixelFormat pixelFormat = source.getPixelFormat(); const PDFPixelFormat pixelFormat = source.getPixelFormat();
const uint8_t shapeChannel = pixelFormat.getShapeChannelIndex(); const uint8_t shapeChannel = pixelFormat.getShapeChannelIndex();
@ -3682,7 +3682,7 @@ PDFColorComponent PDFPainterPathSampler::sampleByScanLine(QPoint point) const
PDFColorComponent sampleValue = 0.0f; PDFColorComponent sampleValue = 0.0f;
const PDFColorComponent sampleGain = 1.0f / PDFColorComponent(m_samplesCount * m_samplesCount); const PDFColorComponent sampleGain = 1.0f / PDFColorComponent(m_samplesCount * m_samplesCount);
for (size_t i = 0; i < m_samplesCount; ++i) for (int i = 0; i < m_samplesCount; ++i)
{ {
sampleValue += performSampling(scanLineGridRowTop++, coordX1 + offset, m_samplesCount, offset, sampleGain); sampleValue += performSampling(scanLineGridRowTop++, coordX1 + offset, m_samplesCount, offset, sampleGain);
} }

View File

@ -581,7 +581,7 @@ QColor PDFColorScale::map(PDFReal value) const
fractionValue = 1.0; fractionValue = 1.0;
} }
Q_ASSERT(index + 1 < m_colorScales.size()); Q_ASSERT(index + 1 < static_cast<int>(m_colorScales.size()));
const QColor& leftValue = m_colorScales[index]; const QColor& leftValue = m_colorScales[index];
const QColor& rightValue = m_colorScales[index + 1]; const QColor& rightValue = m_colorScales[index + 1];

View File

@ -10399,7 +10399,7 @@ void PDFXFALayoutEngine::layoutFlow(LayoutParameters& layoutParameters, bool bre
sourceLayout.updatePresence(layoutParameters.presence); sourceLayout.updatePresence(layoutParameters.presence);
PDFReal width = 0; PDFReal width = 0;
for (size_t i = 0; i < sourceLayout.colSpan; ++i) for (int i = 0; i < sourceLayout.colSpan; ++i)
{ {
if (columnTargetIndex >= columnWidths.size()) if (columnTargetIndex >= columnWidths.size())
{ {