mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-08 07:53:54 +00:00
Update libmng snapshot. Not in default build.
This commit is contained in:
parent
2c08b2ae6c
commit
083bb9620d
@ -73,6 +73,9 @@ core:
|
||||
- changed definition for mng_handle (64-bit platforms)
|
||||
- swapped refresh parameters
|
||||
- fixed initialization routine for new mng_handle type
|
||||
- added inclusion of stdlib.h for abs()
|
||||
- fixed some 64-bit warnings
|
||||
- fixed incompatible return-types
|
||||
|
||||
samples:
|
||||
|
||||
|
@ -82,6 +82,8 @@
|
||||
/* * - implemented support for PPLT chunk * */
|
||||
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
|
||||
/* * - added precaution against faulty iCCP chunks from PS * */
|
||||
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
|
||||
/* * - fixed some 64-bit warnings * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -128,7 +130,7 @@ void make_crc_table (mng_datap pData)
|
||||
for (k = 0; k < 8; k++)
|
||||
{
|
||||
if (c & 1)
|
||||
c = 0xedb88320L ^ (c >> 1);
|
||||
c = 0xedb88320U ^ (c >> 1);
|
||||
else
|
||||
c = c >> 1;
|
||||
}
|
||||
@ -166,7 +168,7 @@ mng_uint32 crc (mng_datap pData,
|
||||
mng_uint8p buf,
|
||||
mng_int32 len)
|
||||
{
|
||||
return update_crc (pData, 0xffffffffL, buf, len) ^ 0xffffffffL;
|
||||
return update_crc (pData, 0xffffffffU, buf, len) ^ 0xffffffffU;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -296,7 +298,7 @@ mng_retcode inflate_buffer (mng_datap pData,
|
||||
/* ok; let's inflate... */
|
||||
iRetcode = mngzlib_inflatedata (pData, iInsize, pInbuf);
|
||||
/* determine actual output size */
|
||||
*iRealsize = pData->sZlib.total_out;
|
||||
*iRealsize = (mng_uint32)pData->sZlib.total_out;
|
||||
|
||||
mngzlib_inflatefree (pData); /* zlib's done */
|
||||
|
||||
@ -1650,7 +1652,7 @@ READ_CHUNK (read_iccp)
|
||||
if ((pTemp - pRawdata) > (mng_int32)iRawlen)
|
||||
MNG_ERROR (pData, MNG_NULLNOTFOUND)
|
||||
/* determine size of compressed profile */
|
||||
iCompressedsize = iRawlen - (pTemp - pRawdata) - 2;
|
||||
iCompressedsize = (mng_uint32)(iRawlen - (pTemp - pRawdata) - 2);
|
||||
/* decompress the profile */
|
||||
iRetcode = inflate_buffer (pData, pTemp+2, iCompressedsize,
|
||||
&pBuf, &iBufsize, &iProfilesize);
|
||||
@ -2604,7 +2606,7 @@ READ_CHUNK (read_splt)
|
||||
if ((pTemp - pRawdata) > (mng_int32)iRawlen)
|
||||
MNG_ERROR (pData, MNG_NULLNOTFOUND)
|
||||
|
||||
iNamelen = pTemp - pRawdata;
|
||||
iNamelen = (mng_uint32)(pTemp - pRawdata);
|
||||
iSampledepth = *(pTemp+1);
|
||||
iRemain = (iRawlen - 2 - iNamelen);
|
||||
|
||||
@ -3788,8 +3790,8 @@ READ_CHUNK (read_fram)
|
||||
if ((pTemp - pRawdata) > (mng_int32)iRawlen)
|
||||
MNG_ERROR (pData, MNG_NULLNOTFOUND)
|
||||
|
||||
iNamelen = (pTemp - pRawdata - 1);
|
||||
iRemain = iRawlen - (pTemp - pRawdata) - 1;
|
||||
iNamelen = (mng_uint32)((pTemp - pRawdata) - 1);
|
||||
iRemain = (mng_uint32)(iRawlen - (pTemp - pRawdata) - 1);
|
||||
/* remains must be empty or at least 4 bytes */
|
||||
if ((iRemain != 0) && (iRemain < 4))
|
||||
MNG_ERROR (pData, MNG_INVALIDLENGTH)
|
||||
|
@ -25,6 +25,8 @@
|
||||
/* * - added tracing of JPEG calls * */
|
||||
/* * 0.5.3 - 06/24/2000 - G.Juyn * */
|
||||
/* * - fixed inclusion of IJG read/write code * */
|
||||
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
|
||||
/* * - fixed some 64-bit warnings * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -86,7 +88,7 @@ void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
/* problem scenario ? */
|
||||
if (pSrc->bytes_in_buffer < (size_t)num_bytes)
|
||||
{ /* tell the boss we need to skip some data! */
|
||||
pData->iJPEGtoskip = (size_t)num_bytes - pSrc->bytes_in_buffer;
|
||||
pData->iJPEGtoskip = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer);
|
||||
|
||||
pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */
|
||||
pSrc->next_input_byte = MNG_NULL;
|
||||
@ -434,7 +436,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
|
||||
}
|
||||
|
||||
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
|
||||
pData->iJPEGbufremain = pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
}
|
||||
/* decompress not started ? */
|
||||
if ((pData->bJPEGhasheader) && (!pData->bJPEGdecostarted))
|
||||
@ -453,7 +455,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
|
||||
pData->bJPEGdecostarted = MNG_TRUE;
|
||||
|
||||
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
|
||||
pData->iJPEGbufremain = pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
}
|
||||
/* process some scanlines ? */
|
||||
if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) &&
|
||||
@ -473,7 +475,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
|
||||
(pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height)))
|
||||
{
|
||||
pData->bJPEGscanstarted = MNG_TRUE;
|
||||
|
||||
|
||||
/* adjust output decompression parameters if required */
|
||||
/* nop */
|
||||
|
||||
@ -496,7 +498,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
|
||||
iLines = jpeg_read_scanlines (pData->pJPEGdinfo, (JSAMPARRAY)&pRow, 1);
|
||||
|
||||
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
|
||||
pData->iJPEGbufremain = pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
|
||||
if (iLines > 0) /* got something ? */
|
||||
{
|
||||
@ -541,7 +543,7 @@ mng_retcode mngjpeg_decompressdata (mng_datap pData,
|
||||
pData->bJPEGhasheader = MNG_FALSE;
|
||||
pData->bJPEGdecostarted = MNG_FALSE;
|
||||
pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte;
|
||||
pData->iJPEGbufremain = pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer;
|
||||
/* remaining fluff is an error ! */
|
||||
if ((pData->iJPEGbufremain > 0) || (iRemain > 0))
|
||||
MNG_ERROR (pData, MNG_TOOMUCHJDAT)
|
||||
|
@ -37,6 +37,8 @@
|
||||
/* * - added get for imagelevel during processtext callback * */
|
||||
/* * 0.5.3 - 06/26/2000 - G.Juyn * */
|
||||
/* * - changed userdata variable to mng_ptr * */
|
||||
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
|
||||
/* * - fixed incompatible return-types * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -833,7 +835,8 @@ mng_imgtype MNG_DECL mng_get_sigtype (mng_handle hHandle)
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIGTYPE, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
MNG_VALIDHANDLEX (hHandle)
|
||||
if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC))
|
||||
return mng_it_unknown;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIGTYPE, MNG_LC_END)
|
||||
@ -850,7 +853,8 @@ mng_imgtype MNG_DECL mng_get_imagetype (mng_handle hHandle)
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGETYPE, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
MNG_VALIDHANDLEX (hHandle)
|
||||
if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC))
|
||||
return mng_it_unknown;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGETYPE, MNG_LC_END)
|
||||
@ -1330,7 +1334,8 @@ mngjpeg_dctmethod MNG_DECL mng_get_jpeg_dctmethod (mng_handle hHandle)
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_DCTMETHOD, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
MNG_VALIDHANDLEX (hHandle)
|
||||
if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC))
|
||||
return JDCT_ISLOW;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_DCTMETHOD, MNG_LC_END)
|
||||
@ -1444,7 +1449,8 @@ mng_speedtype MNG_DECL mng_get_speed (mng_handle hHandle)
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_START)
|
||||
#endif
|
||||
|
||||
MNG_VALIDHANDLEX (hHandle)
|
||||
if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC))
|
||||
return mng_st_normal;
|
||||
|
||||
#ifdef MNG_SUPPORT_TRACE
|
||||
MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_END)
|
||||
|
@ -295,7 +295,7 @@ mng_retcode read_chunk (mng_datap pData)
|
||||
{ /* determine chunklength */
|
||||
iChunklen = mng_get_uint32 (pBuf);
|
||||
/* read chunkname + data + crc */
|
||||
iBuflen = sizeof (mng_chunkid) + iChunklen + sizeof (iCrc);
|
||||
iBuflen = iChunklen + (mng_uint32)(sizeof (mng_chunkid) + sizeof (iCrc));
|
||||
|
||||
if (iBuflen < iBufmax) /* does it fit in default buffer ? */
|
||||
{ /* note that we don't use the full size
|
||||
@ -319,13 +319,15 @@ mng_retcode read_chunk (mng_datap pData)
|
||||
if (iRead != iBuflen) /* did we get all the data ? */
|
||||
iRetcode = MNG_UNEXPECTEDEOF;
|
||||
else
|
||||
{ /* calculate the crc */
|
||||
iCrc = crc (pData, pBuf, iBuflen - sizeof (iCrc));
|
||||
{
|
||||
mng_uint32 iL = iBuflen - (mng_uint32)(sizeof (iCrc));
|
||||
/* calculate the crc */
|
||||
iCrc = crc (pData, pBuf, iL);
|
||||
/* and check it */
|
||||
if (!(iCrc == mng_get_uint32 (pBuf + iBuflen - sizeof (iCrc))))
|
||||
if (!(iCrc == mng_get_uint32 (pBuf + iL)))
|
||||
iRetcode = MNG_INVALIDCRC;
|
||||
else
|
||||
iRetcode = process_raw_chunk (pData, pBuf, iBuflen - sizeof (iCrc));
|
||||
iRetcode = process_raw_chunk (pData, pBuf, iL);
|
||||
}
|
||||
|
||||
}
|
||||
@ -354,13 +356,15 @@ mng_retcode read_chunk (mng_datap pData)
|
||||
if (iRead != iBuflen) /* did we get all the data ? */
|
||||
iRetcode = MNG_UNEXPECTEDEOF;
|
||||
else
|
||||
{ /* calculate the crc */
|
||||
iCrc = crc (pData, pExtra, iBuflen - sizeof (iCrc));
|
||||
{
|
||||
mng_uint32 iL = iBuflen - (mng_uint32)(sizeof (iCrc));
|
||||
/* calculate the crc */
|
||||
iCrc = crc (pData, pExtra, iL);
|
||||
/* and check it */
|
||||
if (!(iCrc == mng_get_uint32 (pExtra + iBuflen - sizeof (iCrc))))
|
||||
if (!(iCrc == mng_get_uint32 (pExtra + iL)))
|
||||
iRetcode = MNG_INVALIDCRC;
|
||||
else
|
||||
iRetcode = process_raw_chunk (pData, pExtra, iBuflen - sizeof (iCrc));
|
||||
iRetcode = process_raw_chunk (pData, pExtra, iL);
|
||||
}
|
||||
/* cleanup additional large buffer */
|
||||
MNG_FREEX (pData, pExtra, iBuflen+1)
|
||||
|
@ -57,6 +57,7 @@
|
||||
/* * 0.5.3 - 06/29/2000 - G.Juyn * */
|
||||
/* * - changed definition of mng_handle (again) * */
|
||||
/* * - swapped refresh parameters * */
|
||||
/* * - added inclusion of stdlib.h for abs() * */
|
||||
/* * * */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -106,8 +107,8 @@
|
||||
#include "jpeglib.h" /* all that for JPEG support :-) */
|
||||
#endif /* MNG_INCLUDE_IJG6B */
|
||||
|
||||
#ifdef MNG_INTERNAL_MEMMNGMT
|
||||
#include <stdlib.h> /* "calloc" & "free" */
|
||||
#if defined(MNG_INTERNAL_MEMMNGMT) || defined(MNG_INCLUDE_FILTERS)
|
||||
#include <stdlib.h> /* "calloc" & "free" & "abs" */
|
||||
#endif
|
||||
|
||||
#include <limits.h> /* get proper integer widths */
|
||||
@ -171,7 +172,7 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#if USHRT_MAX == 0xffffffffU /* get the proper 32-bit width !!! */
|
||||
typedef unsigned short mng_uint32;
|
||||
typedef unsigned short mng_uint32;
|
||||
typedef signed short mng_int32;
|
||||
#elif UINT_MAX == 0xffffffffU
|
||||
typedef unsigned int mng_uint32;
|
||||
|
Loading…
x
Reference in New Issue
Block a user