[libpng16] Replace the remaining uses of png_size_t with size_t
In v1.6.0, size_t became a required type. It should be used consistently. To maintain backwards compatibility, png_size_t is still maintained in deprecated form.
This commit is contained in:
parent
916117d970
commit
a74aa9a002
@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
int passes = 1;
|
||||
# endif /* !WRITE_INTERLACING */
|
||||
int pass;
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = malloc(rowbytes);
|
||||
|
||||
@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static png_size_t
|
||||
static size_t
|
||||
load_fake(png_charp param, png_bytepp profile)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
{
|
||||
case '<':
|
||||
{
|
||||
png_size_t filelen = load_file(params[1]+1, &profile);
|
||||
size_t filelen = load_file(params[1]+1, &profile);
|
||||
if (filelen > 0xfffffffc) /* Maximum profile length */
|
||||
{
|
||||
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
||||
@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
png_size_t fake_len = load_fake(params[1], &profile);
|
||||
size_t fake_len = load_fake(params[1], &profile);
|
||||
|
||||
if (fake_len > 0) /* else a simple parameter */
|
||||
{
|
||||
@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
png_bytep data = NULL;
|
||||
png_size_t fake_len = load_fake(param, &data);
|
||||
size_t fake_len = load_fake(param, &data);
|
||||
|
||||
if (fake_len > 0) /* else a simple parameter */
|
||||
{
|
||||
|
@ -551,7 +551,7 @@ struct display
|
||||
png_structp original_pp; /* used on the original read */
|
||||
png_infop original_ip; /* set by the original read */
|
||||
|
||||
png_size_t original_rowbytes; /* of the original rows: */
|
||||
size_t original_rowbytes; /* of the original rows: */
|
||||
png_bytepp original_rows; /* from the original read */
|
||||
|
||||
/* Original chunks valid */
|
||||
@ -807,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename)
|
||||
|
||||
static void
|
||||
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||
png_size_t size)
|
||||
size_t size)
|
||||
{
|
||||
struct buffer_list *last = bp->current;
|
||||
size_t read_count = bp->read_count;
|
||||
@ -855,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
read_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
buffer_read(get_dp(pp), get_buffer(pp), data, size);
|
||||
}
|
||||
@ -1267,7 +1267,7 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
static void
|
||||
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||
png_size_t size)
|
||||
size_t size)
|
||||
/* Generic write function used both from the write callback provided to
|
||||
* libpng and from the generic read code.
|
||||
*/
|
||||
@ -1311,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
write_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
buffer_write(get_dp(pp), get_buffer(pp), data, size);
|
||||
}
|
||||
|
@ -578,11 +578,11 @@ typedef struct
|
||||
int stride_extra;
|
||||
FILE *input_file;
|
||||
png_voidp input_memory;
|
||||
png_size_t input_memory_size;
|
||||
size_t input_memory_size;
|
||||
png_bytep buffer;
|
||||
ptrdiff_t stride;
|
||||
png_size_t bufsize;
|
||||
png_size_t allocsize;
|
||||
size_t bufsize;
|
||||
size_t allocsize;
|
||||
char tmpfile_name[32];
|
||||
png_uint_16 colormap[256*4];
|
||||
}
|
||||
@ -665,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
|
||||
static void
|
||||
allocbuffer(Image *image)
|
||||
{
|
||||
png_size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||
size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||
|
||||
if (size+32 > image->bufsize)
|
||||
{
|
||||
|
@ -711,7 +711,7 @@ typedef struct png_store_file
|
||||
unsigned int IDAT_bits; /* Number of bits in IDAT size */
|
||||
png_uint_32 IDAT_size; /* Total size of IDAT data */
|
||||
png_uint_32 id; /* must be correct (see FILEID) */
|
||||
png_size_t datacount; /* In this (the last) buffer */
|
||||
size_t datacount; /* In this (the last) buffer */
|
||||
png_store_buffer data; /* Last buffer in file */
|
||||
int npalette; /* Number of entries in palette */
|
||||
store_palette_entry* palette; /* May be NULL */
|
||||
@ -777,10 +777,10 @@ typedef struct png_store
|
||||
png_infop piread;
|
||||
png_store_file* current; /* Set when reading */
|
||||
png_store_buffer* next; /* Set when reading */
|
||||
png_size_t readpos; /* Position in *next */
|
||||
size_t readpos; /* Position in *next */
|
||||
png_byte* image; /* Buffer for reading interlaced images */
|
||||
png_size_t cb_image; /* Size of this buffer */
|
||||
png_size_t cb_row; /* Row size of the image(s) */
|
||||
size_t cb_image; /* Size of this buffer */
|
||||
size_t cb_row; /* Row size of the image(s) */
|
||||
uLong IDAT_crc;
|
||||
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
|
||||
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
|
||||
@ -791,7 +791,7 @@ typedef struct png_store
|
||||
png_store_file* saved;
|
||||
png_structp pwrite; /* Used when writing a new file */
|
||||
png_infop piwrite;
|
||||
png_size_t writepos; /* Position in .new */
|
||||
size_t writepos; /* Position in .new */
|
||||
char wname[FILE_NAME_SIZE];
|
||||
png_store_buffer new; /* The end of the new PNG file being written. */
|
||||
store_pool write_memory_pool;
|
||||
@ -1125,7 +1125,7 @@ static png_bytep
|
||||
store_image_row(const png_store* ps, png_const_structp pp, int nImage,
|
||||
png_uint_32 y)
|
||||
{
|
||||
png_size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||
size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||
|
||||
if (ps->image == NULL)
|
||||
png_error(pp, "no allocated image");
|
||||
@ -1160,9 +1160,9 @@ store_image_free(png_store *ps, png_const_structp pp)
|
||||
|
||||
static void
|
||||
store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
|
||||
png_size_t cbRow, png_uint_32 cRows)
|
||||
size_t cbRow, png_uint_32 cRows)
|
||||
{
|
||||
png_size_t cb = nImages * cRows * (cbRow + 5);
|
||||
size_t cb = nImages * cRows * (cbRow + 5);
|
||||
|
||||
if (ps->cb_image < cb)
|
||||
{
|
||||
@ -1234,7 +1234,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
|
||||
png_error(pp, "image overwrite");
|
||||
else
|
||||
{
|
||||
png_size_t cbRow = ps->cb_row;
|
||||
size_t cbRow = ps->cb_row;
|
||||
png_uint_32 rows = ps->image_h;
|
||||
|
||||
image += iImage * (cbRow+5) * ps->image_h;
|
||||
@ -1278,7 +1278,7 @@ valid_chunktype(png_uint_32 chunktype)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
store_write(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||
@ -1346,13 +1346,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
|
||||
else /* chunkpos >= 8 */
|
||||
{
|
||||
png_size_t cb = st;
|
||||
size_t cb = st;
|
||||
|
||||
if (cb > STORE_BUFFER_SIZE - writepos)
|
||||
cb = STORE_BUFFER_SIZE - writepos;
|
||||
|
||||
if (cb > chunklen - chunkpos/* bytes left in chunk*/)
|
||||
cb = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
cb = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
|
||||
memcpy(ps->new.buffer + writepos, pb, cb);
|
||||
chunkpos += (png_uint_32)/*SAFE*/cb;
|
||||
@ -1440,7 +1440,7 @@ store_read_buffer_next(png_store *ps)
|
||||
* during progressive read, where the io_ptr is set internally by libpng.
|
||||
*/
|
||||
static void
|
||||
store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||
store_read_imp(png_store *ps, png_bytep pb, size_t st)
|
||||
{
|
||||
if (ps->current == NULL || ps->next == NULL)
|
||||
png_error(ps->pread, "store state damaged");
|
||||
@ -1463,14 +1463,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||
}
|
||||
}
|
||||
|
||||
static png_size_t
|
||||
store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
const png_size_t min)
|
||||
static size_t
|
||||
store_read_chunk(png_store *ps, png_bytep pb, size_t max, size_t min)
|
||||
{
|
||||
png_uint_32 chunklen = ps->chunklen;
|
||||
png_uint_32 chunktype = ps->chunktype;
|
||||
png_uint_32 chunkpos = ps->chunkpos;
|
||||
png_size_t st = max;
|
||||
size_t st = max;
|
||||
|
||||
if (st > 0) do
|
||||
{
|
||||
@ -1601,8 +1600,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
|
||||
store_read_imp(ps, pb, avail);
|
||||
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
|
||||
pb += (png_size_t)/*SAFE*/avail;
|
||||
st -= (png_size_t)/*SAFE*/avail;
|
||||
pb += (size_t)/*SAFE*/avail;
|
||||
st -= (size_t)/*SAFE*/avail;
|
||||
chunkpos += (png_uint_32)/*SAFE*/avail;
|
||||
IDAT_size -= (png_uint_32)/*SAFE*/avail;
|
||||
IDAT_pos += (png_uint_32)/*SAFE*/avail;
|
||||
@ -1669,10 +1668,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
|
||||
else /* Return chunk bytes, including the CRC */
|
||||
{
|
||||
png_size_t avail = st;
|
||||
size_t avail = st;
|
||||
|
||||
if (avail > chunklen - chunkpos)
|
||||
avail = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
avail = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
|
||||
store_read_imp(ps, pb, avail);
|
||||
pb += avail;
|
||||
@ -1698,7 +1697,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
store_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
store_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||
@ -1724,7 +1723,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi)
|
||||
while (store_read_buffer_avail(ps) > 0)
|
||||
{
|
||||
static png_uint_32 noise = 2;
|
||||
png_size_t cb;
|
||||
size_t cb;
|
||||
png_byte buffer[512];
|
||||
|
||||
/* Generate 15 more bits of stuff: */
|
||||
@ -2991,7 +2990,7 @@ modifier_setbuffer(png_modifier *pm)
|
||||
* png_struct.
|
||||
*/
|
||||
static void
|
||||
modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
modifier_read_imp(png_modifier *pm, png_bytep pb, size_t st)
|
||||
{
|
||||
while (st > 0)
|
||||
{
|
||||
@ -3137,7 +3136,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
*/
|
||||
if (len+12 <= sizeof pm->buffer)
|
||||
{
|
||||
png_size_t s = len+12-pm->buffer_count;
|
||||
size_t s = len+12-pm->buffer_count;
|
||||
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
|
||||
pm->buffer_count = len+12;
|
||||
|
||||
@ -3196,7 +3195,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
|
||||
/* The callback: */
|
||||
static void PNGCBAPI
|
||||
modifier_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
modifier_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
|
||||
@ -3226,7 +3225,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
|
||||
for (;;)
|
||||
{
|
||||
static png_uint_32 noise = 1;
|
||||
png_size_t cb, cbAvail;
|
||||
size_t cb, cbAvail;
|
||||
png_byte buffer[512];
|
||||
|
||||
/* Generate 15 more bits of stuff: */
|
||||
|
@ -60,7 +60,7 @@ read_png(FILE *fp)
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
/* Failure to initialize these is harmless */
|
||||
row = malloc(rowbytes);
|
||||
|
@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
|
||||
do
|
||||
{
|
||||
png_size_t index;
|
||||
size_t index;
|
||||
int state, failed = 0;
|
||||
char buffer[64];
|
||||
|
||||
@ -329,7 +329,7 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
||||
{
|
||||
/* Test this character (ch) to ensure the parser does the correct thing.
|
||||
*/
|
||||
png_size_t index = 0;
|
||||
size_t index = 0;
|
||||
const char test = (char)ch;
|
||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
const int character_accepted = (index == 1);
|
||||
|
@ -65,7 +65,7 @@ typedef struct
|
||||
} io_data;
|
||||
|
||||
static PNG_CALLBACK(void, read_and_copy,
|
||||
(png_structp png_ptr, png_bytep buffer, png_size_t cb))
|
||||
(png_structp png_ptr, png_bytep buffer, size_t cb))
|
||||
{
|
||||
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
|
||||
|
||||
@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = voidcast(png_bytep,malloc(rowbytes));
|
||||
display = voidcast(png_bytep,malloc(rowbytes));
|
||||
|
@ -68,7 +68,7 @@ struct PngObjectHandler {
|
||||
}
|
||||
};
|
||||
|
||||
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
void user_read_data(png_structp png_ptr, png_bytep data, size_t length) {
|
||||
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
||||
if (length > buf_state->bytes_left) {
|
||||
png_error(png_ptr, "read error");
|
||||
|
@ -1725,7 +1725,7 @@ display_start_read(struct display *dp, const char *filename)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
read_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
struct display *dp = get_dp(pp);
|
||||
|
||||
@ -1881,7 +1881,7 @@ display_start_write(struct display *dp, const char *filename)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
write_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
struct display *dp = get_dp(pp);
|
||||
|
||||
|
@ -410,15 +410,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
#ifndef PNG_STDIO_SUPPORTED
|
||||
|
||||
static void
|
||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||
(FILE *)png_ptr->io_ptr);
|
||||
check = fread(data, 1, length, (FILE *)png_ptr->io_ptr);
|
||||
|
||||
if (check != length)
|
||||
{
|
||||
@ -427,7 +426,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
}
|
||||
|
||||
static void
|
||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_write_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_uint_32 check;
|
||||
|
||||
|
@ -23,8 +23,8 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
int iWidth, int iHeight, png_color BkgColor);
|
||||
|
||||
#ifndef PNG_STDIO_SUPPORTED
|
||||
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||
static void png_read_data(png_structp png_ptr, png_bytep data, size_t length);
|
||||
static void png_write_data(png_structp png_ptr, png_bytep data, size_t length);
|
||||
static void png_flush(png_structp png_ptr);
|
||||
#endif
|
||||
|
||||
|
@ -257,7 +257,7 @@ int check_if_png(char *file_name, FILE **fp)
|
||||
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
|
||||
Return nonzero (true) if they match */
|
||||
|
||||
return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
|
||||
return(!png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK));
|
||||
}
|
||||
|
||||
/* Read a PNG file. You may want to return an error code if the read
|
||||
|
@ -71,7 +71,7 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* There is no pixel to the left of the first pixel. It's encoded directly.
|
||||
* That works with our main loop if we just say that left pixel was zero.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
|
||||
__m128i a, d = _mm_setzero_si128();
|
||||
|
||||
@ -104,7 +104,7 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* There is no pixel to the left of the first pixel. It's encoded directly.
|
||||
* That works with our main loop if we just say that left pixel was zero.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
|
||||
__m128i a, d = _mm_setzero_si128();
|
||||
|
||||
@ -131,7 +131,7 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* perfectly with our loop if we make sure a starts at zero.
|
||||
*/
|
||||
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
|
||||
@ -185,7 +185,7 @@ void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* predicted to be half of the pixel above it. So again, this works
|
||||
* perfectly with our loop if we make sure a starts at zero.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i b;
|
||||
__m128i a, d = zero;
|
||||
@ -257,7 +257,7 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* Here we zero b and d, which become c and a respectively at the start of
|
||||
* the loop.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i c, b = zero,
|
||||
a, d = zero;
|
||||
@ -356,7 +356,7 @@ void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* Here we zero b and d, which become c and a respectively at the start of
|
||||
* the loop.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i pa,pb,pc,smallest,nearest;
|
||||
__m128i c, b = zero,
|
||||
|
@ -503,7 +503,7 @@ input stream. You must supply the function
|
||||
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
@ -4102,7 +4102,7 @@ READ APIs
|
||||
The PNG header is read from the stdio FILE object.
|
||||
|
||||
int png_image_begin_read_from_memory(png_imagep image,
|
||||
png_const_voidp memory, png_size_t size)
|
||||
png_const_voidp memory, size_t size)
|
||||
|
||||
The PNG header is read from the given memory buffer.
|
||||
|
||||
@ -4255,10 +4255,10 @@ png_get_io_ptr(). For example:
|
||||
The replacement I/O functions must have prototypes as follows:
|
||||
|
||||
void user_read_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_write_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_flush_data(png_structp png_ptr);
|
||||
|
||||
@ -4784,7 +4784,7 @@ behavior in case the application runs out of memory part-way through
|
||||
the process.
|
||||
|
||||
We changed the prototypes of png_get_compression_buffer_size() and
|
||||
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||
png_set_compression_buffer_size() to work with size_t instead of
|
||||
png_uint_32.
|
||||
|
||||
Support for numbered error messages was removed by default, since we
|
||||
|
24
libpng.3
24
libpng.3
@ -225,7 +225,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.35beta02
|
||||
|
||||
\fBint png_image_begin_read_from_stdio (png_imagep \fP\fIimage\fP\fB, FILE* \fIfile\fP\fB);\fP
|
||||
|
||||
\fBint, png_image_begin_read_from_memory (png_imagep \fP\fIimage\fP\fB, png_const_voidp \fP\fImemory\fP\fB, png_size_t \fIsize\fP\fB);\fP
|
||||
\fBint, png_image_begin_read_from_memory (png_imagep \fP\fIimage\fP\fB, png_const_voidp \fP\fImemory\fP\fB, size_t \fIsize\fP\fB);\fP
|
||||
|
||||
\fBint png_image_finish_read (png_imagep \fP\fIimage\fP\fB, png_colorp \fP\fIbackground\fP\fB, void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap\fP\fB);\fP
|
||||
|
||||
@ -237,7 +237,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.35beta02
|
||||
|
||||
\fBint png_image_write_to_stdio (png_imagep \fP\fIimage\fP\fB, FILE \fP\fI*file\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap)\fP\fB);\fP
|
||||
|
||||
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
|
||||
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, size_t \fIpng_info_struct_size\fP\fB);\fP
|
||||
|
||||
\fBvoid png_init_io (png_structp \fP\fIpng_ptr\fP\fB, FILE \fI*fp\fP\fB);\fP
|
||||
|
||||
@ -251,9 +251,9 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.35beta02
|
||||
|
||||
\fBpng_uint_32 png_permit_mng_features (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fImng_features_permitted\fP\fB);\fP
|
||||
|
||||
\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_size\fP\fB);\fP
|
||||
\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, size_t \fIbuffer_size\fP\fB);\fP
|
||||
|
||||
\fBpng_size_t png_process_data_pause \fP\fI(png_structp\fP\fB, int \fIsave\fP\fB);\fP
|
||||
\fBsize_t png_process_data_pause \fP\fI(png_structp\fP\fB, int \fIsave\fP\fB);\fP
|
||||
|
||||
\fBpng_uint_32 png_process_data_skip \fI(png_structp\fP\fB);\fP
|
||||
|
||||
@ -475,15 +475,15 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.35beta02
|
||||
|
||||
\fBvoid png_set_write_user_transform_fn (png_structp \fP\fIpng_ptr\fP\fB, png_user_transform_ptr \fIwrite_user_transform_fn\fP\fB);\fP
|
||||
|
||||
\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, png_size_t \fP\fIstart\fP\fB, png_size_t \fInum_to_check\fP\fB);\fP
|
||||
\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, size_t \fP\fIstart\fP\fB, size_t \fInum_to_check\fP\fB);\fP
|
||||
|
||||
\fBvoid png_start_read_image (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fBvoid png_warning (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fImessage\fP\fB);\fP
|
||||
|
||||
\fBvoid png_write_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||
\fBvoid png_write_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_bytep \fP\fIdata\fP\fB, size_t \fIlength\fP\fB);\fP
|
||||
|
||||
\fBvoid png_write_chunk_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||
\fBvoid png_write_chunk_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, size_t \fIlength\fP\fB);\fP
|
||||
|
||||
\fBvoid png_write_chunk_end (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
@ -1021,7 +1021,7 @@ input stream. You must supply the function
|
||||
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
@ -4620,7 +4620,7 @@ READ APIs
|
||||
The PNG header is read from the stdio FILE object.
|
||||
|
||||
int png_image_begin_read_from_memory(png_imagep image,
|
||||
png_const_voidp memory, png_size_t size)
|
||||
png_const_voidp memory, size_t size)
|
||||
|
||||
The PNG header is read from the given memory buffer.
|
||||
|
||||
@ -4773,10 +4773,10 @@ png_get_io_ptr(). For example:
|
||||
The replacement I/O functions must have prototypes as follows:
|
||||
|
||||
void user_read_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_write_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_flush_data(png_structp png_ptr);
|
||||
|
||||
@ -5302,7 +5302,7 @@ behavior in case the application runs out of memory part-way through
|
||||
the process.
|
||||
|
||||
We changed the prototypes of png_get_compression_buffer_size() and
|
||||
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||
png_set_compression_buffer_size() to work with size_t instead of
|
||||
png_uint_32.
|
||||
|
||||
Support for numbered error messages was removed by default, since we
|
||||
|
@ -366,8 +366,8 @@
|
||||
void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i, cnt, cnt16, cnt32;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i, cnt, cnt16, cnt32;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
|
||||
@ -457,8 +457,8 @@ void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_sub4_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t count;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t count;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row + 4;
|
||||
int32_t inp0;
|
||||
@ -496,8 +496,8 @@ void png_read_filter_row_sub4_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_sub3_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t count;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t count;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row + 3;
|
||||
int64_t out0;
|
||||
@ -541,11 +541,11 @@ void png_read_filter_row_sub3_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_avg4_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_size_t istop = row_info->rowbytes - 4;
|
||||
size_t istop = row_info->rowbytes - 4;
|
||||
int32_t inp0, inp1, out0;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
|
||||
v16u8 zero = { 0 };
|
||||
@ -592,11 +592,11 @@ void png_read_filter_row_avg4_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_avg3_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_size_t istop = row_info->rowbytes - 3;
|
||||
size_t istop = row_info->rowbytes - 3;
|
||||
int64_t out0;
|
||||
int32_t inp0, inp1, out1;
|
||||
int16_t out2;
|
||||
|
18
png.c
18
png.c
@ -71,7 +71,7 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
|
||||
* PNG signature (this is the same behavior as strcmp, memcmp, etc).
|
||||
*/
|
||||
int PNGAPI
|
||||
png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
|
||||
png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
|
||||
{
|
||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
|
||||
@ -136,7 +136,7 @@ png_reset_crc(png_structrp png_ptr)
|
||||
* trouble of calculating it.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
|
||||
png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, size_t length)
|
||||
{
|
||||
int need_crc = 1;
|
||||
|
||||
@ -421,7 +421,7 @@ png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
|
||||
* those cases where it does anything other than a memset.
|
||||
*/
|
||||
PNG_FUNCTION(void,PNGAPI
|
||||
png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
|
||||
png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
|
||||
PNG_DEPRECATED)
|
||||
{
|
||||
png_inforp info_ptr = *ptr_ptr;
|
||||
@ -2715,11 +2715,11 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||
#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
|
||||
|
||||
int /* PRIVATE */
|
||||
png_check_fp_number(png_const_charp string, png_size_t size, int *statep,
|
||||
png_check_fp_number(png_const_charp string, size_t size, int *statep,
|
||||
png_size_tp whereami)
|
||||
{
|
||||
int state = *statep;
|
||||
png_size_t i = *whereami;
|
||||
size_t i = *whereami;
|
||||
|
||||
while (i < size)
|
||||
{
|
||||
@ -2842,10 +2842,10 @@ PNG_FP_End:
|
||||
|
||||
/* The same but for a complete string. */
|
||||
int
|
||||
png_check_fp_string(png_const_charp string, png_size_t size)
|
||||
png_check_fp_string(png_const_charp string, size_t size)
|
||||
{
|
||||
int state=0;
|
||||
png_size_t char_index=0;
|
||||
size_t char_index=0;
|
||||
|
||||
if (png_check_fp_number(string, size, &state, &char_index) != 0 &&
|
||||
(char_index == size || string[char_index] == 0))
|
||||
@ -2906,7 +2906,7 @@ png_pow10(int power)
|
||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
void /* PRIVATE */
|
||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
||||
double fp, unsigned int precision)
|
||||
{
|
||||
/* We use standard functions from math.h, but not printf because
|
||||
@ -3237,7 +3237,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||
png_size_t size, png_fixed_point fp)
|
||||
size_t size, png_fixed_point fp)
|
||||
{
|
||||
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
|
||||
* trailing \0, 13 characters:
|
||||
|
34
png.h
34
png.h
@ -600,8 +600,8 @@ typedef struct png_text_struct
|
||||
png_charp key; /* keyword, 1-79 character description of "text" */
|
||||
png_charp text; /* comment, may be an empty string (ie "")
|
||||
or a NULL pointer */
|
||||
png_size_t text_length; /* length of the text string */
|
||||
png_size_t itxt_length; /* length of the itxt string */
|
||||
size_t text_length; /* length of the text string */
|
||||
size_t itxt_length; /* length of the itxt string */
|
||||
png_charp lang; /* language code, 0-79 characters
|
||||
or a NULL pointer */
|
||||
png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
|
||||
@ -654,7 +654,7 @@ typedef struct png_unknown_chunk_t
|
||||
{
|
||||
png_byte name[5]; /* Textual chunk name with '\0' terminator */
|
||||
png_byte *data; /* Data, should not be modified on read! */
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
/* On write 'location' must be set using the flag values listed below.
|
||||
* Notice that on read it is set by libpng however the values stored have
|
||||
@ -679,7 +679,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
||||
/* Maximum positive integer used in PNG is (2^31)-1 */
|
||||
#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
|
||||
#define PNG_UINT_32_MAX ((png_uint_32)(-1))
|
||||
#define PNG_SIZE_MAX ((png_size_t)(-1))
|
||||
#define PNG_SIZE_MAX ((size_t)(-1))
|
||||
|
||||
/* These are constants for fixed point values encoded in the
|
||||
* PNG specification manner (x100000)
|
||||
@ -785,7 +785,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
||||
typedef struct png_row_info_struct
|
||||
{
|
||||
png_uint_32 width; /* width of row */
|
||||
png_size_t rowbytes; /* number of bytes in row */
|
||||
size_t rowbytes; /* number of bytes in row */
|
||||
png_byte color_type; /* color type of row */
|
||||
png_byte bit_depth; /* bit depth of row */
|
||||
png_byte channels; /* number of channels (1, 2, 3, or 4) */
|
||||
@ -804,7 +804,7 @@ typedef png_row_info * * png_row_infopp;
|
||||
* expected to return the read data in the buffer.
|
||||
*/
|
||||
typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp));
|
||||
typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t));
|
||||
typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, size_t));
|
||||
typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp));
|
||||
typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
|
||||
int));
|
||||
@ -941,8 +941,8 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
|
||||
* signature, and non-zero otherwise. Having num_to_check == 0 or
|
||||
* start > 7 will always fail (ie return non-zero).
|
||||
*/
|
||||
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start,
|
||||
png_size_t num_to_check));
|
||||
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
|
||||
size_t num_to_check));
|
||||
|
||||
/* Simple signature checking function. This is the same as calling
|
||||
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
|
||||
@ -961,11 +961,11 @@ PNG_EXPORTA(5, png_structp, png_create_write_struct,
|
||||
png_error_ptr warn_fn),
|
||||
PNG_ALLOCATED);
|
||||
|
||||
PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size,
|
||||
PNG_EXPORT(6, size_t, png_get_compression_buffer_size,
|
||||
(png_const_structrp png_ptr));
|
||||
|
||||
PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr,
|
||||
png_size_t size));
|
||||
size_t size));
|
||||
|
||||
/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
|
||||
* match up.
|
||||
@ -1018,7 +1018,7 @@ PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr));
|
||||
|
||||
/* Write a PNG chunk - size, type, (optional) data, CRC. */
|
||||
PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep
|
||||
chunk_name, png_const_bytep data, png_size_t length));
|
||||
chunk_name, png_const_bytep data, size_t length));
|
||||
|
||||
/* Write the start of a PNG chunk - length and chunk name. */
|
||||
PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
|
||||
@ -1026,7 +1026,7 @@ PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
|
||||
|
||||
/* Write the data of a PNG chunk started with png_write_chunk_start(). */
|
||||
PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr,
|
||||
png_const_bytep data, png_size_t length));
|
||||
png_const_bytep data, size_t length));
|
||||
|
||||
/* Finish a chunk started with png_write_chunk_start() (includes CRC). */
|
||||
PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr));
|
||||
@ -1040,7 +1040,7 @@ PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr),
|
||||
* the API will be removed in the future.
|
||||
*/
|
||||
PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr,
|
||||
png_size_t png_info_struct_size), PNG_DEPRECATED);
|
||||
size_t png_info_struct_size), PNG_DEPRECATED);
|
||||
|
||||
/* Writes all the PNG information before the image. */
|
||||
PNG_EXPORT(20, void, png_write_info_before_PLTE,
|
||||
@ -1716,7 +1716,7 @@ PNG_EXPORT(91, png_voidp, png_get_progressive_ptr,
|
||||
|
||||
/* Function to be called when data becomes available */
|
||||
PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size));
|
||||
png_inforp info_ptr, png_bytep buffer, size_t buffer_size));
|
||||
|
||||
/* A function which may be called *only* within png_process_data to stop the
|
||||
* processing of any more data. The function returns the number of bytes
|
||||
@ -1725,7 +1725,7 @@ PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
|
||||
* 'save' is set to true the routine will first save all the pending data and
|
||||
* will always return 0.
|
||||
*/
|
||||
PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
|
||||
PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save));
|
||||
|
||||
/* A function which may be called *only* outside (after) a call to
|
||||
* png_process_data. It returns the number of bytes of data to skip in the
|
||||
@ -1870,7 +1870,7 @@ PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr, png_uint_32 flag));
|
||||
|
||||
/* Returns number of bytes needed to hold a transformed row. */
|
||||
PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structrp png_ptr,
|
||||
PNG_EXPORT(111, size_t, png_get_rowbytes, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr));
|
||||
|
||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||
@ -3020,7 +3020,7 @@ PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
|
||||
#endif /* STDIO */
|
||||
|
||||
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
|
||||
png_const_voidp memory, png_size_t size));
|
||||
png_const_voidp memory, size_t size));
|
||||
/* The PNG header is read from the given memory buffer. */
|
||||
|
||||
PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
|
||||
|
23
pngconf.h
23
pngconf.h
@ -515,8 +515,10 @@
|
||||
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
||||
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
|
||||
/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
|
||||
* From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant
|
||||
* behavior of sizeof and ptrdiff_t are required.
|
||||
* The legacy typedefs are provided here for backwards compatibility.
|
||||
*/
|
||||
typedef size_t png_size_t;
|
||||
typedef ptrdiff_t png_ptrdiff_t;
|
||||
@ -537,13 +539,12 @@ typedef ptrdiff_t png_ptrdiff_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
|
||||
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
|
||||
* png_alloc_size_t are not necessary; in fact, it is recommended not to use
|
||||
* them at all so that the compiler can complain when something turns out to be
|
||||
* problematic.
|
||||
/* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
|
||||
* than png_uint_32. Casts from size_t or png_uint_32 to png_alloc_size_t are
|
||||
* not necessary; in fact, it is recommended not to use them at all, so that
|
||||
* the compiler can complain when something turns out to be problematic.
|
||||
*
|
||||
* Casts in the other direction (from png_alloc_size_t to png_size_t or
|
||||
* Casts in the other direction (from png_alloc_size_t to size_t or
|
||||
* png_uint_32) should be explicitly applied; however, we do not expect to
|
||||
* encounter practical situations that require such conversions.
|
||||
*
|
||||
@ -553,7 +554,7 @@ typedef ptrdiff_t png_ptrdiff_t;
|
||||
#ifdef PNG_SMALL_SIZE_T
|
||||
typedef png_uint_32 png_alloc_size_t;
|
||||
#else
|
||||
typedef png_size_t png_alloc_size_t;
|
||||
typedef size_t png_alloc_size_t;
|
||||
#endif
|
||||
|
||||
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
|
||||
@ -589,8 +590,8 @@ typedef char * png_charp;
|
||||
typedef const char * png_const_charp;
|
||||
typedef png_fixed_point * png_fixed_point_p;
|
||||
typedef const png_fixed_point * png_const_fixed_point_p;
|
||||
typedef png_size_t * png_size_tp;
|
||||
typedef const png_size_t * png_const_size_tp;
|
||||
typedef size_t * png_size_tp;
|
||||
typedef const size_t * png_const_size_tp;
|
||||
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
typedef FILE * png_FILE_p;
|
||||
|
4
pngget.c
4
pngget.c
@ -26,7 +26,7 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||
return(0);
|
||||
}
|
||||
|
||||
png_size_t PNGAPI
|
||||
size_t PNGAPI
|
||||
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
@ -1165,7 +1165,7 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
png_size_t PNGAPI
|
||||
size_t PNGAPI
|
||||
png_get_compression_buffer_size(png_const_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
|
@ -55,10 +55,10 @@
|
||||
struct png_info_def
|
||||
{
|
||||
/* The following are necessary for every PNG file */
|
||||
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
|
||||
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||
size_t rowbytes; /* bytes needed to hold an untransformed row */
|
||||
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
|
||||
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
|
||||
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
|
||||
|
34
pngpread.c
34
pngpread.c
@ -34,7 +34,7 @@ if (png_ptr->buffer_size < N) \
|
||||
|
||||
void PNGAPI
|
||||
png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_bytep buffer, png_size_t buffer_size)
|
||||
png_bytep buffer, size_t buffer_size)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
@ -47,7 +47,7 @@ png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
png_size_t PNGAPI
|
||||
size_t PNGAPI
|
||||
png_process_data_pause(png_structrp png_ptr, int save)
|
||||
{
|
||||
if (png_ptr != NULL)
|
||||
@ -60,7 +60,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
|
||||
else
|
||||
{
|
||||
/* This includes any pending saved bytes: */
|
||||
png_size_t remaining = png_ptr->buffer_size;
|
||||
size_t remaining = png_ptr->buffer_size;
|
||||
png_ptr->buffer_size = 0;
|
||||
|
||||
/* So subtract the saved buffer size, unless all the data
|
||||
@ -133,8 +133,8 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
||||
void /* PRIVATE */
|
||||
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||
num_to_check = 8 - num_checked;
|
||||
size_t num_checked = png_ptr->sig_bytes; /* SAFE, does not exceed 8 */
|
||||
size_t num_to_check = 8 - num_checked;
|
||||
|
||||
if (png_ptr->buffer_size < num_to_check)
|
||||
{
|
||||
@ -418,7 +418,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||
}
|
||||
|
||||
void PNGCBAPI
|
||||
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, size_t length)
|
||||
{
|
||||
png_bytep ptr;
|
||||
|
||||
@ -428,7 +428,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
ptr = buffer;
|
||||
if (png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size;
|
||||
size_t save_size;
|
||||
|
||||
if (length < png_ptr->save_buffer_size)
|
||||
save_size = length;
|
||||
@ -445,7 +445,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
}
|
||||
if (length != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size;
|
||||
size_t save_size;
|
||||
|
||||
if (length < png_ptr->current_buffer_size)
|
||||
save_size = length;
|
||||
@ -467,7 +467,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||
{
|
||||
png_size_t i, istop;
|
||||
size_t i, istop;
|
||||
png_bytep sp;
|
||||
png_bytep dp;
|
||||
|
||||
@ -482,7 +482,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
|
||||
png_ptr->save_buffer_max)
|
||||
{
|
||||
png_size_t new_max;
|
||||
size_t new_max;
|
||||
png_bytep old_buffer;
|
||||
|
||||
if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
|
||||
@ -494,7 +494,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
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);
|
||||
(size_t)new_max);
|
||||
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
@ -522,7 +522,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
|
||||
png_size_t buffer_length)
|
||||
size_t buffer_length)
|
||||
{
|
||||
png_ptr->current_buffer = buffer;
|
||||
png_ptr->current_buffer_size = buffer_length;
|
||||
@ -562,7 +562,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
|
||||
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->save_buffer_size;
|
||||
size_t save_size = png_ptr->save_buffer_size;
|
||||
png_uint_32 idat_size = png_ptr->idat_size;
|
||||
|
||||
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
|
||||
@ -572,7 +572,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
* will break on either 16-bit or 64-bit platforms.
|
||||
*/
|
||||
if (idat_size < save_size)
|
||||
save_size = (png_size_t)idat_size;
|
||||
save_size = (size_t)idat_size;
|
||||
|
||||
else
|
||||
idat_size = (png_uint_32)save_size;
|
||||
@ -589,7 +589,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
|
||||
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->current_buffer_size;
|
||||
size_t save_size = png_ptr->current_buffer_size;
|
||||
png_uint_32 idat_size = png_ptr->idat_size;
|
||||
|
||||
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
|
||||
@ -598,7 +598,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
* larger - this cannot overflow.
|
||||
*/
|
||||
if (idat_size < save_size)
|
||||
save_size = (png_size_t)idat_size;
|
||||
save_size = (size_t)idat_size;
|
||||
|
||||
else
|
||||
idat_size = (png_uint_32)save_size;
|
||||
@ -625,7 +625,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
|
||||
void /* PRIVATE */
|
||||
png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
|
||||
png_size_t buffer_length)
|
||||
size_t buffer_length)
|
||||
{
|
||||
/* The caller checks for a non-zero buffer length. */
|
||||
if (!(buffer_length > 0) || buffer == NULL)
|
||||
|
32
pngpriv.h
32
pngpriv.h
@ -734,8 +734,8 @@
|
||||
/* Added to libpng-1.2.6 JB */
|
||||
#define PNG_ROWBYTES(pixel_bits, width) \
|
||||
((pixel_bits) >= 8 ? \
|
||||
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
|
||||
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
|
||||
((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
|
||||
(( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
|
||||
|
||||
/* This returns the number of trailing bits in the last byte of a row, 0 if the
|
||||
* last byte is completely full of pixels. It is, in principle, (pixel_bits x
|
||||
@ -1052,15 +1052,15 @@ PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
|
||||
*/
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length),PNG_EMPTY);
|
||||
png_bytep data, size_t length),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr,
|
||||
png_bytep buffer, png_size_t length),PNG_EMPTY);
|
||||
png_bytep buffer, size_t length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length),PNG_EMPTY);
|
||||
png_bytep data, size_t length),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
# ifdef PNG_STDIO_SUPPORTED
|
||||
@ -1074,7 +1074,7 @@ PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
|
||||
|
||||
/* Write the "data" buffer to whatever output you are using */
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr,
|
||||
png_const_bytep data, png_size_t length),PNG_EMPTY);
|
||||
png_const_bytep data, size_t length),PNG_EMPTY);
|
||||
|
||||
/* Read and check the PNG file signature */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr,
|
||||
@ -1086,7 +1086,7 @@ PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
|
||||
|
||||
/* Read data from whatever input you are using into the "data" buffer */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data,
|
||||
png_size_t length),PNG_EMPTY);
|
||||
size_t length),PNG_EMPTY);
|
||||
|
||||
/* Read bytes into buf, and update png_ptr->crc */
|
||||
PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
|
||||
@ -1104,7 +1104,7 @@ PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
|
||||
* since this is the maximum buffer size we can specify.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr,
|
||||
png_const_bytep ptr, png_size_t length),PNG_EMPTY);
|
||||
png_const_bytep ptr, size_t length),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
|
||||
@ -1187,7 +1187,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
|
||||
/* Chunks that have keywords */
|
||||
#ifdef PNG_WRITE_tEXt_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
|
||||
png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY);
|
||||
png_const_charp key, png_const_charp text, size_t text_len),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_zTXt_SUPPORTED
|
||||
@ -1580,10 +1580,10 @@ PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
|
||||
png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
|
||||
png_bytep buffer, size_t buffer_length),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
|
||||
png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
|
||||
png_bytep buffer, size_t buffer_length),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr,
|
||||
@ -1853,13 +1853,13 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
|
||||
png_charp ascii, png_size_t size, double fp, unsigned int precision),
|
||||
png_charp ascii, size_t size, double fp, unsigned int precision),
|
||||
PNG_EMPTY);
|
||||
#endif /* FLOATING_POINT */
|
||||
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
|
||||
png_charp ascii, png_size_t size, png_fixed_point fp),PNG_EMPTY);
|
||||
png_charp ascii, size_t size, png_fixed_point fp),PNG_EMPTY);
|
||||
#endif /* FIXED_POINT */
|
||||
#endif /* sCAL */
|
||||
|
||||
@ -1952,7 +1952,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
|
||||
* the problem character.) This has not been tested within libpng.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
|
||||
png_size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
|
||||
size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
|
||||
|
||||
/* This is the same but it checks a complete string and returns true
|
||||
* only if it just contains a floating point number. As of 1.5.4 this
|
||||
@ -1961,7 +1961,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
|
||||
* for negative or zero values using the sticky flag.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
|
||||
png_size_t size),PNG_EMPTY);
|
||||
size_t size),PNG_EMPTY);
|
||||
#endif /* pCAL || sCAL */
|
||||
|
||||
#if defined(PNG_GAMMA_SUPPORTED) ||\
|
||||
@ -2036,7 +2036,7 @@ typedef struct png_control
|
||||
png_voidp error_buf; /* Always a jmp_buf at present. */
|
||||
|
||||
png_const_bytep memory; /* Memory buffer. */
|
||||
png_size_t size; /* Size of the memory buffer. */
|
||||
size_t size; /* Size of the memory buffer. */
|
||||
|
||||
unsigned int for_write :1; /* Otherwise it is a read structure */
|
||||
unsigned int owned_file :1; /* We own the file in io_ptr */
|
||||
|
@ -1532,7 +1532,7 @@ png_image_begin_read_from_file(png_imagep image, const char *file_name)
|
||||
#endif /* STDIO */
|
||||
|
||||
static void PNGCBAPI
|
||||
png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
|
||||
png_image_memory_read(png_structp png_ptr, png_bytep out, size_t need)
|
||||
{
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
@ -1543,7 +1543,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
|
||||
if (cp != NULL)
|
||||
{
|
||||
png_const_bytep memory = cp->memory;
|
||||
png_size_t size = cp->size;
|
||||
size_t size = cp->size;
|
||||
|
||||
if (memory != NULL && size >= need)
|
||||
{
|
||||
@ -1562,7 +1562,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
|
||||
}
|
||||
|
||||
int PNGAPI png_image_begin_read_from_memory(png_imagep image,
|
||||
png_const_voidp memory, png_size_t size)
|
||||
png_const_voidp memory, size_t size)
|
||||
{
|
||||
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
||||
{
|
||||
|
8
pngrio.c
8
pngrio.c
@ -29,7 +29,7 @@
|
||||
* to read more than 64K on a 16-bit machine.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
png_read_data(png_structrp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_debug1(4, "reading %d bytes", (int)length);
|
||||
|
||||
@ -47,14 +47,14 @@ png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
* than changing the library.
|
||||
*/
|
||||
void PNGCBAPI
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
|
||||
|
106
pngrtran.c
106
pngrtran.c
@ -747,7 +747,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
int num_red = (1 << PNG_QUANTIZE_RED_BITS);
|
||||
int num_green = (1 << PNG_QUANTIZE_GREEN_BITS);
|
||||
int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
|
||||
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
||||
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))));
|
||||
@ -2151,8 +2151,8 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 3);
|
||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||
png_bytep sp = row + (size_t)((row_width - 1) >> 3);
|
||||
png_bytep dp = row + (size_t)row_width - 1;
|
||||
png_uint_32 shift = 7U - ((row_width + 7U) & 0x07);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -2175,8 +2175,8 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
case 2:
|
||||
{
|
||||
|
||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 2);
|
||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||
png_bytep sp = row + (size_t)((row_width - 1) >> 2);
|
||||
png_bytep dp = row + (size_t)row_width - 1;
|
||||
png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -2198,8 +2198,8 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
|
||||
|
||||
case 4:
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_width - 1) >> 1);
|
||||
png_bytep dp = row + (png_size_t)row_width - 1;
|
||||
png_bytep sp = row + (size_t)((row_width - 1) >> 1);
|
||||
png_bytep dp = row + (size_t)row_width - 1;
|
||||
png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -2680,8 +2680,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
|
||||
{
|
||||
/* This changes the data from G to GX */
|
||||
png_bytep sp = row + (png_size_t)row_width;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
png_bytep sp = row + (size_t)row_width;
|
||||
png_bytep dp = sp + (size_t)row_width;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = lo_filler;
|
||||
@ -2696,8 +2696,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
else
|
||||
{
|
||||
/* This changes the data from G to XG */
|
||||
png_bytep sp = row + (png_size_t)row_width;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
png_bytep sp = row + (size_t)row_width;
|
||||
png_bytep dp = sp + (size_t)row_width;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = *(--sp);
|
||||
@ -2715,8 +2715,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
|
||||
{
|
||||
/* This changes the data from GG to GGXX */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
png_bytep sp = row + (size_t)row_width * 2;
|
||||
png_bytep dp = sp + (size_t)row_width * 2;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = lo_filler;
|
||||
@ -2734,8 +2734,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
else
|
||||
{
|
||||
/* This changes the data from GG to XXGG */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
png_bytep sp = row + (size_t)row_width * 2;
|
||||
png_bytep dp = sp + (size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = *(--sp);
|
||||
@ -2757,8 +2757,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
|
||||
{
|
||||
/* This changes the data from RGB to RGBX */
|
||||
png_bytep sp = row + (png_size_t)row_width * 3;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
png_bytep sp = row + (size_t)row_width * 3;
|
||||
png_bytep dp = sp + (size_t)row_width;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = lo_filler;
|
||||
@ -2775,8 +2775,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
else
|
||||
{
|
||||
/* This changes the data from RGB to XRGB */
|
||||
png_bytep sp = row + (png_size_t)row_width * 3;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
png_bytep sp = row + (size_t)row_width * 3;
|
||||
png_bytep dp = sp + (size_t)row_width;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = *(--sp);
|
||||
@ -2796,8 +2796,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
|
||||
{
|
||||
/* This changes the data from RRGGBB to RRGGBBXX */
|
||||
png_bytep sp = row + (png_size_t)row_width * 6;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
png_bytep sp = row + (size_t)row_width * 6;
|
||||
png_bytep dp = sp + (size_t)row_width * 2;
|
||||
for (i = 1; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = lo_filler;
|
||||
@ -2819,8 +2819,8 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
else
|
||||
{
|
||||
/* This changes the data from RRGGBB to XXRRGGBB */
|
||||
png_bytep sp = row + (png_size_t)row_width * 6;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
png_bytep sp = row + (size_t)row_width * 6;
|
||||
png_bytep dp = sp + (size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(--dp) = *(--sp);
|
||||
@ -2861,8 +2861,8 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This changes G to RGB */
|
||||
png_bytep sp = row + (png_size_t)row_width - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
png_bytep sp = row + (size_t)row_width - 1;
|
||||
png_bytep dp = sp + (size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(dp--) = *sp;
|
||||
@ -2874,8 +2874,8 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
else
|
||||
{
|
||||
/* This changes GG to RRGGBB */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2 - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 4;
|
||||
png_bytep sp = row + (size_t)row_width * 2 - 1;
|
||||
png_bytep dp = sp + (size_t)row_width * 4;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(dp--) = *sp;
|
||||
@ -2893,8 +2893,8 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This changes GA to RGBA */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2 - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
png_bytep sp = row + (size_t)row_width * 2 - 1;
|
||||
png_bytep dp = sp + (size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(dp--) = *(sp--);
|
||||
@ -2907,8 +2907,8 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
else
|
||||
{
|
||||
/* This changes GGAA to RRGGBBAA */
|
||||
png_bytep sp = row + (png_size_t)row_width * 4 - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 4;
|
||||
png_bytep sp = row + (size_t)row_width * 4 - 1;
|
||||
png_bytep dp = sp + (size_t)row_width * 4;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
*(dp--) = *(sp--);
|
||||
@ -4217,8 +4217,8 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sp = row + (png_size_t)((row_width - 1) >> 3);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
sp = row + (size_t)((row_width - 1) >> 3);
|
||||
dp = row + (size_t)row_width - 1;
|
||||
shift = 7 - (int)((row_width + 7) & 0x07);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4244,8 +4244,8 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
|
||||
case 2:
|
||||
{
|
||||
sp = row + (png_size_t)((row_width - 1) >> 2);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
sp = row + (size_t)((row_width - 1) >> 2);
|
||||
dp = row + (size_t)row_width - 1;
|
||||
shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4267,8 +4267,8 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
|
||||
case 4:
|
||||
{
|
||||
sp = row + (png_size_t)((row_width - 1) >> 1);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
sp = row + (size_t)((row_width - 1) >> 1);
|
||||
dp = row + (size_t)row_width - 1;
|
||||
shift = (int)((row_width & 0x01) << 2);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4301,8 +4301,8 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
{
|
||||
if (num_trans > 0)
|
||||
{
|
||||
sp = row + (png_size_t)row_width - 1;
|
||||
dp = row + ((png_size_t)row_width << 2) - 1;
|
||||
sp = row + (size_t)row_width - 1;
|
||||
dp = row + ((size_t)row_width << 2) - 1;
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4326,8 +4326,8 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
|
||||
|
||||
else
|
||||
{
|
||||
sp = row + (png_size_t)row_width - 1;
|
||||
dp = row + (png_size_t)(row_width * 3) - 1;
|
||||
sp = row + (size_t)row_width - 1;
|
||||
dp = row + (size_t)(row_width * 3) - 1;
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4373,8 +4373,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
case 1:
|
||||
{
|
||||
gray = (gray & 0x01) * 0xff;
|
||||
sp = row + (png_size_t)((row_width - 1) >> 3);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
sp = row + (size_t)((row_width - 1) >> 3);
|
||||
dp = row + (size_t)row_width - 1;
|
||||
shift = 7 - (int)((row_width + 7) & 0x07);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4401,8 +4401,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
case 2:
|
||||
{
|
||||
gray = (gray & 0x03) * 0x55;
|
||||
sp = row + (png_size_t)((row_width - 1) >> 2);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
sp = row + (size_t)((row_width - 1) >> 2);
|
||||
dp = row + (size_t)row_width - 1;
|
||||
shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4426,8 +4426,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
case 4:
|
||||
{
|
||||
gray = (gray & 0x0f) * 0x11;
|
||||
sp = row + (png_size_t)((row_width - 1) >> 1);
|
||||
dp = row + (png_size_t)row_width - 1;
|
||||
sp = row + (size_t)((row_width - 1) >> 1);
|
||||
dp = row + (size_t)row_width - 1;
|
||||
shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4461,8 +4461,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
gray = gray & 0xff;
|
||||
sp = row + (png_size_t)row_width - 1;
|
||||
dp = row + ((png_size_t)row_width << 1) - 1;
|
||||
sp = row + (size_t)row_width - 1;
|
||||
dp = row + ((size_t)row_width << 1) - 1;
|
||||
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
@ -4517,8 +4517,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
png_byte red = (png_byte)(trans_color->red & 0xff);
|
||||
png_byte green = (png_byte)(trans_color->green & 0xff);
|
||||
png_byte blue = (png_byte)(trans_color->blue & 0xff);
|
||||
sp = row + (png_size_t)row_info->rowbytes - 1;
|
||||
dp = row + ((png_size_t)row_width << 2) - 1;
|
||||
sp = row + (size_t)row_info->rowbytes - 1;
|
||||
dp = row + ((size_t)row_width << 2) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
|
||||
@ -4541,7 +4541,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
png_byte green_low = (png_byte)(trans_color->green & 0xff);
|
||||
png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
|
||||
sp = row + row_info->rowbytes - 1;
|
||||
dp = row + ((png_size_t)row_width << 3) - 1;
|
||||
dp = row + ((size_t)row_width << 3) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (*(sp - 5) == red_high &&
|
||||
@ -4979,7 +4979,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
|
38
pngrutil.c
38
pngrutil.c
@ -120,7 +120,7 @@ png_get_uint_16)(png_const_bytep buf)
|
||||
void /* PRIVATE */
|
||||
png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked, num_to_check;
|
||||
size_t num_checked, num_to_check;
|
||||
|
||||
/* Exit if the user application does not expect a signature. */
|
||||
if (png_ptr->sig_bytes >= 8)
|
||||
@ -1648,7 +1648,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
int entry_size, i;
|
||||
png_uint_32 skip = 0;
|
||||
png_uint_32 dl;
|
||||
png_size_t max_dl;
|
||||
size_t max_dl;
|
||||
|
||||
png_debug(1, "in png_handle_sPLT");
|
||||
|
||||
@ -2377,7 +2377,7 @@ void /* PRIVATE */
|
||||
png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_bytep buffer;
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
int state;
|
||||
|
||||
png_debug(1, "in png_handle_sCAL");
|
||||
@ -2447,7 +2447,7 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
else
|
||||
{
|
||||
png_size_t heighti = i;
|
||||
size_t heighti = i;
|
||||
|
||||
state = 0;
|
||||
if (png_check_fp_number((png_const_charp)buffer, length,
|
||||
@ -2885,7 +2885,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
|
||||
{
|
||||
PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name);
|
||||
/* The following is safe because of the PNG_SIZE_MAX init above */
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
|
||||
png_ptr->unknown_chunk.size = (size_t)length/*SAFE*/;
|
||||
/* 'mode' is a flag array, only the bottom four bits matter here */
|
||||
png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/;
|
||||
|
||||
@ -3697,8 +3697,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
|
||||
png_bytep sp = row + (size_t)((row_info->width - 1) >> 3);
|
||||
png_bytep dp = row + (size_t)((final_width - 1) >> 3);
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
@ -3824,8 +3824,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
|
||||
case 4:
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
|
||||
png_bytep sp = row + (size_t)((row_info->width - 1) >> 1);
|
||||
png_bytep dp = row + (size_t)((final_width - 1) >> 1);
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
@ -3887,12 +3887,12 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
|
||||
default:
|
||||
{
|
||||
png_size_t pixel_bytes = (row_info->pixel_depth >> 3);
|
||||
size_t pixel_bytes = (row_info->pixel_depth >> 3);
|
||||
|
||||
png_bytep sp = row + (png_size_t)(row_info->width - 1)
|
||||
png_bytep sp = row + (size_t)(row_info->width - 1)
|
||||
* pixel_bytes;
|
||||
|
||||
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
||||
png_bytep dp = row + (size_t)(final_width - 1) * pixel_bytes;
|
||||
|
||||
int jstop = (int)png_pass_inc[pass];
|
||||
png_uint_32 i;
|
||||
@ -3929,8 +3929,8 @@ static void
|
||||
png_read_filter_row_sub(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
png_bytep rp = row + bpp;
|
||||
|
||||
@ -3947,8 +3947,8 @@ static void
|
||||
png_read_filter_row_up(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
@ -3963,11 +3963,11 @@ static void
|
||||
png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
png_size_t istop = row_info->rowbytes - bpp;
|
||||
size_t istop = row_info->rowbytes - bpp;
|
||||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
@ -4403,7 +4403,7 @@ png_read_start_row(png_structrp png_ptr)
|
||||
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
unsigned int max_pixel_depth;
|
||||
png_size_t row_bytes;
|
||||
size_t row_bytes;
|
||||
|
||||
png_debug(1, "in png_read_start_row");
|
||||
|
||||
|
14
pngset.c
14
pngset.c
@ -313,7 +313,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
|
||||
int nparams, png_const_charp units, png_charpp params)
|
||||
{
|
||||
png_size_t length;
|
||||
size_t length;
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function", "pCAL");
|
||||
@ -390,7 +390,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
memcpy(info_ptr->pcal_units, units, length);
|
||||
|
||||
info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
|
||||
(png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
|
||||
(size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
|
||||
|
||||
if (info_ptr->pcal_params == NULL)
|
||||
{
|
||||
@ -430,7 +430,7 @@ void PNGAPI
|
||||
png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
int unit, png_const_charp swidth, png_const_charp sheight)
|
||||
{
|
||||
png_size_t lengthw = 0, lengthh = 0;
|
||||
size_t lengthw = 0, lengthh = 0;
|
||||
|
||||
png_debug1(1, "in %s storage function", "sCAL");
|
||||
|
||||
@ -691,7 +691,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
{
|
||||
png_charp new_iccp_name;
|
||||
png_bytep new_iccp_profile;
|
||||
png_size_t length;
|
||||
size_t length;
|
||||
|
||||
png_debug1(1, "in %s storage function", "iCCP");
|
||||
|
||||
@ -1018,7 +1018,7 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
|
||||
info_ptr->trans_alpha = png_voidcast(png_bytep,
|
||||
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
||||
memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
|
||||
memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
|
||||
}
|
||||
png_ptr->trans_alpha = info_ptr->trans_alpha;
|
||||
}
|
||||
@ -1098,7 +1098,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||
|
||||
do
|
||||
{
|
||||
png_size_t length;
|
||||
size_t length;
|
||||
|
||||
/* Skip invalid input entries */
|
||||
if (entries->name == NULL || entries->entries == NULL)
|
||||
@ -1563,7 +1563,7 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
||||
png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
16
pngstruct.h
16
pngstruct.h
@ -47,7 +47,7 @@
|
||||
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
|
||||
* can handle at once. This type need be no larger than 16 bits (so maximum of
|
||||
* 65535), this define allows us to discover how big it is, but limited by the
|
||||
* maximuum for png_size_t. The value can be overridden in a library build
|
||||
* maximum for size_t. The value can be overridden in a library build
|
||||
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
|
||||
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
|
||||
* and may even improve performance on some systems (and degrade it on others.)
|
||||
@ -214,7 +214,7 @@ struct png_struct_def
|
||||
png_uint_32 height; /* height of image in pixels */
|
||||
png_uint_32 num_rows; /* number of rows in current pass */
|
||||
png_uint_32 usr_width; /* width of row at start of write */
|
||||
png_size_t rowbytes; /* size of row in bytes */
|
||||
size_t rowbytes; /* size of row in bytes */
|
||||
png_uint_32 iwidth; /* width of current interlaced row in pixels */
|
||||
png_uint_32 row_number; /* current row in interlace pass */
|
||||
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
|
||||
@ -232,7 +232,7 @@ struct png_struct_def
|
||||
png_bytep try_row; /* buffer to save trial row when filtering */
|
||||
png_bytep tst_row; /* buffer to save best trial row when filtering */
|
||||
#endif
|
||||
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||
size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||
|
||||
png_uint_32 idat_size; /* current IDAT size for read */
|
||||
png_uint_32 crc; /* current chunk CRC value */
|
||||
@ -328,10 +328,10 @@ struct png_struct_def
|
||||
png_bytep current_buffer; /* buffer for recently used data */
|
||||
png_uint_32 push_length; /* size of current input chunk */
|
||||
png_uint_32 skip_length; /* bytes to skip in input data */
|
||||
png_size_t save_buffer_size; /* amount of data now in save_buffer */
|
||||
png_size_t save_buffer_max; /* total size of save_buffer */
|
||||
png_size_t buffer_size; /* total amount of available input data */
|
||||
png_size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||
size_t save_buffer_size; /* amount of data now in save_buffer */
|
||||
size_t save_buffer_max; /* total size of save_buffer */
|
||||
size_t buffer_size; /* total amount of available input data */
|
||||
size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||
int process_mode; /* what push library is currently doing */
|
||||
int cur_palette; /* current push library palette index */
|
||||
|
||||
@ -451,7 +451,7 @@ struct png_struct_def
|
||||
#endif
|
||||
|
||||
/* New member added in libpng-1.2.26 */
|
||||
png_size_t old_big_row_buf_size;
|
||||
size_t old_big_row_buf_size;
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* New member added in libpng-1.2.30 */
|
||||
|
18
pngtest.c
18
pngtest.c
@ -345,10 +345,10 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
||||
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
void
|
||||
pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
pngtest_check_io_state(png_structp png_ptr, size_t data_length,
|
||||
png_uint_32 io_op);
|
||||
void
|
||||
pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
pngtest_check_io_state(png_structp png_ptr, size_t data_length,
|
||||
png_uint_32 io_op)
|
||||
{
|
||||
png_uint_32 io_state = png_get_io_state(png_ptr);
|
||||
@ -386,12 +386,12 @@ pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
#endif
|
||||
|
||||
static void PNGCBAPI
|
||||
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
pngtest_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check = 0;
|
||||
size_t check = 0;
|
||||
png_voidp io_ptr;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
io_ptr = png_get_io_ptr(png_ptr);
|
||||
@ -425,9 +425,9 @@ pngtest_flush(png_structp png_ptr)
|
||||
* than changing the library.
|
||||
*/
|
||||
static void PNGCBAPI
|
||||
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
pngtest_write_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
check = fwrite(data, 1, length, (png_FILE_p)png_get_io_ptr(png_ptr));
|
||||
|
||||
@ -705,7 +705,7 @@ read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk)
|
||||
* The unknown chunk structure contains the chunk data:
|
||||
* png_byte name[5];
|
||||
* png_byte *data;
|
||||
* png_size_t size;
|
||||
* size_t size;
|
||||
*
|
||||
* Note that libpng has already taken care of the CRC handling.
|
||||
*/
|
||||
@ -1726,7 +1726,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
for (;;)
|
||||
{
|
||||
static int wrote_question = 0;
|
||||
png_size_t num_in, num_out;
|
||||
size_t num_in, num_out;
|
||||
char inbuf[256], outbuf[256];
|
||||
|
||||
num_in = fread(inbuf, 1, sizeof inbuf, fpin);
|
||||
|
14
pngtrans.c
14
pngtrans.c
@ -269,8 +269,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
|
||||
for (i = 0; i < istop; i++)
|
||||
{
|
||||
@ -283,8 +283,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
row_info->bit_depth == 8)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
|
||||
for (i = 0; i < istop; i += 2)
|
||||
{
|
||||
@ -298,8 +298,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
|
||||
row_info->bit_depth == 16)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
|
||||
for (i = 0; i < istop; i += 4)
|
||||
{
|
||||
@ -609,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
return; /* The filler channel has gone already */
|
||||
|
||||
/* Fix the rowbytes value. */
|
||||
row_info->rowbytes = (png_size_t)(dp-row);
|
||||
row_info->rowbytes = (size_t)(dp-row);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
6
pngwio.c
6
pngwio.c
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
void /* PRIVATE */
|
||||
png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
|
||||
png_write_data(png_structrp png_ptr, png_const_bytep data, size_t length)
|
||||
{
|
||||
/* NOTE: write_data_fn must not change the buffer! */
|
||||
if (png_ptr->write_data_fn != NULL )
|
||||
@ -48,9 +48,9 @@ png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
|
||||
* than changing the library.
|
||||
*/
|
||||
void PNGCBAPI
|
||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_default_write_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
@ -2162,8 +2162,7 @@ png_image_write_main(png_voidp argument)
|
||||
|
||||
|
||||
static void (PNGCBAPI
|
||||
image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
|
||||
png_size_t size)
|
||||
image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data, size_t size)
|
||||
{
|
||||
png_image_write_control *display = png_voidcast(png_image_write_control*,
|
||||
png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
|
||||
|
@ -212,9 +212,9 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
||||
if (row_info->bit_depth < 8)
|
||||
{
|
||||
png_bytep bp = row;
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
unsigned int mask;
|
||||
png_size_t row_bytes = row_info->rowbytes;
|
||||
size_t row_bytes = row_info->rowbytes;
|
||||
|
||||
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
||||
mask = 0x55;
|
||||
@ -514,7 +514,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
|
157
pngwutil.c
157
pngwutil.c
@ -59,7 +59,7 @@ png_write_sig(png_structrp png_ptr)
|
||||
|
||||
/* Write the rest of the 8 byte signature */
|
||||
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
|
||||
(png_size_t)(8 - png_ptr->sig_bytes));
|
||||
(size_t)(8 - png_ptr->sig_bytes));
|
||||
|
||||
if (png_ptr->sig_bytes < 3)
|
||||
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
||||
@ -124,8 +124,7 @@ png_write_chunk_start(png_structrp png_ptr, png_const_bytep chunk_string,
|
||||
* given to png_write_chunk_header().
|
||||
*/
|
||||
void PNGAPI
|
||||
png_write_chunk_data(png_structrp png_ptr, png_const_bytep data,
|
||||
png_size_t length)
|
||||
png_write_chunk_data(png_structrp png_ptr, png_const_bytep data, size_t length)
|
||||
{
|
||||
/* Write the data, and run the CRC over it */
|
||||
if (png_ptr == NULL)
|
||||
@ -160,7 +159,7 @@ png_write_chunk_end(png_structrp png_ptr)
|
||||
/* Write the crc in a single operation */
|
||||
png_save_uint_32(buf, png_ptr->crc);
|
||||
|
||||
png_write_data(png_ptr, buf, (png_size_t)4);
|
||||
png_write_data(png_ptr, buf, 4);
|
||||
}
|
||||
|
||||
/* Write a PNG chunk all at once. The type is an array of ASCII characters
|
||||
@ -174,7 +173,7 @@ png_write_chunk_end(png_structrp png_ptr)
|
||||
*/
|
||||
static void
|
||||
png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
|
||||
png_const_bytep data, png_size_t length)
|
||||
png_const_bytep data, size_t length)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
@ -191,7 +190,7 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
|
||||
/* This is the API that calls the internal function above. */
|
||||
void PNGAPI
|
||||
png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
|
||||
png_const_bytep data, png_size_t length)
|
||||
png_const_bytep data, size_t length)
|
||||
{
|
||||
png_write_complete_chunk(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), data,
|
||||
length);
|
||||
@ -820,7 +819,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
buf[12] = (png_byte)interlace_type;
|
||||
|
||||
/* Write the chunk */
|
||||
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
||||
png_write_complete_chunk(png_ptr, png_IHDR, buf, 13);
|
||||
|
||||
if ((png_ptr->do_filter) == PNG_NO_FILTERS)
|
||||
{
|
||||
@ -889,7 +888,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
||||
buf[0] = pal_ptr->red;
|
||||
buf[1] = pal_ptr->green;
|
||||
buf[2] = pal_ptr->blue;
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)3);
|
||||
png_write_chunk_data(png_ptr, buf, 3);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -903,7 +902,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
||||
buf[0] = pal_ptr[i].red;
|
||||
buf[1] = pal_ptr[i].green;
|
||||
buf[2] = pal_ptr[i].blue;
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)3);
|
||||
png_write_chunk_data(png_ptr, buf, 3);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1075,7 +1074,7 @@ png_write_IEND(png_structrp png_ptr)
|
||||
{
|
||||
png_debug(1, "in png_write_IEND");
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_IEND, NULL, (png_size_t)0);
|
||||
png_write_complete_chunk(png_ptr, png_IEND, NULL, 0);
|
||||
png_ptr->mode |= PNG_HAVE_IEND;
|
||||
}
|
||||
|
||||
@ -1090,7 +1089,7 @@ png_write_gAMA_fixed(png_structrp png_ptr, png_fixed_point file_gamma)
|
||||
|
||||
/* file_gamma is saved in 1/100,000ths */
|
||||
png_save_uint_32(buf, (png_uint_32)file_gamma);
|
||||
png_write_complete_chunk(png_ptr, png_gAMA, buf, (png_size_t)4);
|
||||
png_write_complete_chunk(png_ptr, png_gAMA, buf, 4);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1108,7 +1107,7 @@ png_write_sRGB(png_structrp png_ptr, int srgb_intent)
|
||||
"Invalid sRGB rendering intent specified");
|
||||
|
||||
buf[0]=(png_byte)srgb_intent;
|
||||
png_write_complete_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
|
||||
png_write_complete_chunk(png_ptr, png_sRGB, buf, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1182,8 +1181,8 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
|
||||
png_uint_32 name_len;
|
||||
png_byte new_name[80];
|
||||
png_byte entrybuf[10];
|
||||
png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
|
||||
png_size_t palette_size = entry_size * (png_size_t)spalette->nentries;
|
||||
size_t entry_size = (spalette->depth == 8 ? 6 : 10);
|
||||
size_t palette_size = entry_size * (size_t)spalette->nentries;
|
||||
png_sPLT_entryp ep;
|
||||
#ifndef PNG_POINTER_INDEXING_SUPPORTED
|
||||
int i;
|
||||
@ -1200,10 +1199,9 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
|
||||
png_write_chunk_header(png_ptr, png_sPLT,
|
||||
(png_uint_32)(name_len + 2 + palette_size));
|
||||
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_name,
|
||||
(png_size_t)(name_len + 1));
|
||||
png_write_chunk_data(png_ptr, (png_bytep)new_name, (size_t)(name_len + 1));
|
||||
|
||||
png_write_chunk_data(png_ptr, &spalette->depth, (png_size_t)1);
|
||||
png_write_chunk_data(png_ptr, &spalette->depth, 1);
|
||||
|
||||
/* Loop through each palette entry, writing appropriately */
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
@ -1265,7 +1263,7 @@ void /* PRIVATE */
|
||||
png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
|
||||
{
|
||||
png_byte buf[4];
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
png_debug(1, "in png_write_sBIT");
|
||||
|
||||
@ -1365,7 +1363,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
||||
|
||||
/* Write the chunk out as it is */
|
||||
png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha,
|
||||
(png_size_t)num_trans);
|
||||
(size_t)num_trans);
|
||||
}
|
||||
|
||||
else if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
@ -1380,7 +1378,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
||||
}
|
||||
|
||||
png_save_uint_16(buf, tran->gray);
|
||||
png_write_complete_chunk(png_ptr, png_tRNS, buf, (png_size_t)2);
|
||||
png_write_complete_chunk(png_ptr, png_tRNS, buf, 2);
|
||||
}
|
||||
|
||||
else if (color_type == PNG_COLOR_TYPE_RGB)
|
||||
@ -1400,7 +1398,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
||||
return;
|
||||
}
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_tRNS, buf, (png_size_t)6);
|
||||
png_write_complete_chunk(png_ptr, png_tRNS, buf, 6);
|
||||
}
|
||||
|
||||
else
|
||||
@ -1433,7 +1431,7 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
||||
}
|
||||
|
||||
buf[0] = back->index;
|
||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
|
||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, 1);
|
||||
}
|
||||
|
||||
else if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
@ -1454,7 +1452,7 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
||||
return;
|
||||
}
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)6);
|
||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, 6);
|
||||
}
|
||||
|
||||
else
|
||||
@ -1468,7 +1466,7 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
||||
}
|
||||
|
||||
png_save_uint_16(buf, back->gray);
|
||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)2);
|
||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, 2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1488,7 +1486,7 @@ png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
|
||||
for (i = 0; i < num_exif; i++)
|
||||
{
|
||||
buf[0] = exif[i];
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)1);
|
||||
png_write_chunk_data(png_ptr, buf, 1);
|
||||
}
|
||||
|
||||
png_write_chunk_end(png_ptr);
|
||||
@ -1519,7 +1517,7 @@ png_write_hIST(png_structrp png_ptr, png_const_uint_16p hist, int num_hist)
|
||||
for (i = 0; i < num_hist; i++)
|
||||
{
|
||||
png_save_uint_16(buf, hist[i]);
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)2);
|
||||
png_write_chunk_data(png_ptr, buf, 2);
|
||||
}
|
||||
|
||||
png_write_chunk_end(png_ptr);
|
||||
@ -1530,7 +1528,7 @@ png_write_hIST(png_structrp png_ptr, png_const_uint_16p hist, int num_hist)
|
||||
/* Write a tEXt chunk */
|
||||
void /* PRIVATE */
|
||||
png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
||||
png_size_t text_len)
|
||||
size_t text_len)
|
||||
{
|
||||
png_uint_32 key_len;
|
||||
png_byte new_key[80];
|
||||
@ -1627,7 +1625,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
||||
png_const_charp lang, png_const_charp lang_key, png_const_charp text)
|
||||
{
|
||||
png_uint_32 key_len, prefix_len;
|
||||
png_size_t lang_len, lang_key_len;
|
||||
size_t lang_len, lang_key_len;
|
||||
png_byte new_key[82];
|
||||
compression_state comp;
|
||||
|
||||
@ -1737,7 +1735,7 @@ png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
|
||||
png_save_int_32(buf + 4, y_offset);
|
||||
buf[8] = (png_byte)unit_type;
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
|
||||
png_write_complete_chunk(png_ptr, png_oFFs, buf, 9);
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_WRITE_pCAL_SUPPORTED
|
||||
@ -1748,7 +1746,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
png_charpp params)
|
||||
{
|
||||
png_uint_32 purpose_len;
|
||||
png_size_t units_len, total_len;
|
||||
size_t units_len, total_len;
|
||||
png_size_tp params_len;
|
||||
png_byte buf[10];
|
||||
png_byte new_purpose[80];
|
||||
@ -1772,7 +1770,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
total_len = purpose_len + units_len + 10;
|
||||
|
||||
params_len = (png_size_tp)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t))));
|
||||
(png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (size_t))));
|
||||
|
||||
/* Find the length of each parameter, making sure we don't count the
|
||||
* null terminator for the last parameter.
|
||||
@ -1792,8 +1790,8 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
png_save_int_32(buf + 4, X1);
|
||||
buf[8] = (png_byte)type;
|
||||
buf[9] = (png_byte)nparams;
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)10);
|
||||
png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
|
||||
png_write_chunk_data(png_ptr, buf, 10);
|
||||
png_write_chunk_data(png_ptr, (png_const_bytep)units, (size_t)units_len);
|
||||
|
||||
for (i = 0; i < nparams; i++)
|
||||
{
|
||||
@ -1812,7 +1810,7 @@ png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width,
|
||||
png_const_charp height)
|
||||
{
|
||||
png_byte buf[64];
|
||||
png_size_t wlen, hlen, total_len;
|
||||
size_t wlen, hlen, total_len;
|
||||
|
||||
png_debug(1, "in png_write_sCAL_s");
|
||||
|
||||
@ -1853,7 +1851,7 @@ png_write_pHYs(png_structrp png_ptr, png_uint_32 x_pixels_per_unit,
|
||||
png_save_uint_32(buf + 4, y_pixels_per_unit);
|
||||
buf[8] = (png_byte)unit_type;
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
|
||||
png_write_complete_chunk(png_ptr, png_pHYs, buf, 9);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1883,7 +1881,7 @@ png_write_tIME(png_structrp png_ptr, png_const_timep mod_time)
|
||||
buf[5] = mod_time->minute;
|
||||
buf[6] = mod_time->second;
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
|
||||
png_write_complete_chunk(png_ptr, png_tIME, buf, 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2073,8 +2071,8 @@ png_write_finish_row(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->prev_row != NULL)
|
||||
memset(png_ptr->prev_row, 0,
|
||||
(png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*
|
||||
png_ptr->usr_bit_depth, png_ptr->width)) + 1);
|
||||
PNG_ROWBYTES(png_ptr->usr_channels *
|
||||
png_ptr->usr_bit_depth, png_ptr->width) + 1);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -2130,7 +2128,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
for (i = png_pass_start[pass]; i < row_width;
|
||||
i += png_pass_inc[pass])
|
||||
{
|
||||
sp = row + (png_size_t)(i >> 3);
|
||||
sp = row + (size_t)(i >> 3);
|
||||
value = (int)(*sp >> (7 - (int)(i & 0x07))) & 0x01;
|
||||
d |= (value << shift);
|
||||
|
||||
@ -2168,7 +2166,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
for (i = png_pass_start[pass]; i < row_width;
|
||||
i += png_pass_inc[pass])
|
||||
{
|
||||
sp = row + (png_size_t)(i >> 2);
|
||||
sp = row + (size_t)(i >> 2);
|
||||
value = (*sp >> ((3 - (int)(i & 0x03)) << 1)) & 0x03;
|
||||
d |= (value << shift);
|
||||
|
||||
@ -2204,7 +2202,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
for (i = png_pass_start[pass]; i < row_width;
|
||||
i += png_pass_inc[pass])
|
||||
{
|
||||
sp = row + (png_size_t)(i >> 1);
|
||||
sp = row + (size_t)(i >> 1);
|
||||
value = (*sp >> ((1 - (int)(i & 0x01)) << 2)) & 0x0f;
|
||||
d |= (value << shift);
|
||||
|
||||
@ -2230,7 +2228,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
png_bytep dp;
|
||||
png_uint_32 i;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
png_size_t pixel_bytes;
|
||||
size_t pixel_bytes;
|
||||
|
||||
/* Start at the beginning */
|
||||
dp = row;
|
||||
@ -2243,7 +2241,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
i += png_pass_inc[pass])
|
||||
{
|
||||
/* Find out where the original pixel is */
|
||||
sp = row + (png_size_t)i * pixel_bytes;
|
||||
sp = row + (size_t)i * pixel_bytes;
|
||||
|
||||
/* Move the pixel */
|
||||
if (dp != sp)
|
||||
@ -2274,16 +2272,16 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||
*/
|
||||
static void /* PRIVATE */
|
||||
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||
png_size_t row_bytes);
|
||||
size_t row_bytes);
|
||||
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
static png_size_t /* PRIVATE */
|
||||
static size_t /* PRIVATE */
|
||||
png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
const png_size_t row_bytes, const png_size_t lmins)
|
||||
size_t row_bytes, size_t lmins)
|
||||
{
|
||||
png_bytep rp, dp, lp;
|
||||
png_size_t i;
|
||||
png_size_t sum = 0;
|
||||
size_t i;
|
||||
size_t sum = 0;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
@ -2318,10 +2316,10 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
|
||||
static void /* PRIVATE */
|
||||
png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
const png_size_t row_bytes)
|
||||
size_t row_bytes)
|
||||
{
|
||||
png_bytep rp, dp, lp;
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
|
||||
@ -2338,13 +2336,12 @@ png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
}
|
||||
}
|
||||
|
||||
static png_size_t /* PRIVATE */
|
||||
png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
||||
const png_size_t lmins)
|
||||
static size_t /* PRIVATE */
|
||||
png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
|
||||
{
|
||||
png_bytep rp, dp, pp;
|
||||
png_size_t i;
|
||||
png_size_t sum = 0;
|
||||
size_t i;
|
||||
size_t sum = 0;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
|
||||
@ -2367,10 +2364,10 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
|
||||
return (sum);
|
||||
}
|
||||
static void /* PRIVATE */
|
||||
png_setup_up_row_only(png_structrp png_ptr, const png_size_t row_bytes)
|
||||
png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
|
||||
{
|
||||
png_bytep rp, dp, pp;
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
|
||||
|
||||
@ -2382,13 +2379,13 @@ png_setup_up_row_only(png_structrp png_ptr, const png_size_t row_bytes)
|
||||
}
|
||||
}
|
||||
|
||||
static png_size_t /* PRIVATE */
|
||||
static size_t /* PRIVATE */
|
||||
png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
const png_size_t row_bytes, const png_size_t lmins)
|
||||
size_t row_bytes, size_t lmins)
|
||||
{
|
||||
png_bytep rp, dp, pp, lp;
|
||||
png_uint_32 i;
|
||||
png_size_t sum = 0;
|
||||
size_t sum = 0;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
@ -2424,7 +2421,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
}
|
||||
static void /* PRIVATE */
|
||||
png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
const png_size_t row_bytes)
|
||||
size_t row_bytes)
|
||||
{
|
||||
png_bytep rp, dp, pp, lp;
|
||||
png_uint_32 i;
|
||||
@ -2444,13 +2441,13 @@ png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
}
|
||||
}
|
||||
|
||||
static png_size_t /* PRIVATE */
|
||||
static size_t /* PRIVATE */
|
||||
png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
const png_size_t row_bytes, const png_size_t lmins)
|
||||
size_t row_bytes, size_t lmins)
|
||||
{
|
||||
png_bytep rp, dp, pp, cp, lp;
|
||||
png_size_t i;
|
||||
png_size_t sum = 0;
|
||||
size_t i;
|
||||
size_t sum = 0;
|
||||
unsigned int v;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
@ -2507,10 +2504,10 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
}
|
||||
static void /* PRIVATE */
|
||||
png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp,
|
||||
const png_size_t row_bytes)
|
||||
size_t row_bytes)
|
||||
{
|
||||
png_bytep rp, dp, pp, cp, lp;
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
|
||||
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
|
||||
@ -2559,8 +2556,8 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
png_bytep row_buf;
|
||||
png_bytep best_row;
|
||||
png_uint_32 bpp;
|
||||
png_size_t mins;
|
||||
png_size_t row_bytes = row_info->rowbytes;
|
||||
size_t mins;
|
||||
size_t row_bytes = row_info->rowbytes;
|
||||
|
||||
png_debug(1, "in png_write_find_filter");
|
||||
|
||||
@ -2615,8 +2612,8 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
* 'none' filter.
|
||||
*/
|
||||
png_bytep rp;
|
||||
png_size_t sum = 0;
|
||||
png_size_t i;
|
||||
size_t sum = 0;
|
||||
size_t i;
|
||||
unsigned int v;
|
||||
|
||||
{
|
||||
@ -2644,8 +2641,8 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
|
||||
else if ((filter_to_do & PNG_FILTER_SUB) != 0)
|
||||
{
|
||||
png_size_t sum;
|
||||
png_size_t lmins = mins;
|
||||
size_t sum;
|
||||
size_t lmins = mins;
|
||||
|
||||
sum = png_setup_sub_row(png_ptr, bpp, row_bytes, lmins);
|
||||
|
||||
@ -2670,8 +2667,8 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
|
||||
else if ((filter_to_do & PNG_FILTER_UP) != 0)
|
||||
{
|
||||
png_size_t sum;
|
||||
png_size_t lmins = mins;
|
||||
size_t sum;
|
||||
size_t lmins = mins;
|
||||
|
||||
sum = png_setup_up_row(png_ptr, row_bytes, lmins);
|
||||
|
||||
@ -2696,8 +2693,8 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
|
||||
else if ((filter_to_do & PNG_FILTER_AVG) != 0)
|
||||
{
|
||||
png_size_t sum;
|
||||
png_size_t lmins = mins;
|
||||
size_t sum;
|
||||
size_t lmins = mins;
|
||||
|
||||
sum= png_setup_avg_row(png_ptr, bpp, row_bytes, lmins);
|
||||
|
||||
@ -2722,8 +2719,8 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
|
||||
else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
|
||||
{
|
||||
png_size_t sum;
|
||||
png_size_t lmins = mins;
|
||||
size_t sum;
|
||||
size_t lmins = mins;
|
||||
|
||||
sum = png_setup_paeth_row(png_ptr, bpp, row_bytes, lmins);
|
||||
|
||||
@ -2748,7 +2745,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||
/* Do the actual writing of a previously filtered row. */
|
||||
static void
|
||||
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||
png_size_t full_row_length/*includes filter byte*/)
|
||||
size_t full_row_length/*includes filter byte*/)
|
||||
{
|
||||
png_debug(1, "in png_write_filtered_row");
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
||||
png_byte i;\
|
||||
png_bytep rp = row + offset;\
|
||||
png_const_bytep pp = prev_row;\
|
||||
png_size_t unaligned_top = 16 - (((png_size_t)rp % 16));\
|
||||
png_size_t istop;\
|
||||
size_t unaligned_top = 16 - (((size_t)rp % 16));\
|
||||
size_t istop;\
|
||||
if(unaligned_top == 16)\
|
||||
unaligned_top = 0;\
|
||||
istop = row_info->rowbytes;\
|
||||
|
Loading…
Reference in New Issue
Block a user