Negate the header size as a signed value when seeking back

read_header rewinds past the header with seek(-header_size), but
header_size is a size_t, so the minus wrapped around and only became
-16 again in the conversion to ssize_t. MSVC flags the unsigned
negation as C4146. Cast to ssize_t before negating; the offset passed
to seek is the same.
This commit is contained in:
Erik Fröjdh committed 2026-10-05 21:09:40 +02:00
1 parent e6126e2a31
commit 81cca36a58
1 file changed
+1 -1
+1 -1
View File
@@ -221,7 +221,7 @@ JungfrauDataHeader JungfrauDataFile::read_header() {
throw std::runtime_error(LOCATION + "Could not read header from file" +
m_fp.error_msg());
}
m_fp.seek(-header_size, SEEK_CUR);
m_fp.seek(-static_cast<ssize_t>(header_size), SEEK_CUR);
return header;
}