+ fix compiling miniz codec in c++11 mode
FIXME: we should compile legacy "C" code with special flags..
This commit is contained in:
parent
8908a4bd1b
commit
c1b25607db
3 changed files with 12 additions and 7 deletions
|
@ -117,6 +117,7 @@ source = Split(
|
|||
well_known_srs.cpp
|
||||
params.cpp
|
||||
image_filter_types.cpp
|
||||
miniz_png.cpp
|
||||
color.cpp
|
||||
css_color_grammar.cpp
|
||||
conversions.cpp
|
||||
|
|
|
@ -789,7 +789,7 @@ size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void
|
|||
|
||||
// Compresses an image to a compressed PNG file in memory.
|
||||
// On entry:
|
||||
// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4.
|
||||
// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4.
|
||||
// The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory.
|
||||
// On return:
|
||||
// Function returns a pointer to the compressed data, or NULL on failure.
|
||||
|
@ -2778,8 +2778,8 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
|
|||
*pLen_out = out_buf.m_size-41;
|
||||
{
|
||||
mz_uint8 pnghdr[41]={0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
|
||||
0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0,
|
||||
(mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54};
|
||||
0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8, (mz_uint8)"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0,
|
||||
(mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54};
|
||||
c=(mz_uint32)mz_crc32(MZ_CRC32_INIT,pnghdr+12,17); for (i=0; i<4; ++i, c<<=8) ((mz_uint8*)(pnghdr+29))[i]=(mz_uint8)(c>>24);
|
||||
memcpy(out_buf.m_pBuf, pnghdr, 41);
|
||||
}
|
||||
|
@ -4831,4 +4831,4 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char
|
|||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -30,8 +30,10 @@
|
|||
#define MINIZ_NO_ARCHIVE_APIS
|
||||
#define MINIZ_NO_STDIO
|
||||
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
|
||||
#include "miniz.c"
|
||||
|
||||
extern "C" {
|
||||
#include "miniz.c"
|
||||
}
|
||||
// zlib
|
||||
#include <zlib.h>
|
||||
|
||||
|
@ -142,7 +144,10 @@ void PNGWriter::finishChunk(size_t start)
|
|||
// Write CRC32 checksum. Don't include the 4-byte length, but /do/ include
|
||||
// the 4-byte chunk name.
|
||||
mz_uint32 crc = mz_crc32(MZ_CRC32_INIT, buffer->m_pBuf + start + 4, payloadLength + 4);
|
||||
mz_uint8 checksum[] = { crc >> 24, crc >> 16, crc >> 8, crc };
|
||||
mz_uint8 checksum[] = { static_cast<mz_uint8>(crc >> 24),
|
||||
static_cast<mz_uint8>(crc >> 16),
|
||||
static_cast<mz_uint8>(crc >> 8),
|
||||
static_cast<mz_uint8>(crc) };
|
||||
mz_bool status = tdefl_output_buffer_putter(checksum, 4, buffer);
|
||||
if (status != MZ_TRUE)
|
||||
{
|
||||
|
@ -362,4 +367,3 @@ template void PNGWriter::writeIDATStripAlpha<image_data_32>(image_data_32 const&
|
|||
template void PNGWriter::writeIDATStripAlpha<image_view<image_data_32> >(image_view<image_data_32> const& image);
|
||||
|
||||
}}
|
||||
|
||||
|
|
Loading…
Reference in a new issue