*** ../lpng106/png.h	Tue Mar 21 06:13:03 2000
--- png.h	Wed Mar 22 19:28:08 2000
***************
*** 651,663 ****
  #ifdef PNG_FLOATING_POINT_SUPPORTED
     double scal_pixel_width;    /* width of one pixel */
     double scal_pixel_height;   /* height of one pixel */
! #else
  #ifdef PNG_FIXED_POINT_SUPPORTED
     png_charp scal_s_width;     /* string containing height */
     png_charp scal_s_height;    /* string containing width */
  #endif
  #endif
- #endif
  
  #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
     /* storage for unknown chunks that the library doesn't recognize. */
--- 651,662 ----
  #ifdef PNG_FLOATING_POINT_SUPPORTED
     double scal_pixel_width;    /* width of one pixel */
     double scal_pixel_height;   /* height of one pixel */
! #endif
  #ifdef PNG_FIXED_POINT_SUPPORTED
     png_charp scal_s_width;     /* string containing height */
     png_charp scal_s_height;    /* string containing width */
  #endif
  #endif
  
  #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
     /* storage for unknown chunks that the library doesn't recognize. */
***************
*** 2304,2310 ****
      defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED)
  PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
     int comp_type, png_charp chunkdata, png_size_t chunklength,
!    png_size_t prefix_size));
  #endif
  
  /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
--- 2303,2309 ----
      defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_sPLT_SUPPORTED)
  PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
     int comp_type, png_charp chunkdata, png_size_t chunklength,
!    png_size_t prefix_size, png_size_t *data_size));
  #endif
  
  /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
***************
*** 2468,2474 ****
  #endif
  
  #if defined(PNG_WRITE_sCAL_SUPPORTED)
! #ifdef PNG_FLOATING_POINT_SUPPORTED
  PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
     int unit, double width, double height));
  #else
--- 2467,2473 ----
  #endif
  
  #if defined(PNG_WRITE_sCAL_SUPPORTED)
! #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
  PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
     int unit, double width, double height));
  #else
*** ../lpng106/pngrutil.c	Tue Mar 21 06:13:04 2000
--- pngrutil.c	Fri Mar 24 19:29:29 2000
***************
*** 143,149 ****
   */
  png_charp png_decompress_chunk(png_structp png_ptr, int comp_type,
                                png_charp chunkdata, png_size_t chunklength,
!                               png_size_t prefix_size)
  {
     static char msg[] = "Error decoding compressed text";
     png_charp text = NULL;
--- 143,149 ----
   */
  png_charp png_decompress_chunk(png_structp png_ptr, int comp_type,
                                png_charp chunkdata, png_size_t chunklength,
!                               png_size_t prefix_size, png_size_t *newlength)
  {
     static char msg[] = "Error decoding compressed text";
     png_charp text = NULL;
***************
*** 227,232 ****
--- 227,233 ----
  
        png_free(png_ptr, chunkdata);
        chunkdata = text;
+       *newlength=text_size;
     }
     else /* if (comp_type >= PNG_TEXT_COMPRESSION_LAST) */
     {
***************
*** 889,895 ****
     png_byte compression_type;
     png_charp profile;
     png_uint_32 skip = 0;
!    png_size_t slength, prefix_length;
  
     png_debug(1, "in png_handle_iCCP\n");
  
--- 890,896 ----
     png_byte compression_type;
     png_charp profile;
     png_uint_32 skip = 0;
!    png_size_t slength, prefix_length, data_length;
  
     png_debug(1, "in png_handle_iCCP\n");
  
***************
*** 951,960 ****
  
     prefix_length = profile - chunkdata;
     chunkdata = png_decompress_chunk(png_ptr, compression_type, chunkdata,
!                                     slength, prefix_length);
  
     png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type,
!                 chunkdata + prefix_length, png_strlen(chunkdata + prefix_length));
     png_free(png_ptr, chunkdata);
  }
  #endif /* PNG_READ_iCCP_SUPPORTED */
--- 952,961 ----
  
     prefix_length = profile - chunkdata;
     chunkdata = png_decompress_chunk(png_ptr, compression_type, chunkdata,
!                                     slength, prefix_length, &data_length);
  
     png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type,
!                 chunkdata + prefix_length, data_length);
     png_free(png_ptr, chunkdata);
  }
  #endif /* PNG_READ_iCCP_SUPPORTED */
***************
*** 1722,1728 ****
     png_charp chunkdata;
     png_charp text;
     int comp_type;
!    png_size_t slength, prefix_len;
  
     png_debug(1, "in png_handle_zTXt\n");
     if (!(png_ptr->mode & PNG_HAVE_IHDR))
--- 1723,1729 ----
     png_charp chunkdata;
     png_charp text;
     int comp_type;
!    png_size_t slength, prefix_len, data_len;
  
     png_debug(1, "in png_handle_zTXt\n");
     if (!(png_ptr->mode & PNG_HAVE_IHDR))
***************
*** 1770,1776 ****
     prefix_len = text - chunkdata;
  
     chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata,
!                                     (png_size_t)length, prefix_len);
  
     text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
     text_ptr->compression = comp_type;
--- 1771,1777 ----
     prefix_len = text - chunkdata;
  
     chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata,
!                                     (png_size_t)length, prefix_len, &data_len);
  
     text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
     text_ptr->compression = comp_type;
***************
*** 1778,1784 ****
     text_ptr->key = chunkdata;
     text_ptr->lang_key = NULL;
     text_ptr->text = chunkdata + prefix_len;
!    text_ptr->text_length = png_strlen(text);
     text_ptr->itxt_length = 0;
  
     png_set_text(png_ptr, info_ptr, text_ptr, 1);
--- 1779,1785 ----
     text_ptr->key = chunkdata;
     text_ptr->lang_key = NULL;
     text_ptr->text = chunkdata + prefix_len;
!    text_ptr->text_length = data_len;
     text_ptr->itxt_length = 0;
  
     png_set_text(png_ptr, info_ptr, text_ptr, 1);
***************
*** 1798,1804 ****
     png_charp key, lang, text, lang_key;
     int comp_flag;
     int comp_type = 0;
!    png_size_t slength, prefix_len;
  
     png_debug(1, "in png_handle_iTXt\n");
  
--- 1799,1805 ----
     png_charp key, lang, text, lang_key;
     int comp_flag;
     int comp_type = 0;
!    png_size_t slength, prefix_len, data_len;
  
     png_debug(1, "in png_handle_iTXt\n");
  
***************
*** 1862,1868 ****
     key=chunkdata;
     if (comp_flag)
         chunkdata = png_decompress_chunk(png_ptr, comp_type, chunkdata,
!           (size_t)length, prefix_len);
     text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
     text_ptr->compression = (int)comp_flag + 1;
     text_ptr->lang_key = chunkdata+(lang_key-key);
--- 1863,1871 ----
     key=chunkdata;
     if (comp_flag)
         chunkdata = png_decompress_chunk(png_ptr, comp_type, chunkdata,
!           (size_t)length, prefix_len, &data_len);
!    else
!        data_len=png_strlen(chunkdata + prefix_len);
     text_ptr = (png_textp)png_malloc(png_ptr, (png_uint_32)sizeof(png_text));
     text_ptr->compression = (int)comp_flag + 1;
     text_ptr->lang_key = chunkdata+(lang_key-key);
***************
*** 1870,1876 ****
     text_ptr->key = chunkdata;
     text_ptr->text = chunkdata + prefix_len;
     text_ptr->text_length = 0;
!    text_ptr->itxt_length = png_strlen(text_ptr->text);
  
     png_set_text(png_ptr, info_ptr, text_ptr, 1);
  
--- 1873,1879 ----
     text_ptr->key = chunkdata;
     text_ptr->text = chunkdata + prefix_len;
     text_ptr->text_length = 0;
!    text_ptr->itxt_length = data_len;
  
     png_set_text(png_ptr, info_ptr, text_ptr, 1);
  
*** ../lpng106/pngwutil.c	Tue Mar 21 06:13:04 2000
--- pngwutil.c	Wed Mar 22 19:28:21 2000
***************
*** 795,801 ****
--- 795,803 ----
         white_x + white_y > 1.0)
     {
        png_warning(png_ptr, "Invalid cHRM white point specified");
+ #if !defined(PNG_NO_STDIO)
        printf("white_x=%f, white_y=%f\n",white_x, white_y);
+ #endif
        return;
     }
     itemp = (png_uint_32)(white_x * 100000.0 + 0.5);
***************
*** 856,862 ****
--- 858,866 ----
     if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L)
     {
        png_warning(png_ptr, "Invalid fixed cHRM white point specified");
+ #if !defined(PNG_NO_STDIO)
        printf("white_x=%ld, white_y=%ld\n",white_x, white_y);
+ #endif
        return;
     }
     png_save_uint_32(buf, white_x);
***************
*** 1381,1387 ****
  
  #if defined(PNG_WRITE_sCAL_SUPPORTED)
  /* write the sCAL chunk */
! #ifdef PNG_FLOATING_POINT_SUPPORTED
  void
  png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
  {
--- 1385,1391 ----
  
  #if defined(PNG_WRITE_sCAL_SUPPORTED)
  /* write the sCAL chunk */
! #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
  void
  png_write_sCAL(png_structp png_ptr, int unit, double width,double height)
  {
***************
*** 1417,1426 ****
     png_size_t total_len;
     char wbuf[32], hbuf[32];
  
!    png_debug(1, "in png_write_sCAL\n");
  
!    sprintf(wbuf, "%s", width);
!    sprintf(hbuf, "%s", height);
     total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
  
     png_debug1(3, "sCAL total length = %d\n", total_len);
--- 1421,1430 ----
     png_size_t total_len;
     char wbuf[32], hbuf[32];
  
!    png_debug(1, "in png_write_sCAL_s\n");
  
!    strcpy(wbuf,(const char *)width);
!    strcpy(hbuf,(const char *)height);
     total_len = 1 + png_strlen(wbuf)+1 + png_strlen(hbuf);
  
     png_debug1(3, "sCAL total length = %d\n", total_len);
*** ../lpng106/pngwrite.c	Tue Mar 21 06:13:04 2000
--- pngwrite.c	Wed Mar 22 19:28:31 2000
***************
*** 165,171 ****
  #endif
  #if defined(PNG_WRITE_sCAL_SUPPORTED)
     if (info_ptr->valid & PNG_INFO_sCAL)
! #ifdef PNG_FLOATING_POINT_SUPPORTED
        png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
            info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
  #else
--- 165,171 ----
  #endif
  #if defined(PNG_WRITE_sCAL_SUPPORTED)
     if (info_ptr->valid & PNG_INFO_sCAL)
! #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
        png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
            info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
  #else
***************
*** 172,177 ****
--- 172,180 ----
  #ifdef PNG_FIXED_POINT_SUPPORTED
        png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit,
            info_ptr->scal_s_width, info_ptr->scal_s_height);
+ #else
+       png_warning(png_ptr,
+           "png_write_sCAL not supported; sCAL chunk not written.\n");
  #endif
  #endif
  #endif
*** ../lpng106/libpng.3	Tue Mar 21 06:13:02 2000
--- libpng.3	Fri Mar 24 14:41:07 2000
***************
*** 2712,2741 ****
  It is also possible to individually free the info_ptr members that
  point to libpng-allocated storage with the following functions:
  
!     png_free_text(png_ptr, info_ptr, num)
!     num          - number of text item to be freed (-1 for all items)
  
-     png_free_hIST(png_ptr, info_ptr)
- 
-     png_free_iCCP(png_ptr, info_ptr)
- 
-     png_free_pCAL(png_ptr, info_ptr)
- 
-     png_free_sCAL(png_ptr, info_ptr)
- 
-     png_free_sPLT(png_ptr, info_ptr, num)
-     num          - number of suggested-paletted entry to be freed
-                    (-1 for all suggested palettes)
- 
-     png_free_pixels(png_ptr, info_ptr)
- 
-     png_free_unknown_chunk(png_ptr, info_ptr, num)
-     num          - number of unknown chunk entry to be freed
-                    (-1 for all suggested palettes)
- 
  These functions may be safely called when the relevant storage has
  already been freed, or has not yet been allocated, and will in that
! case do nothing.
  
  If you allocated data such as a palette that you passed in to libpng with
  png_set_*, you must not free it until just before the call to
--- 2712,2735 ----
  It is also possible to individually free the info_ptr members that
  point to libpng-allocated storage with the following functions:
  
!     png_free_data(png_ptr, info_ptr, mask, n)
!     mask         - identifies data to be freed, a mask
!                    made up by the OR one or more of
!                    PNG_FREE_PLTE, PNG_FREE_TRNS,
!                    PNG_FREE_HIST, PNG_FREE_ICCP,
!                    PNG_FREE_SPLT, PNG_FREE_ROWS,
!                    PNG_FREE_PCAL, PNG_FREE_SCAL,
!                    PNG_FREE_TEXT, PNG_FREE_UNKN,
!                    or simply PNG_FREE_ALL
!     n            - sequence number of item to be freed
!                    (-1 for all items)
  
  These functions may be safely called when the relevant storage has
  already been freed, or has not yet been allocated, and will in that
! case do nothing.  The "n" parameter is ignored if only one item
! of the selected data type, such as PLTE, is allowed.  If "n" is not
! -1, and multiple items are allowed for the data type identified in
! the mask, such as text or splt, only the n'th item is freed.
  
  If you allocated data such as a palette that you passed in to libpng with
  png_set_*, you must not free it until just before the call to
*** ../lpng106/libpng.txt	Tue Mar 21 06:13:03 2000
--- libpng.txt	Fri Mar 24 14:41:26 2000
***************
*** 1999,2028 ****
  It is also possible to individually free the info_ptr members that
  point to libpng-allocated storage with the following functions:
  
!     png_free_text(png_ptr, info_ptr, num)
!     num          - number of text item to be freed (-1 for all items)
  
-     png_free_hIST(png_ptr, info_ptr)
- 
-     png_free_iCCP(png_ptr, info_ptr)
- 
-     png_free_pCAL(png_ptr, info_ptr)
- 
-     png_free_sCAL(png_ptr, info_ptr)
- 
-     png_free_sPLT(png_ptr, info_ptr, num)
-     num          - number of suggested-paletted entry to be freed
-                    (-1 for all suggested palettes)
- 
-     png_free_pixels(png_ptr, info_ptr)
- 
-     png_free_unknown_chunk(png_ptr, info_ptr, num)
-     num          - number of unknown chunk entry to be freed
-                    (-1 for all suggested palettes)
- 
  These functions may be safely called when the relevant storage has
  already been freed, or has not yet been allocated, and will in that
! case do nothing.
  
  If you allocated data such as a palette that you passed in to libpng with
  png_set_*, you must not free it until just before the call to
--- 1999,2022 ----
  It is also possible to individually free the info_ptr members that
  point to libpng-allocated storage with the following functions:
  
!     png_free_data(png_ptr, info_ptr, mask, n)
!     mask         - identifies data to be freed, a mask
!                    made up by the OR one or more of
!                    PNG_FREE_PLTE, PNG_FREE_TRNS,
!                    PNG_FREE_HIST, PNG_FREE_ICCP,
!                    PNG_FREE_SPLT, PNG_FREE_ROWS,
!                    PNG_FREE_PCAL, PNG_FREE_SCAL,
!                    PNG_FREE_TEXT, PNG_FREE_UNKN,
!                    or simply PNG_FREE_ALL
!     n            - sequence number of item to be freed
!                    (-1 for all items)
  
  These functions may be safely called when the relevant storage has
  already been freed, or has not yet been allocated, and will in that
! case do nothing.  The "n" parameter is ignored if only one item
! of the selected data type, such as PLTE, is allowed.  If "n" is not
! -1, and multiple items are allowed for the data type identified in
! the mask, such as text or splt, only the n'th item is freed.
  
  If you allocated data such as a palette that you passed in to libpng with
  png_set_*, you must not free it until just before the call to
