mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Tidied up some inconsistent indentation.
This commit is contained in:
110
pngpread.c
110
pngpread.c
@@ -30,7 +30,7 @@
|
||||
|
||||
void PNGAPI
|
||||
png_process_data(png_structp png_ptr, png_infop info_ptr,
|
||||
png_bytep buffer, png_size_t buffer_size)
|
||||
png_bytep buffer, png_size_t buffer_size)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
@@ -128,7 +128,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
||||
}
|
||||
|
||||
png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
|
||||
num_to_check);
|
||||
num_to_check);
|
||||
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
|
||||
|
||||
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
|
||||
@@ -232,8 +232,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
}
|
||||
|
||||
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
|
||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||
|
||||
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
|
||||
{
|
||||
@@ -286,7 +286,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
png_error(png_ptr, "Missing IHDR before IDAT");
|
||||
|
||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
!(png_ptr->mode & PNG_HAVE_PLTE))
|
||||
!(png_ptr->mode & PNG_HAVE_PLTE))
|
||||
png_error(png_ptr, "Missing PLTE before IDAT");
|
||||
}
|
||||
}
|
||||
@@ -681,32 +681,32 @@ png_push_save_buffer(png_structp png_ptr)
|
||||
|
||||
istop = png_ptr->save_buffer_size;
|
||||
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
|
||||
i < istop; i++, sp++, dp++)
|
||||
i < istop; i++, sp++, dp++)
|
||||
{
|
||||
*dp = *sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
|
||||
png_ptr->save_buffer_max)
|
||||
png_ptr->save_buffer_max)
|
||||
{
|
||||
png_size_t new_max;
|
||||
png_bytep old_buffer;
|
||||
|
||||
if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
|
||||
(png_ptr->current_buffer_size + 256))
|
||||
(png_ptr->current_buffer_size + 256))
|
||||
{
|
||||
png_error(png_ptr, "Potential overflow of save_buffer");
|
||||
png_error(png_ptr, "Potential overflow of save_buffer");
|
||||
}
|
||||
|
||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||
old_buffer = png_ptr->save_buffer;
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
|
||||
(png_size_t)new_max);
|
||||
(png_size_t)new_max);
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||
}
|
||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
png_free(png_ptr, old_buffer);
|
||||
@@ -871,10 +871,10 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
||||
#endif
|
||||
png_ptr->row_number == png_ptr->num_rows))
|
||||
{
|
||||
if (png_ptr->zstream.avail_in)
|
||||
png_warning(png_ptr, "Too much data in IDAT chunks");
|
||||
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
|
||||
break;
|
||||
if (png_ptr->zstream.avail_in)
|
||||
png_warning(png_ptr, "Too much data in IDAT chunks");
|
||||
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
|
||||
break;
|
||||
}
|
||||
png_push_process_row(png_ptr);
|
||||
png_ptr->zstream.avail_out =
|
||||
@@ -916,7 +916,7 @@ png_push_process_row(png_structp png_ptr)
|
||||
if (png_ptr->pass < 6)
|
||||
/* old interface (pre-1.0.9):
|
||||
png_do_read_interlace(&(png_ptr->row_info),
|
||||
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
|
||||
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
|
||||
*/
|
||||
png_do_read_interlace(png_ptr);
|
||||
|
||||
@@ -1131,7 +1131,7 @@ png_read_push_finish_row(png_structp png_ptr)
|
||||
if ((png_ptr->pass == 1 && png_ptr->width < 5) ||
|
||||
(png_ptr->pass == 3 && png_ptr->width < 3) ||
|
||||
(png_ptr->pass == 5 && png_ptr->width < 2))
|
||||
png_ptr->pass++;
|
||||
png_ptr->pass++;
|
||||
|
||||
if (png_ptr->pass > 7)
|
||||
png_ptr->pass--;
|
||||
@@ -1160,7 +1160,7 @@ png_read_push_finish_row(png_structp png_ptr)
|
||||
#ifdef PNG_READ_tEXt_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
@@ -1180,7 +1180,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
#endif
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)(length + 1));
|
||||
(png_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
@@ -1234,7 +1234,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||
png_sizeof(png_text));
|
||||
png_sizeof(png_text));
|
||||
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr->key = key;
|
||||
#ifdef PNG_iTXt_SUPPORTED
|
||||
@@ -1250,7 +1250,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
|
||||
png_ptr->current_text = NULL;
|
||||
|
||||
if (ret)
|
||||
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1280,7 +1280,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
#endif
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)(length + 1));
|
||||
(png_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
@@ -1347,7 +1347,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
png_ptr->zstream.next_in = (png_bytep )text;
|
||||
png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
|
||||
(text - key));
|
||||
(text - key));
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
|
||||
|
||||
@@ -1373,16 +1373,16 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
if (text == NULL)
|
||||
{
|
||||
text = (png_charp)png_malloc(png_ptr,
|
||||
(png_ptr->zbuf_size
|
||||
- png_ptr->zstream.avail_out + key_size + 1));
|
||||
(png_ptr->zbuf_size
|
||||
- png_ptr->zstream.avail_out + key_size + 1));
|
||||
|
||||
png_memcpy(text + key_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
|
||||
png_memcpy(text, key, key_size);
|
||||
|
||||
text_size = key_size + png_ptr->zbuf_size -
|
||||
png_ptr->zstream.avail_out;
|
||||
png_ptr->zstream.avail_out;
|
||||
|
||||
*(text + text_size) = '\0';
|
||||
}
|
||||
@@ -1392,14 +1392,14 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
tmp = text;
|
||||
text = (png_charp)png_malloc(png_ptr, text_size +
|
||||
(png_ptr->zbuf_size
|
||||
- png_ptr->zstream.avail_out + 1));
|
||||
(png_ptr->zbuf_size
|
||||
- png_ptr->zstream.avail_out + 1));
|
||||
|
||||
png_memcpy(text, tmp, text_size);
|
||||
png_free(png_ptr, tmp);
|
||||
|
||||
png_memcpy(text + text_size, png_ptr->zbuf,
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
|
||||
|
||||
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
|
||||
*(text + text_size) = '\0';
|
||||
@@ -1451,7 +1451,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
png_free(png_ptr, text_ptr);
|
||||
|
||||
if (ret)
|
||||
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||
png_warning(png_ptr, "Insufficient memory to store text chunk");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1459,7 +1459,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
length)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
|
||||
{
|
||||
@@ -1479,7 +1479,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
#endif
|
||||
|
||||
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)(length + 1));
|
||||
(png_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
@@ -1548,15 +1548,15 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
|
||||
if (lang_key < key + png_ptr->current_text_size - 1)
|
||||
{
|
||||
for (; *text; text++)
|
||||
/* Empty loop */ ;
|
||||
for (; *text; text++)
|
||||
/* Empty loop */ ;
|
||||
}
|
||||
|
||||
if (text < key + png_ptr->current_text_size)
|
||||
text++;
|
||||
|
||||
text_ptr = (png_textp)png_malloc(png_ptr,
|
||||
png_sizeof(png_text));
|
||||
png_sizeof(png_text));
|
||||
|
||||
text_ptr->compression = comp_flag + 2;
|
||||
text_ptr->key = key;
|
||||
@@ -1583,7 +1583,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
length)
|
||||
length)
|
||||
{
|
||||
png_uint_32 skip = 0;
|
||||
|
||||
@@ -1591,11 +1591,11 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
{
|
||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS
|
||||
PNG_HANDLE_CHUNK_ALWAYS
|
||||
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
&& png_ptr->read_user_chunk_fn == NULL
|
||||
#endif
|
||||
)
|
||||
)
|
||||
#endif
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
|
||||
@@ -1608,16 +1608,16 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
if (length > (png_uint_32)65535L)
|
||||
{
|
||||
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
||||
skip = length - (png_uint_32)65535L;
|
||||
length = (png_uint_32)65535L;
|
||||
png_warning(png_ptr, "unknown chunk too large to fit in memory");
|
||||
skip = length - (png_uint_32)65535L;
|
||||
length = (png_uint_32)65535L;
|
||||
}
|
||||
#endif
|
||||
png_memcpy((png_charp)png_ptr->unknown_chunk.name,
|
||||
(png_charp)png_ptr->chunk_name,
|
||||
png_sizeof(png_ptr->unknown_chunk.name));
|
||||
(png_charp)png_ptr->chunk_name,
|
||||
png_sizeof(png_ptr->unknown_chunk.name));
|
||||
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
|
||||
= '\0';
|
||||
= '\0';
|
||||
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length;
|
||||
|
||||
@@ -1627,7 +1627,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
else
|
||||
{
|
||||
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
|
||||
(png_size_t)length);
|
||||
(png_size_t)length);
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
|
||||
}
|
||||
|
||||
@@ -1637,7 +1637,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
/* Callback to user unknown chunk handler */
|
||||
int ret;
|
||||
ret = (*(png_ptr->read_user_chunk_fn))
|
||||
(png_ptr, &png_ptr->unknown_chunk);
|
||||
(png_ptr, &png_ptr->unknown_chunk);
|
||||
|
||||
if (ret < 0)
|
||||
png_chunk_error(png_ptr, "error in user chunk");
|
||||
@@ -1646,16 +1646,16 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
|
||||
{
|
||||
if (!(png_ptr->chunk_name[0] & 0x20))
|
||||
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
|
||||
PNG_HANDLE_CHUNK_ALWAYS)
|
||||
PNG_HANDLE_CHUNK_ALWAYS)
|
||||
png_chunk_error(png_ptr, "unknown critical chunk");
|
||||
png_set_unknown_chunks(png_ptr, info_ptr,
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
&png_ptr->unknown_chunk, 1);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
#endif
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
|
||||
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
|
||||
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||
png_ptr->unknown_chunk.data = NULL;
|
||||
}
|
||||
@@ -1690,7 +1690,7 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
|
||||
|
||||
void PNGAPI
|
||||
png_progressive_combine_row (png_structp png_ptr,
|
||||
png_bytep old_row, png_bytep new_row)
|
||||
png_bytep old_row, png_bytep new_row)
|
||||
{
|
||||
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
|
||||
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
|
||||
@@ -1704,8 +1704,8 @@ png_progressive_combine_row (png_structp png_ptr,
|
||||
|
||||
void PNGAPI
|
||||
png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
||||
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
||||
png_progressive_end_ptr end_fn)
|
||||
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
||||
png_progressive_end_ptr end_fn)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user