mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
chore: Clean up the spurious uses of sizeof(png_byte)
; fix the manual
By definition, `sizeof(png_byte)` is 1. Remove all the occurences of `sizeof(png_byte)` from the code, and fix a related typo in the libpng manual. Also update the main .editorconfig file to reflect the fixing expected by a FIXME note.
This commit is contained in:
parent
4191872d0d
commit
0fa3c0f698
@ -16,8 +16,7 @@ indent_style = space
|
||||
[*.[chS]]
|
||||
indent_style = space
|
||||
max_doc_length = 80
|
||||
max_line_length = 81
|
||||
# FIXME: max_line_length should be 80
|
||||
max_line_length = 80
|
||||
|
||||
[*.dfa]
|
||||
indent_style = space
|
||||
|
@ -1178,11 +1178,11 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
||||
If you know your image size and pixel size ahead of time, you can allocate
|
||||
row_pointers prior to calling png_read_png() with
|
||||
|
||||
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
||||
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
|
||||
png_error(png_ptr,
|
||||
"Image is too tall to process in memory");
|
||||
|
||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||
if (width > PNG_UINT_32_MAX / pixel_size)
|
||||
png_error(png_ptr,
|
||||
"Image is too wide to process in memory");
|
||||
|
||||
|
4
libpng.3
4
libpng.3
@ -1697,11 +1697,11 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
||||
If you know your image size and pixel size ahead of time, you can allocate
|
||||
row_pointers prior to calling png_read_png() with
|
||||
|
||||
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
|
||||
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
|
||||
png_error(png_ptr,
|
||||
"Image is too tall to process in memory");
|
||||
|
||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||
if (width > PNG_UINT_32_MAX / pixel_size)
|
||||
png_error(png_ptr,
|
||||
"Image is too wide to process in memory");
|
||||
|
||||
|
17
pngrtran.c
17
pngrtran.c
@ -440,7 +440,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
int i;
|
||||
|
||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)num_palette);
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->quantize_index[i] = (png_byte)i;
|
||||
}
|
||||
@ -457,7 +457,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
|
||||
/* Initialize an array to sort colors */
|
||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)num_palette);
|
||||
|
||||
/* Initialize the quantize_sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -591,11 +591,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
|
||||
/* Initialize palette index arrays */
|
||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||
(sizeof (png_byte))));
|
||||
(png_alloc_size_t)num_palette);
|
||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||
(sizeof (png_byte))));
|
||||
(png_alloc_size_t)num_palette);
|
||||
|
||||
/* Initialize the sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -760,12 +758,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
size_t num_entries = ((size_t)1 << total_bits);
|
||||
|
||||
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
||||
(png_alloc_size_t)(num_entries * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)(num_entries));
|
||||
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
|
||||
(sizeof (png_byte))));
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)num_entries);
|
||||
|
||||
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
|
||||
memset(distance, 0xff, num_entries);
|
||||
|
||||
for (i = 0; i < num_palette; i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user