Use C++-style casts (#1576)

This commit is contained in:
Sylvie
2024-12-09 21:56:54 -05:00
committed by GitHub
parent e66da4c8c7
commit b877c81c32
33 changed files with 197 additions and 173 deletions

View File

@@ -37,7 +37,7 @@ static unsigned long long getRandomBits(unsigned count) {
if (data == EOF) {
exit(0);
}
randbits |= (unsigned long long)data << randcount;
randbits |= static_cast<unsigned long long>(data) << randcount;
randcount += 8;
}
unsigned long long result = randbits & ((1ULL << count) - 1);

View File

@@ -115,7 +115,7 @@ class Png {
"bytes after reading %zu)",
self->path.c_str(),
length - nbBytesRead,
(size_t)self->file.pubseekoff(0, std::ios_base::cur)
static_cast<size_t>(self->file.pubseekoff(0, std::ios_base::cur))
);
}
}
@@ -152,7 +152,7 @@ public:
}
png = png_create_read_struct(
PNG_LIBPNG_VER_STRING, (png_voidp)this, handleError, handleWarning
PNG_LIBPNG_VER_STRING, static_cast<png_voidp>(this), handleError, handleWarning
);
if (!png) {
fatal("Failed to allocate PNG structure: %s", strerror(errno));