mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Remove top-level const from function-scope variables
As per the const correctness rules, top-level const-ness of data in automatic scopes does not propagate outside of these scopes (unlike const-ness at lower levels, such as pointers to const data). Previously, const was used liberally, but inconsistently across the libpng codebase. Using const wherever applicable is not incorrect. However, _consistent_ use of const is difficult to maintain in such conditions. In conclusion, we shall continue to use const only where doing so is strictly necessary: 1. If a function guarantees that it will not modify an argument passed by pointer, the corresponding function parameter should be a pointer-to-const (const T *). 2. Static data should not be modified, therefore it should be const. Reference: Google C++ Style Guide https://google.github.io/styleguide/cppguide.html#Use_of_const
This commit is contained in:
@@ -2514,7 +2514,7 @@ zlib_run(struct zlib *zlib)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
const unsigned int count = list->count;
|
||||
unsigned int count = list->count;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i<count; ++i)
|
||||
@@ -2791,7 +2791,7 @@ process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length,
|
||||
* to read_chunk.
|
||||
*/
|
||||
{
|
||||
const png_uint_32 type = file->type;
|
||||
png_uint_32 type = file->type;
|
||||
|
||||
if (file->global->verbose > 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user