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:
@@ -173,7 +173,7 @@ static const vector unsigned char VSX_SHORT_TO_CHAR4_3 = {16,16,16,16,16,16,16,1
|
||||
void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
const png_byte bpp = 4;
|
||||
png_byte bpp = 4;
|
||||
|
||||
vector unsigned char rp_vec;
|
||||
vector unsigned char part_vec;
|
||||
@@ -230,7 +230,7 @@ void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_sub3_vsx(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
const png_byte bpp = 3;
|
||||
png_byte bpp = 3;
|
||||
|
||||
vector unsigned char rp_vec;
|
||||
vector unsigned char part_vec;
|
||||
@@ -294,7 +294,7 @@ void png_read_filter_row_sub3_vsx(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_avg4_vsx(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
const png_byte bpp = 4;
|
||||
png_byte bpp = 4;
|
||||
|
||||
vector unsigned char rp_vec;
|
||||
vector unsigned char pp_vec;
|
||||
@@ -381,7 +381,7 @@ void png_read_filter_row_avg4_vsx(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_avg3_vsx(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
const png_byte bpp = 3;
|
||||
png_byte bpp = 3;
|
||||
|
||||
vector unsigned char rp_vec;
|
||||
vector unsigned char pp_vec;
|
||||
@@ -499,7 +499,7 @@ void png_read_filter_row_avg3_vsx(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_paeth4_vsx(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
const png_byte bpp = 4;
|
||||
png_byte bpp = 4;
|
||||
|
||||
int a, b, c, pa, pb, pc, p;
|
||||
vector unsigned char rp_vec;
|
||||
@@ -619,7 +619,7 @@ void png_read_filter_row_paeth4_vsx(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_paeth3_vsx(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
const png_byte bpp = 3;
|
||||
png_byte bpp = 3;
|
||||
|
||||
int a, b, c, pa, pb, pc, p;
|
||||
vector unsigned char rp_vec;
|
||||
|
||||
Reference in New Issue
Block a user