Use const_cast more precisely to remove const without changing type

This commit is contained in:
Rangi committed 2026-07-08 16:42:53 -04:00
1 parent b219e03b38
commit 276a1a7952
1 file changed
+2 -2
+2 -2
View File
@@ -420,7 +420,7 @@ void reverse() {
} }
png_structp png = png_create_write_struct( png_structp png = png_create_write_struct(
PNG_LIBPNG_VER_STRING, PNG_LIBPNG_VER_STRING,
const_cast<png_voidp>(static_cast<void const *>(pngFile.c_str(options.input))), const_cast<char *>(pngFile.c_str(options.input)),
pngError, pngError,
pngWarning pngWarning
); );
@@ -572,7 +572,7 @@ void reverse() {
// signature. // signature.
// (AIUI, casting away const-ness is okay as long as you don't actually modify the // (AIUI, casting away const-ness is okay as long as you don't actually modify the
// pointed-to data) // pointed-to data)
png_write_rows(png, const_cast<png_bytepp>(rowPtrs), 8); png_write_rows(png, const_cast<uint8_t **>(rowPtrs), 8);
} }
// Finalize the write // Finalize the write