fix Warning

This commit is contained in:
berrux-dev committed 2026-10-03 09:20:13 +02:00
1 parent 593c221d23
commit 8345470273
316 files changed
+1246 -929

No files matched your search

@@ -22,8 +22,10 @@ namespace NGL
{
Compress::Compress(QObject* parent)
: QObject(parent), m_u2_memFiles(), m_aborted(0),
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("nglcompress"))
: QObject(parent)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("nglcompress"))
, m_u2_memFiles()
, m_aborted(0)
{
DEBUG_LOG(m_logger) << "c_tor";
@@ -119,7 +119,9 @@ bool TarFilter::Private::fi2tph(const FileInformations &infos)
constexpr int octalMax = 01000000;
while (checksum > octalMax)
checksum -= octalMax;
sprintf(hdr.chksum, "%06o", checksum);
// checksum is bounded to < octalMax (<= 6 octal digits) and fits the 8-byte chksum field;
// keep the modulo so GCC's -Wformat-truncation analysis sees the bound (avoids a false positive).
snprintf(hdr.chksum, sizeof(hdr.chksum), "%.6o", checksum % octalMax);
if (!device->write((const char *)&hdr, sizeof(hdr)))
{