Imported from libpng-1.2.11beta2cos.tar
This commit is contained in:
parent
413f3db617
commit
79f25cdeb2
18
CHANGES
18
CHANGES
@ -1576,10 +1576,14 @@ version 1.2.11beta2 [June 2, 2006]
|
|||||||
buffer overflow.
|
buffer overflow.
|
||||||
Fixed bug in example.c (png_set_palette_rgb -> png_set_palette_to_rgb))
|
Fixed bug in example.c (png_set_palette_rgb -> png_set_palette_to_rgb))
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
version 1.2.11beta2-cos [June 4, 2006]
|
||||||
(subscription required; visit
|
Prepended "#! /bin/sh" to ltmail.sh and contrib/pngminus/*.sh (Cosmin).
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
Removed the accidental leftover Makefile.in~ (Cosmin).
|
||||||
to subscribe)
|
Removed the include directories and libraries from CFLAGS and LDFLAGS
|
||||||
or to glennrp at users.sourceforge.net
|
in scripts/makefile.gcc (Nelson A. de Oliveira, Cosmin).
|
||||||
|
Exported png_write_sig (Cosmin).
|
||||||
Glenn R-P
|
Optimized buffer in png_handle_cHRM() (Cosmin).
|
||||||
|
Avoided potential buffer overflow and optimized buffer in
|
||||||
|
png_write_sCAL(), png_write_sCAL_s() (Cosmin).
|
||||||
|
Set pHYs = 2835 x 2835 pixels per meter, and added
|
||||||
|
sCAL = 0.352778e-3 x 0.352778e-3 meters, in pngtest.png (Cosmin).
|
||||||
|
0
contrib/gregbook/makevms.com
Normal file → Executable file
0
contrib/gregbook/makevms.com
Normal file → Executable file
0
contrib/pngminus/makevms.com
Normal file → Executable file
0
contrib/pngminus/makevms.com
Normal file → Executable file
0
contrib/pngminus/png2pnm.bat
Normal file → Executable file
0
contrib/pngminus/png2pnm.bat
Normal file → Executable file
1
contrib/pngminus/png2pnm.sh
Normal file → Executable file
1
contrib/pngminus/png2pnm.sh
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
# -- grayscale
|
# -- grayscale
|
||||||
./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm
|
./png2pnm -noraw ../pngsuite/basn0g01.png basn0g01.pgm
|
||||||
./png2pnm -noraw ../pngsuite/basn0g02.png basn0g02.pgm
|
./png2pnm -noraw ../pngsuite/basn0g02.png basn0g02.pgm
|
||||||
|
0
contrib/pngminus/pngminus.bat
Normal file → Executable file
0
contrib/pngminus/pngminus.bat
Normal file → Executable file
1
contrib/pngminus/pngminus.sh
Normal file → Executable file
1
contrib/pngminus/pngminus.sh
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
make -f makefile.std
|
make -f makefile.std
|
||||||
sh png2pnm.sh
|
sh png2pnm.sh
|
||||||
sh pnm2png.sh
|
sh pnm2png.sh
|
||||||
|
0
contrib/pngminus/pnm2png.bat
Normal file → Executable file
0
contrib/pngminus/pnm2png.bat
Normal file → Executable file
1
contrib/pngminus/pnm2png.sh
Normal file → Executable file
1
contrib/pngminus/pnm2png.sh
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
# -- grayscale
|
# -- grayscale
|
||||||
./pnm2png basn0g01.pgm basn0g01.png
|
./pnm2png basn0g01.pgm basn0g01.png
|
||||||
./pnm2png basn0g02.pgm basn0g02.png
|
./pnm2png basn0g02.pgm basn0g02.png
|
||||||
|
4
libpng.3
4
libpng.3
@ -802,6 +802,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.11beta2
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
|
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fI\fB
|
||||||
|
|
||||||
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
@ -711,12 +711,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.11beta2
|
|||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
|
||||||
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fI\fB
|
|
||||||
|
|
||||||
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
|
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
|
||||||
|
|
||||||
\fI\fB
|
\fI\fB
|
||||||
|
1
ltmain.sh
Normal file → Executable file
1
ltmain.sh
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#! /bin/sh
|
||||||
# ltmain.sh - Provide generalized library-building support services.
|
# ltmain.sh - Provide generalized library-building support services.
|
||||||
# NOTE: Changing this file will not affect anything until you rerun configure.
|
# NOTE: Changing this file will not affect anything until you rerun configure.
|
||||||
#
|
#
|
||||||
|
6
png.h
6
png.h
@ -1434,6 +1434,9 @@ extern PNG_EXPORT(png_structp,png_create_write_struct_2)
|
|||||||
png_malloc_ptr malloc_fn, png_free_ptr free_fn));
|
png_malloc_ptr malloc_fn, png_free_ptr free_fn));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Write the PNG file signature. */
|
||||||
|
extern PNG_EXPORT(void,png_write_sig) PNGARG((png_structp png_ptr));
|
||||||
|
|
||||||
/* Write a PNG chunk - size, type, (optional) data, CRC. */
|
/* Write a PNG chunk - size, type, (optional) data, CRC. */
|
||||||
extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
|
extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
|
||||||
png_bytep chunk_name, png_bytep data, png_size_t length));
|
png_bytep chunk_name, png_bytep data, png_size_t length));
|
||||||
@ -2955,9 +2958,6 @@ PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
|
|||||||
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
|
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* simple function to write the signature */
|
|
||||||
PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
|
|
||||||
|
|
||||||
/* write various chunks */
|
/* write various chunks */
|
||||||
|
|
||||||
/* Write the IHDR chunk, and update the png_struct with the necessary
|
/* Write the IHDR chunk, and update the png_struct with the necessary
|
||||||
|
46
pngrutil.c
46
pngrutil.c
@ -715,7 +715,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
png_byte buf[4];
|
png_byte buf[32];
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
|
||||||
#endif
|
#endif
|
||||||
@ -756,62 +756,46 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
png_crc_read(png_ptr, buf, 32);
|
||||||
|
if (png_crc_finish(png_ptr, 0))
|
||||||
|
return;
|
||||||
|
|
||||||
uint_x = png_get_uint_32(buf);
|
uint_x = png_get_uint_32(buf);
|
||||||
|
uint_y = png_get_uint_32(buf + 4);
|
||||||
png_crc_read(png_ptr, buf, 4);
|
|
||||||
uint_y = png_get_uint_32(buf);
|
|
||||||
|
|
||||||
if (uint_x > 80000L || uint_y > 80000L ||
|
if (uint_x > 80000L || uint_y > 80000L ||
|
||||||
uint_x + uint_y > 100000L)
|
uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM white point");
|
png_warning(png_ptr, "Invalid cHRM white point");
|
||||||
png_crc_finish(png_ptr, 24);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int_x_white = (png_fixed_point)uint_x;
|
int_x_white = (png_fixed_point)uint_x;
|
||||||
int_y_white = (png_fixed_point)uint_y;
|
int_y_white = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
uint_x = png_get_uint_32(buf + 8);
|
||||||
uint_x = png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf + 12);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
|
||||||
uint_y = png_get_uint_32(buf);
|
|
||||||
|
|
||||||
if (uint_x + uint_y > 100000L)
|
if (uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM red point");
|
png_warning(png_ptr, "Invalid cHRM red point");
|
||||||
png_crc_finish(png_ptr, 16);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int_x_red = (png_fixed_point)uint_x;
|
int_x_red = (png_fixed_point)uint_x;
|
||||||
int_y_red = (png_fixed_point)uint_y;
|
int_y_red = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
uint_x = png_get_uint_32(buf + 16);
|
||||||
uint_x = png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf + 20);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
|
||||||
uint_y = png_get_uint_32(buf);
|
|
||||||
|
|
||||||
if (uint_x + uint_y > 100000L)
|
if (uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM green point");
|
png_warning(png_ptr, "Invalid cHRM green point");
|
||||||
png_crc_finish(png_ptr, 8);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int_x_green = (png_fixed_point)uint_x;
|
int_x_green = (png_fixed_point)uint_x;
|
||||||
int_y_green = (png_fixed_point)uint_y;
|
int_y_green = (png_fixed_point)uint_y;
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
uint_x = png_get_uint_32(buf + 24);
|
||||||
uint_x = png_get_uint_32(buf);
|
uint_y = png_get_uint_32(buf + 28);
|
||||||
|
|
||||||
png_crc_read(png_ptr, buf, 4);
|
|
||||||
uint_y = png_get_uint_32(buf);
|
|
||||||
|
|
||||||
if (uint_x + uint_y > 100000L)
|
if (uint_x + uint_y > 100000L)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid cHRM blue point");
|
png_warning(png_ptr, "Invalid cHRM blue point");
|
||||||
png_crc_finish(png_ptr, 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int_x_blue = (png_fixed_point)uint_x;
|
int_x_blue = (png_fixed_point)uint_x;
|
||||||
@ -829,7 +813,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_sRGB_SUPPORTED)
|
#if defined(PNG_READ_sRGB_SUPPORTED)
|
||||||
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
|
if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB))
|
||||||
{
|
{
|
||||||
if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) ||
|
if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) ||
|
||||||
PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) ||
|
PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) ||
|
||||||
@ -840,7 +824,6 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) ||
|
PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) ||
|
||||||
PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000))
|
PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000))
|
||||||
{
|
{
|
||||||
|
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Ignoring incorrect cHRM value when sRGB is also present");
|
"Ignoring incorrect cHRM value when sRGB is also present");
|
||||||
#ifndef PNG_NO_CONSOLE_IO
|
#ifndef PNG_NO_CONSOLE_IO
|
||||||
@ -857,7 +840,6 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#endif
|
||||||
#endif /* PNG_NO_CONSOLE_IO */
|
#endif /* PNG_NO_CONSOLE_IO */
|
||||||
}
|
}
|
||||||
png_crc_finish(png_ptr, 0);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_sRGB_SUPPORTED */
|
#endif /* PNG_READ_sRGB_SUPPORTED */
|
||||||
@ -871,8 +853,6 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
int_x_white, int_y_white, int_x_red, int_y_red, int_x_green,
|
int_x_white, int_y_white, int_x_red, int_y_red, int_x_green,
|
||||||
int_y_green, int_x_blue, int_y_blue);
|
int_y_green, int_x_blue, int_y_blue);
|
||||||
#endif
|
#endif
|
||||||
if (png_crc_finish(png_ptr, 0))
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BIN
pngtest.png
BIN
pngtest.png
Binary file not shown.
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
91
pngwutil.c
91
pngwutil.c
@ -49,6 +49,23 @@ png_save_uint_16(png_bytep buf, unsigned int i)
|
|||||||
buf[1] = (png_byte)(i & 0xff);
|
buf[1] = (png_byte)(i & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Simple function to write the signature. If we have already written
|
||||||
|
* the magic bytes of the signature, or more likely, the PNG stream is
|
||||||
|
* being embedded into another stream and doesn't need its own signature,
|
||||||
|
* we should call png_set_sig_bytes() to tell libpng how many of the
|
||||||
|
* bytes have already been written.
|
||||||
|
*/
|
||||||
|
void PNGAPI
|
||||||
|
png_write_sig(png_structp png_ptr)
|
||||||
|
{
|
||||||
|
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||||
|
/* 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);
|
||||||
|
if(png_ptr->sig_bytes < 3)
|
||||||
|
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Write a PNG chunk all at once. The type is an array of ASCII characters
|
/* Write a PNG chunk all at once. The type is an array of ASCII characters
|
||||||
* representing the chunk name. The array must be at least 4 bytes in
|
* representing the chunk name. The array must be at least 4 bytes in
|
||||||
* length, and does not need to be null terminated. To be safe, pass the
|
* length, and does not need to be null terminated. To be safe, pass the
|
||||||
@ -117,23 +134,6 @@ png_write_chunk_end(png_structp png_ptr)
|
|||||||
png_write_data(png_ptr, buf, (png_size_t)4);
|
png_write_data(png_ptr, buf, (png_size_t)4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simple function to write the signature. If we have already written
|
|
||||||
* the magic bytes of the signature, or more likely, the PNG stream is
|
|
||||||
* being embedded into another stream and doesn't need its own signature,
|
|
||||||
* we should call png_set_sig_bytes() to tell libpng how many of the
|
|
||||||
* bytes have already been written.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_write_sig(png_structp png_ptr)
|
|
||||||
{
|
|
||||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
|
||||||
/* 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);
|
|
||||||
if(png_ptr->sig_bytes < 3)
|
|
||||||
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
|
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
|
||||||
/*
|
/*
|
||||||
* This pair of functions encapsulates the operation of (a) compressing a
|
* This pair of functions encapsulates the operation of (a) compressing a
|
||||||
@ -1572,34 +1572,36 @@ png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
|
|||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
PNG_sCAL;
|
PNG_sCAL;
|
||||||
#endif
|
#endif
|
||||||
|
char buf[64];
|
||||||
png_size_t total_len;
|
png_size_t total_len;
|
||||||
char wbuf[32], hbuf[32];
|
|
||||||
png_byte bunit = (png_byte)unit;
|
|
||||||
|
|
||||||
png_debug(1, "in png_write_sCAL\n");
|
png_debug(1, "in png_write_sCAL\n");
|
||||||
|
|
||||||
|
buf[0] = (char)unit;
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE)
|
||||||
/* sprintf() function is not supported on WindowsCE */
|
/* sprintf() function is not supported on WindowsCE */
|
||||||
{
|
{
|
||||||
wchar_t wc_buf[32];
|
wchar_t wc_buf[32];
|
||||||
|
size_t wc_len;
|
||||||
swprintf(wc_buf, TEXT("%12.12e"), width);
|
swprintf(wc_buf, TEXT("%12.12e"), width);
|
||||||
WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, wbuf, 32, NULL, NULL);
|
wc_len = wcslen(wc_buf);
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + 1, wc_len, NULL, NULL);
|
||||||
|
total_len = wc_len + 2;
|
||||||
swprintf(wc_buf, TEXT("%12.12e"), height);
|
swprintf(wc_buf, TEXT("%12.12e"), height);
|
||||||
WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, hbuf, 32, NULL, NULL);
|
wc_len = wcslen(wc_buf);
|
||||||
|
WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + total_len, wc_len,
|
||||||
|
NULL, NULL);
|
||||||
|
total_len += wc_len;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sprintf(wbuf, "%12.12e", width);
|
sprintf(buf + 1, "%12.12e", width);
|
||||||
sprintf(hbuf, "%12.12e", height);
|
total_len = 1 + png_strlen(buf + 1) + 1;
|
||||||
|
sprintf(buf + total_len, "%12.12e", height);
|
||||||
|
total_len += png_strlen(buf + total_len);
|
||||||
#endif
|
#endif
|
||||||
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
|
||||||
|
|
||||||
png_debug1(3, "sCAL total length = %d\n", (int)total_len);
|
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
|
||||||
png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len);
|
png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len);
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)&bunit, 1);
|
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1);
|
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)hbuf, png_strlen(hbuf));
|
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
@ -1610,23 +1612,26 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
|
|||||||
#ifdef PNG_USE_LOCAL_ARRAYS
|
#ifdef PNG_USE_LOCAL_ARRAYS
|
||||||
PNG_sCAL;
|
PNG_sCAL;
|
||||||
#endif
|
#endif
|
||||||
png_size_t total_len;
|
png_byte buf[64];
|
||||||
char wbuf[32], hbuf[32];
|
png_size_t wlen, hlen, total_len;
|
||||||
png_byte bunit = unit;
|
|
||||||
|
|
||||||
png_debug(1, "in png_write_sCAL_s\n");
|
png_debug(1, "in png_write_sCAL_s\n");
|
||||||
|
|
||||||
png_strcpy(wbuf,(const char *)width);
|
wlen = png_strlen(width);
|
||||||
png_strcpy(hbuf,(const char *)height);
|
hlen = png_strlen(height);
|
||||||
total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
|
total_len = wlen + hlen + 2;
|
||||||
|
if (total_len > 64)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Can't write sCAL (buffer too small)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
png_debug1(3, "sCAL total length = %d\n", total_len);
|
buf[0] = (png_byte)unit;
|
||||||
png_write_chunk_start(png_ptr, (png_bytep)png_sCAL, (png_uint_32)total_len);
|
png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)&bunit, 1);
|
png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)wbuf, png_strlen(wbuf)+1);
|
|
||||||
png_write_chunk_data(png_ptr, (png_bytep)hbuf, png_strlen(hbuf));
|
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
|
||||||
|
png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
0
scripts/libpng-config-body.in
Executable file → Normal file
0
scripts/libpng-config-body.in
Executable file → Normal file
@ -18,13 +18,16 @@ CDEBUG = -g -DPNG_DEBUG=5
|
|||||||
LDDEBUG =
|
LDDEBUG =
|
||||||
CRELEASE = -O2
|
CRELEASE = -O2
|
||||||
LDRELEASE = -s
|
LDRELEASE = -s
|
||||||
CFLAGS = -I$(ZLIBINC) -Wall $(CRELEASE)
|
#CFLAGS = -Wall $(CDEBUG)
|
||||||
LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm $(LDRELEASE)
|
CFLAGS = -Wall $(CRELEASE)
|
||||||
|
#LDFLAGS = $(LDDEBUG)
|
||||||
|
LDFLAGS = $(LDRELEASE)
|
||||||
|
LIBS = -lz -lm
|
||||||
|
|
||||||
# File extensions
|
# File extensions
|
||||||
O=.o
|
O=.o
|
||||||
A=.a
|
A=.a
|
||||||
E=
|
EXE=
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||||
@ -32,20 +35,30 @@ OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
|||||||
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
all: libpng$(A) pngtest$(E)
|
all: static
|
||||||
|
|
||||||
|
.c$(O):
|
||||||
|
$(CC) -c $(CFLAGS) -I$(ZLIBINC) $<
|
||||||
|
|
||||||
|
static: libpng$(A) pngtest$(EXE)
|
||||||
|
|
||||||
|
shared:
|
||||||
|
@echo This is a generic makefile that cannot create shared libraries.
|
||||||
|
@echo Please use a configuration that is specific to your platform.
|
||||||
|
@false
|
||||||
|
|
||||||
libpng$(A): $(OBJS)
|
libpng$(A): $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
|
||||||
test: pngtest$(E)
|
test: pngtest$(EXE)
|
||||||
./pngtest$(E)
|
./pngtest$(EXE)
|
||||||
|
|
||||||
pngtest$(E): pngtest$(O) libpng$(A)
|
pngtest$(EXE): pngtest$(O) libpng$(A)
|
||||||
$(LD) -o $@ pngtest$(O) $(LDFLAGS)
|
$(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest$(O) libpng$(A) $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM_F) *$(O) libpng$(A) pngtest$(E) pngout.png
|
$(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png
|
||||||
|
|
||||||
png$(O): png.h pngconf.h
|
png$(O): png.h pngconf.h
|
||||||
pngerror$(O): png.h pngconf.h
|
pngerror$(O): png.h pngconf.h
|
||||||
|
0
scripts/makevms.com
Normal file → Executable file
0
scripts/makevms.com
Normal file → Executable file
@ -223,6 +223,9 @@ EXPORTS
|
|||||||
png_get_uint_31
|
png_get_uint_31
|
||||||
png_set_expand_gray_1_2_4_to_8
|
png_set_expand_gray_1_2_4_to_8
|
||||||
|
|
||||||
|
; Added at version 1.2.11
|
||||||
|
png_write_sig
|
||||||
|
|
||||||
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
|
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
|
||||||
png_libpng_ver
|
png_libpng_ver
|
||||||
png_pass_start
|
png_pass_start
|
||||||
|
@ -234,3 +234,5 @@ EXPORTS
|
|||||||
png_save_int_32 @205
|
png_save_int_32 @205
|
||||||
png_get_uint_31 @206
|
png_get_uint_31 @206
|
||||||
png_set_expand_gray_1_2_4_to_8 @207
|
png_set_expand_gray_1_2_4_to_8 @207
|
||||||
|
; Added at version 1.2.11
|
||||||
|
png_write_sig @208
|
||||||
|
Reference in New Issue
Block a user