Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/libpng/pngtest.c

    r2 r561  
    22/* pngtest.c - a simple test program to test libpng
    33 *
    4  * Last changed in libpng 1.2.27 - [April 29, 2008]
    5  * For conditions of distribution and use, see copyright notice in png.h
    6  * Copyright (c) 1998-2008 Glenn Randers-Pehrson
     4 * Last changed in libpng 1.2.37 [June 4, 2009]
     5 * Copyright (c) 1998-2009 Glenn Randers-Pehrson
    76 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
    87 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
     8 *
     9 * This code is released under the libpng license.
     10 * For conditions of distribution and use, see the disclaimer
     11 * and license in png.h
    912 *
    1013 * This program reads in a PNG image, writes it out again, and then
     
    3841#  include <stdlib.h>
    3942#  define READFILE(file, data, length, check) \
    40      if (ReadFile(file, data, length, &check,NULL)) check = 0
     43     if (ReadFile(file, data, length, &check, NULL)) check = 0
    4144#  define WRITEFILE(file, data, length, check)) \
    4245     if (WriteFile(file, data, length, &check, NULL)) check = 0
     
    4649#  include <stdlib.h>
    4750#  define READFILE(file, data, length, check) \
    48      check=(png_size_t)fread(data,(png_size_t)1,length,file)
     51     check=(png_size_t)fread(data, (png_size_t)1, length, file)
    4952#  define WRITEFILE(file, data, length, check) \
    50      check=(png_size_t)fwrite(data,(png_size_t)1, length, file)
     53     check=(png_size_t)fwrite(data, (png_size_t)1, length, file)
    5154#  define FCLOSE(file) fclose(file)
    5255#endif
     
    6669
    6770#if !PNG_DEBUG
    68 #  define SINGLE_ROWBUF_ALLOC  /* makes buffer overruns easier to nail */
     71#  define SINGLE_ROWBUF_ALLOC  /* Makes buffer overruns easier to nail */
    6972#endif
    7073
     
    8386
    8487#if defined(PNG_TIME_RFC1123_SUPPORTED)
    85 #define PNG_tIME_STRING_LENGTH 30
    86 static int tIME_chunk_present=0;
    87 static char tIME_string[PNG_tIME_STRING_LENGTH] = "no tIME chunk present in file";
     88#define PNG_tIME_STRING_LENGTH 29
     89static int tIME_chunk_present = 0;
     90static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
    8891#endif
    8992
     
    9699#endif
    97100
    98 /* defined so I can write to a file on gui/windowing platforms */
     101/* Defined so I can write to a file on gui/windowing platforms */
    99102/*  #define STDERR stderr  */
    100 #define STDERR stdout   /* for DOS */
    101 
    102 /* example of using row callbacks to make a simple progress meter */
    103 static int status_pass=1;
    104 static int status_dots_requested=0;
    105 static int status_dots=1;
     103#define STDERR stdout   /* For DOS */
    106104
    107105/* In case a system header (e.g., on AIX) defined jmpbuf */
     
    114112#  define png_jmpbuf(png_ptr) png_ptr->jmpbuf
    115113#endif
     114
     115/* Example of using row callbacks to make a simple progress meter */
     116static int status_pass = 1;
     117static int status_dots_requested = 0;
     118static int status_dots = 1;
    116119
    117120void
     
    126129read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
    127130{
    128     if(png_ptr == NULL || row_number > PNG_UINT_31_MAX) return;
    129     if(status_pass != pass)
    130     {
    131        fprintf(stdout,"\n Pass %d: ",pass);
    132        status_pass = pass;
    133        status_dots = 31;
    134     }
    135     status_dots--;
    136     if(status_dots == 0)
    137     {
    138        fprintf(stdout, "\n         ");
    139        status_dots=30;
    140     }
    141     fprintf(stdout, "r");
     131   if (png_ptr == NULL || row_number > PNG_UINT_31_MAX)
     132      return;
     133   if (status_pass != pass)
     134   {
     135      fprintf(stdout, "\n Pass %d: ", pass);
     136      status_pass = pass;
     137      status_dots = 31;
     138   }
     139   status_dots--;
     140   if (status_dots == 0)
     141   {
     142      fprintf(stdout, "\n         ");
     143      status_dots=30;
     144   }
     145   fprintf(stdout, "r");
    142146}
    143147
     
    153157write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
    154158{
    155     if(png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) return;
    156     fprintf(stdout, "w");
     159   if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7)
     160      return;
     161   fprintf(stdout, "w");
    157162}
    158163
     
    160165#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
    161166/* Example of using user transform callback (we don't transform anything,
    162    but merely examine the row filters.  We set this to 256 rather than
    163    5 in case illegal filter values are present.) */
     167 * but merely examine the row filters.  We set this to 256 rather than
     168 * 5 in case illegal filter values are present.)
     169 */
    164170static png_uint_32 filters_used[256];
    165171void
     
    174180count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
    175181{
    176     if(png_ptr != NULL && row_info != NULL)
    177       ++filters_used[*(data-1)];
     182   if (png_ptr != NULL && row_info != NULL)
     183      ++filters_used[*(data - 1)];
    178184}
    179185#endif
    180186
    181187#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
    182 /* example of using user transform callback (we don't transform anything,
    183    but merely count the zero samples) */
     188/* Example of using user transform callback (we don't transform anything,
     189 * but merely count the zero samples)
     190 */
    184191
    185192static png_uint_32 zero_samples;
     
    197204{
    198205   png_bytep dp = data;
    199    if(png_ptr == NULL)return;
    200 
    201    /* contents of row_info:
     206   if (png_ptr == NULL)return;
     207
     208   /* Contents of row_info:
    202209    *  png_uint_32 width      width of row
    203210    *  png_uint_32 rowbytes   number of bytes in row
     
    208215    */
    209216
    210 
    211     /* counts the number of zero samples (or zero pixels if color_type is 3 */
    212 
    213     if(row_info->color_type == 0 || row_info->color_type == 3)
     217    /* Counts the number of zero samples (or zero pixels if color_type is 3 */
     218
     219    if (row_info->color_type == 0 || row_info->color_type == 3)
    214220    {
    215        int pos=0;
     221       int pos = 0;
    216222       png_uint_32 n, nstop;
    217        for (n=0, nstop=row_info->width; n<nstop; n++)
     223       for (n = 0, nstop=row_info->width; n<nstop; n++)
    218224       {
    219           if(row_info->bit_depth == 1)
     225          if (row_info->bit_depth == 1)
    220226          {
    221              if(((*dp << pos++ ) & 0x80) == 0) zero_samples++;
    222              if(pos == 8)
     227             if (((*dp << pos++ ) & 0x80) == 0)
     228                zero_samples++;
     229             if (pos == 8)
    223230             {
    224231                pos = 0;
     
    226233             }
    227234          }
    228           if(row_info->bit_depth == 2)
     235          if (row_info->bit_depth == 2)
    229236          {
    230              if(((*dp << (pos+=2)) & 0xc0) == 0) zero_samples++;
    231              if(pos == 8)
     237             if (((*dp << (pos+=2)) & 0xc0) == 0)
     238                zero_samples++;
     239             if (pos == 8)
    232240             {
    233241                pos = 0;
     
    235243             }
    236244          }
    237           if(row_info->bit_depth == 4)
     245          if (row_info->bit_depth == 4)
    238246          {
    239              if(((*dp << (pos+=4)) & 0xf0) == 0) zero_samples++;
    240              if(pos == 8)
     247             if (((*dp << (pos+=4)) & 0xf0) == 0)
     248                zero_samples++;
     249             if (pos == 8)
    241250             {
    242251                pos = 0;
     
    244253             }
    245254          }
    246           if(row_info->bit_depth == 8)
    247              if(*dp++ == 0) zero_samples++;
    248           if(row_info->bit_depth == 16)
     255          if (row_info->bit_depth == 8)
     256             if (*dp++ == 0)
     257                zero_samples++;
     258          if (row_info->bit_depth == 16)
    249259          {
    250              if((*dp | *(dp+1)) == 0) zero_samples++;
     260             if ((*dp | *(dp+1)) == 0)
     261                zero_samples++;
    251262             dp+=2;
    252263          }
    253264       }
    254265    }
    255     else /* other color types */
     266    else /* Other color types */
    256267    {
    257268       png_uint_32 n, nstop;
    258269       int channel;
    259270       int color_channels = row_info->channels;
    260        if(row_info->color_type > 3)color_channels--;
    261 
    262        for (n=0, nstop=row_info->width; n<nstop; n++)
     271       if (row_info->color_type > 3)color_channels--;
     272
     273       for (n = 0, nstop=row_info->width; n<nstop; n++)
    263274       {
    264275          for (channel = 0; channel < color_channels; channel++)
    265276          {
    266              if(row_info->bit_depth == 8)
    267                 if(*dp++ == 0) zero_samples++;
    268              if(row_info->bit_depth == 16)
     277             if (row_info->bit_depth == 8)
     278                if (*dp++ == 0)
     279                   zero_samples++;
     280             if (row_info->bit_depth == 16)
    269281             {
    270                 if((*dp | *(dp+1)) == 0) zero_samples++;
     282                if ((*dp | *(dp+1)) == 0)
     283                   zero_samples++;
    271284                dp+=2;
    272285             }
    273286          }
    274           if(row_info->color_type > 3)
     287          if (row_info->color_type > 3)
    275288          {
    276289             dp++;
    277              if(row_info->bit_depth == 16)dp++;
     290             if (row_info->bit_depth == 16)
     291                dp++;
    278292          }
    279293       }
     
    286300#if defined(PNG_NO_STDIO)
    287301/* START of code to validate stdio-free compilation */
    288 /* These copies of the default read/write functions come from pngrio.c and */
    289 /* pngwio.c.  They allow "don't include stdio" testing of the library. */
    290 /* This is the function that does the actual reading of data.  If you are
    291    not reading from a standard C stream, you should create a replacement
    292    read_data function and use it at run time with png_set_read_fn(), rather
    293    than changing the library. */
     302/* These copies of the default read/write functions come from pngrio.c and
     303 * pngwio.c.  They allow "don't include stdio" testing of the library.
     304 * This is the function that does the actual reading of data.  If you are
     305 * not reading from a standard C stream, you should create a replacement
     306 * read_data function and use it at run time with png_set_read_fn(), rather
     307 * than changing the library.
     308 */
    294309
    295310#ifndef USE_FAR_KEYWORD
     
    310325}
    311326#else
    312 /* this is the model-independent version. Since the standard I/O library
     327/* This is the model-independent version. Since the standard I/O library
    313328   can't handle far buffers in the medium and small models, we have to copy
    314329   the data.
     
    342357         read = MIN(NEAR_BUF_SIZE, remaining);
    343358         READFILE(io_ptr, buf, 1, err);
    344          png_memcpy(data, buf, read); /* copy far buffer to near buffer */
    345          if(err != read)
     359         png_memcpy(data, buf, read); /* Copy far buffer to near buffer */
     360         if (err != read)
    346361            break;
    347362         else
     
    353368   }
    354369   if (check != length)
    355    {
    356370      png_error(png_ptr, "read Error");
    357    }
    358371}
    359372#endif /* USE_FAR_KEYWORD */
     
    363376pngtest_flush(png_structp png_ptr)
    364377{
    365 #if !defined(_WIN32_WCE)
    366    png_FILE_p io_ptr;
    367    io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
    368    if (io_ptr != NULL)
    369       fflush(io_ptr);
    370 #endif
     378   /* Do nothing; fflush() is said to be just a waste of energy. */
     379   png_ptr = png_ptr;  /* Stifle compiler warning */
    371380}
    372381#endif
    373382
    374383/* This is the function that does the actual writing of data.  If you are
    375    not writing to a standard C stream, you should create a replacement
    376    write_data function and use it at run time with png_set_write_fn(), rather
    377    than changing the library. */
     384 * not writing to a standard C stream, you should create a replacement
     385 * write_data function and use it at run time with png_set_write_fn(), rather
     386 * than changing the library.
     387 */
    378388#ifndef USE_FAR_KEYWORD
    379389static void
     
    389399}
    390400#else
    391 /* this is the model-independent version. Since the standard I/O library
     401/* This is the model-independent version. Since the standard I/O library
    392402   can't handle far buffers in the medium and small models, we have to copy
    393403   the data.
     
    420430      {
    421431         written = MIN(NEAR_BUF_SIZE, remaining);
    422          png_memcpy(buf, data, written); /* copy far buffer to near buffer */
     432         png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
    423433         WRITEFILE(io_ptr, buf, written, err);
    424434         if (err != written)
     
    437447}
    438448#endif /* USE_FAR_KEYWORD */
    439 #endif /* PNG_NO_STDIO */
    440 /* END of code to validate stdio-free compilation */
    441449
    442450/* This function is called when there is a warning, but the library thinks
     
    464472   pngtest_warning(png_ptr, message);
    465473   /* We can return because png_error calls the default handler, which is
    466     * actually OK in this case. */
     474    * actually OK in this case.
     475    */
    467476}
     477#endif /* PNG_NO_STDIO */
     478/* END of code to validate stdio-free compilation */
    468479
    469480/* START of code to validate memory allocation and deallocation */
     
    471482
    472483/* Allocate memory.  For reasonable files, size should never exceed
    473    64K.  However, zlib may allocate more then 64K if you don't tell
    474    it not to.  See zconf.h and png.h for more information.  zlib does
    475    need to allocate exactly 64K, so whatever you call here must
    476    have the ability to do that.
    477 
    478    This piece of code can be compiled to validate max 64K allocations
    479    by setting MAXSEG_64K in zlib zconf.h *or* PNG_MAX_MALLOC_64K. */
     484 * 64K.  However, zlib may allocate more then 64K if you don't tell
     485 * it not to.  See zconf.h and png.h for more information.  zlib does
     486 * need to allocate exactly 64K, so whatever you call here must
     487 * have the ability to do that.
     488 *
     489 * This piece of code can be compiled to validate max 64K allocations
     490 * by setting MAXSEG_64K in zlib zconf.h *or* PNG_MAX_MALLOC_64K.
     491 */
    480492typedef struct memory_information
    481493{
     
    500512
    501513   /* png_malloc has already tested for NULL; png_create_struct calls
    502       png_debug_malloc directly, with png_ptr == NULL which is OK */
     514    * png_debug_malloc directly, with png_ptr == NULL which is OK
     515    */
    503516
    504517   if (size == 0)
     
    512525      png_set_mem_fn(png_ptr, NULL, NULL, NULL);
    513526      pinfo = (memory_infop)png_malloc(png_ptr,
    514          (png_uint_32)png_sizeof (*pinfo));
     527         (png_uint_32)png_sizeof(*pinfo));
    515528      pinfo->size = size;
    516529      current_allocation += size;
     
    521534      pinfo->pointer = (png_voidp)png_malloc(png_ptr, size);
    522535      /* Restore malloc_fn and free_fn */
    523       png_set_mem_fn(png_ptr, png_voidp_NULL, (png_malloc_ptr)png_debug_malloc,
    524          (png_free_ptr)png_debug_free);
     536      png_set_mem_fn(png_ptr,
     537          png_voidp_NULL, (png_malloc_ptr)png_debug_malloc,
     538          (png_free_ptr)png_debug_free);
    525539      if (size != 0 && pinfo->pointer == NULL)
    526540      {
     
    534548      /* Make sure the caller isn't assuming zeroed memory. */
    535549      png_memset(pinfo->pointer, 0xdd, pinfo->size);
    536       if(verbose)
    537          printf("png_malloc %lu bytes at %x\n",(unsigned long)size,
    538           pinfo->pointer);
     550      if (verbose)
     551         printf("png_malloc %lu bytes at %x\n", (unsigned long)size,
     552            pinfo->pointer);
    539553      return (png_voidp)(pinfo->pointer);
    540554   }
     
    571585            png_memset(ptr, 0x55, pinfo->size);
    572586            png_free_default(png_ptr, pinfo);
    573             pinfo=NULL;
     587            pinfo = NULL;
    574588            break;
    575589         }
     
    584598
    585599   /* Finally free the data. */
    586    if(verbose)
    587       printf("Freeing %x\n",ptr);
     600   if (verbose)
     601      printf("Freeing %x\n", ptr);
    588602   png_free_default(png_ptr, ptr);
    589    ptr=NULL;
     603   ptr = NULL;
    590604}
    591605#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
    592606/* END of code to test memory allocation/deallocation */
     607
     608
     609/* Demonstration of user chunk support of the sTER and vpAg chunks */
     610#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
     611
     612/* (sTER is a public chunk not yet known by libpng.  vpAg is a private
     613chunk used in ImageMagick to store "virtual page" size).  */
     614
     615static png_uint_32 user_chunk_data[4];
     616
     617    /* 0: sTER mode + 1
     618     * 1: vpAg width
     619     * 2: vpAg height
     620     * 3: vpAg units
     621     */
     622
     623static int read_user_chunk_callback(png_struct *png_ptr,
     624   png_unknown_chunkp chunk)
     625{
     626   png_uint_32
     627     *my_user_chunk_data;
     628
     629   /* Return one of the following:
     630    *    return (-n);  chunk had an error
     631    *    return (0);  did not recognize
     632    *    return (n);  success
     633    *
     634    * The unknown chunk structure contains the chunk data:
     635    * png_byte name[5];
     636    * png_byte *data;
     637    * png_size_t size;
     638    *
     639    * Note that libpng has already taken care of the CRC handling.
     640    */
     641
     642   if (chunk->name[0] == 115 && chunk->name[1] ==  84 &&     /* s  T */
     643       chunk->name[2] ==  69 && chunk->name[3] ==  82)       /* E  R */
     644      {
     645         /* Found sTER chunk */
     646         if (chunk->size != 1)
     647            return (-1); /* Error return */
     648         if (chunk->data[0] != 0 && chunk->data[0] != 1)
     649            return (-1);  /* Invalid mode */
     650         my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
     651         my_user_chunk_data[0]=chunk->data[0]+1;
     652         return (1);
     653      }
     654
     655   if (chunk->name[0] != 118 || chunk->name[1] != 112 ||    /* v  p */
     656       chunk->name[2] !=  65 || chunk->name[3] != 103)      /* A  g */
     657      return (0); /* Did not recognize */
     658
     659   /* Found ImageMagick vpAg chunk */
     660
     661   if (chunk->size != 9)
     662      return (-1); /* Error return */
     663
     664   my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
     665
     666   my_user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data);
     667   my_user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4);
     668   my_user_chunk_data[3]=(png_uint_32)chunk->data[8];
     669
     670   return (1);
     671
     672}
     673#endif
     674/* END of code to demonstrate user chunk support */
    593675
    594676/* Test one file */
     
    650732   }
    651733
    652    png_debug(0, "Allocating read and write structures\n");
     734   png_debug(0, "Allocating read and write structures");
    653735#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
    654    read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
     736   read_ptr =
     737      png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
    655738      png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
    656739      (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
    657740#else
    658    read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
     741   read_ptr =
     742      png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
    659743      png_error_ptr_NULL, png_error_ptr_NULL);
    660744#endif
     745#if defined(PNG_NO_STDIO)
    661746   png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
    662747       pngtest_warning);
     748#endif
     749
     750#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
     751   user_chunk_data[0] = 0;
     752   user_chunk_data[1] = 0;
     753   user_chunk_data[2] = 0;
     754   user_chunk_data[3] = 0;
     755   png_set_read_user_chunk_fn(read_ptr, user_chunk_data,
     756     read_user_chunk_callback);
     757
     758#endif
    663759#ifdef PNG_WRITE_SUPPORTED
    664760#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
    665    write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
     761   write_ptr =
     762      png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
    666763      png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
    667764      (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
    668765#else
    669    write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
     766   write_ptr =
     767      png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
    670768      png_error_ptr_NULL, png_error_ptr_NULL);
    671769#endif
     770#if defined(PNG_NO_STDIO)
    672771   png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
    673772       pngtest_warning);
    674773#endif
    675    png_debug(0, "Allocating read_info, write_info and end_info structures\n");
     774#endif
     775   png_debug(0, "Allocating read_info, write_info and end_info structures");
    676776   read_info_ptr = png_create_info_struct(read_ptr);
    677777   end_info_ptr = png_create_info_struct(read_ptr);
     
    682782
    683783#ifdef PNG_SETJMP_SUPPORTED
    684    png_debug(0, "Setting jmpbuf for read struct\n");
     784   png_debug(0, "Setting jmpbuf for read struct");
    685785#ifdef USE_FAR_KEYWORD
    686786   if (setjmp(jmpbuf))
     
    691791      fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
    692792      png_free(read_ptr, row_buf);
     793      row_buf = NULL;
    693794      png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
    694795#ifdef PNG_WRITE_SUPPORTED
     
    701802   }
    702803#ifdef USE_FAR_KEYWORD
    703    png_memcpy(png_jmpbuf(read_ptr),jmpbuf,png_sizeof(jmp_buf));
     804   png_memcpy(png_jmpbuf(read_ptr), jmpbuf, png_sizeof(jmp_buf));
    704805#endif
    705806
    706807#ifdef PNG_WRITE_SUPPORTED
    707    png_debug(0, "Setting jmpbuf for write struct\n");
     808   png_debug(0, "Setting jmpbuf for write struct");
    708809#ifdef USE_FAR_KEYWORD
    709810   if (setjmp(jmpbuf))
     
    723824   }
    724825#ifdef USE_FAR_KEYWORD
    725    png_memcpy(png_jmpbuf(write_ptr),jmpbuf,png_sizeof(jmp_buf));
    726 #endif
    727 #endif
    728 #endif
    729 
    730    png_debug(0, "Initializing input and output streams\n");
     826   png_memcpy(png_jmpbuf(write_ptr), jmpbuf, png_sizeof(jmp_buf));
     827#endif
     828#endif
     829#endif
     830
     831   png_debug(0, "Initializing input and output streams");
    731832#if !defined(PNG_NO_STDIO)
    732833   png_init_io(read_ptr, fpin);
     
    745846#  endif
    746847#endif
    747    if(status_dots_requested == 1)
     848   if (status_dots_requested == 1)
    748849   {
    749850#ifdef PNG_WRITE_SUPPORTED
     
    762863#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
    763864   {
    764      int i;
    765      for(i=0; i<256; i++)
    766         filters_used[i]=0;
    767      png_set_read_user_transform_fn(read_ptr, count_filters);
     865      int i;
     866      for (i = 0; i<256; i++)
     867         filters_used[i] = 0;
     868      png_set_read_user_transform_fn(read_ptr, count_filters);
    768869   }
    769870#endif
    770871#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
    771    zero_samples=0;
     872   zero_samples = 0;
    772873   png_set_write_user_transform_fn(write_ptr, count_zero_samples);
    773874#endif
     
    788889#endif
    789890
    790    png_debug(0, "Reading info struct\n");
     891   png_debug(0, "Reading info struct");
    791892   png_read_info(read_ptr, read_info_ptr);
    792893
    793    png_debug(0, "Transferring info struct\n");
     894   png_debug(0, "Transferring info struct");
    794895   {
    795896      int interlace_type, compression_type, filter_type;
     
    824925
    825926      if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma))
    826       {
    827927         png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma);
    828       }
    829928   }
    830929#endif
     
    848947
    849948      if (png_get_gAMA(read_ptr, read_info_ptr, &gamma))
    850       {
    851949         png_set_gAMA(write_ptr, write_info_ptr, gamma);
    852       }
    853    }
    854 #endif
    855 #endif /* floating point */
    856 #endif /* fixed point */
     950   }
     951#endif
     952#endif /* Floating point */
     953#endif /* Fixed point */
    857954#if defined(PNG_iCCP_SUPPORTED)
    858955   {
     
    875972
    876973      if (png_get_sRGB(read_ptr, read_info_ptr, &intent))
    877       {
    878974         png_set_sRGB(write_ptr, write_info_ptr, intent);
    879       }
    880975   }
    881976#endif
     
    885980
    886981      if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette))
    887       {
    888982         png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
    889       }
    890983   }
    891984#if defined(PNG_bKGD_SUPPORTED)
     
    904997
    905998      if (png_get_hIST(read_ptr, read_info_ptr, &hist))
    906       {
    907999         png_set_hIST(write_ptr, write_info_ptr, hist);
    908       }
    9091000   }
    9101001#endif
     
    9141005      int unit_type;
    9151006
    916       if (png_get_oFFs(read_ptr, read_info_ptr,&offset_x,&offset_y,&unit_type))
     1007      if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y,
     1008          &unit_type))
    9171009      {
    9181010         png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type);
     
    9411033
    9421034      if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y, &unit_type))
    943       {
    9441035         png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
    945       }
    9461036   }
    9471037#endif
     
    9511041
    9521042      if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit))
    953       {
    9541043         png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
    955       }
    9561044   }
    9571045#endif
     
    9901078      if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
    9911079      {
    992          png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text);
     1080         png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
    9931081         png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
    9941082      }
     
    10031091         png_set_tIME(write_ptr, write_info_ptr, mod_time);
    10041092#if defined(PNG_TIME_RFC1123_SUPPORTED)
    1005          /* we have to use png_memcpy instead of "=" because the string
    1006             pointed to by png_convert_to_rfc1123() gets free'ed before
    1007             we use it */
     1093         /* We have to use png_memcpy instead of "=" because the string
     1094          * pointed to by png_convert_to_rfc1123() gets free'ed before
     1095          * we use it.
     1096          */
    10081097         png_memcpy(tIME_string,
    1009                     png_convert_to_rfc1123(read_ptr, mod_time), 
     1098                    png_convert_to_rfc1123(read_ptr, mod_time),
    10101099                    png_sizeof(tIME_string));
    1011          tIME_string[png_sizeof(tIME_string)-1] = '\0';
     1100         tIME_string[png_sizeof(tIME_string) - 1] = '\0';
    10121101         tIME_chunk_present++;
    10131102#endif /* PNG_TIME_RFC1123_SUPPORTED */
     
    10271116         /* libpng doesn't reject a tRNS chunk with out-of-range samples */
    10281117         if (!((read_info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
    1029             (int)trans_values->gray > sample_max) ||
    1030             (read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
    1031             ((int)trans_values->red > sample_max ||
    1032             (int)trans_values->green > sample_max ||
    1033             (int)trans_values->blue > sample_max))))
    1034            png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans,
    1035               trans_values);
     1118             (int)trans_values->gray > sample_max) ||
     1119             (read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
     1120             ((int)trans_values->red > sample_max ||
     1121             (int)trans_values->green > sample_max ||
     1122             (int)trans_values->blue > sample_max))))
     1123            png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans,
     1124               trans_values);
    10361125      }
    10371126   }
     
    10471136         png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
    10481137           num_unknowns);
    1049          /* copy the locations from the read_info_ptr.  The automatically
    1050             generated locations in write_info_ptr are wrong because we
    1051             haven't written anything yet */
     1138         /* Copy the locations from the read_info_ptr.  The automatically
     1139          * generated locations in write_info_ptr are wrong because we
     1140          * haven't written anything yet.
     1141          */
    10521142         for (i = 0; i < (png_size_t)num_unknowns; i++)
    10531143           png_set_unknown_chunk_location(write_ptr, write_info_ptr, i,
     
    10581148
    10591149#ifdef PNG_WRITE_SUPPORTED
    1060    png_debug(0, "\nWriting info struct\n");
     1150   png_debug(0, "Writing info struct");
    10611151
    10621152/* If we wanted, we could write info in two steps:
    1063    png_write_info_before_PLTE(write_ptr, write_info_ptr);
     1153 * png_write_info_before_PLTE(write_ptr, write_info_ptr);
    10641154 */
    10651155   png_write_info(write_ptr, write_info_ptr);
     1156
     1157#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
     1158   if (user_chunk_data[0] != 0)
     1159   {
     1160      png_byte png_sTER[5] = {115,  84,  69,  82, '\0'};
     1161
     1162      unsigned char
     1163        ster_chunk_data[1];
     1164
     1165      if (verbose)
     1166         fprintf(STDERR, "\n stereo mode = %lu\n",
     1167           (unsigned long)(user_chunk_data[0] - 1));
     1168      ster_chunk_data[0]=(unsigned char)(user_chunk_data[0] - 1);
     1169      png_write_chunk(write_ptr, png_sTER, ster_chunk_data, 1);
     1170   }
     1171   if (user_chunk_data[1] != 0 || user_chunk_data[2] != 0)
     1172   {
     1173      png_byte png_vpAg[5] = {118, 112,  65, 103, '\0'};
     1174
     1175      unsigned char
     1176        vpag_chunk_data[9];
     1177
     1178      if (verbose)
     1179         fprintf(STDERR, " vpAg = %lu x %lu, units = %lu\n",
     1180           (unsigned long)user_chunk_data[1],
     1181           (unsigned long)user_chunk_data[2],
     1182           (unsigned long)user_chunk_data[3]);
     1183      png_save_uint_32(vpag_chunk_data, user_chunk_data[1]);
     1184      png_save_uint_32(vpag_chunk_data + 4, user_chunk_data[2]);
     1185      vpag_chunk_data[8] = (unsigned char)(user_chunk_data[3] & 0xff);
     1186      png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9);
     1187   }
     1188
     1189#endif
    10661190#endif
    10671191
    10681192#ifdef SINGLE_ROWBUF_ALLOC
    1069    png_debug(0, "\nAllocating row buffer...");
     1193   png_debug(0, "Allocating row buffer...");
    10701194   row_buf = (png_bytep)png_malloc(read_ptr,
    10711195      png_get_rowbytes(read_ptr, read_info_ptr));
    1072    png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf);
     1196   png_debug1(0, "0x%08lx", (unsigned long)row_buf);
    10731197#endif /* SINGLE_ROWBUF_ALLOC */
    1074    png_debug(0, "Writing row data\n");
     1198   png_debug(0, "Writing row data");
    10751199
    10761200#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
     
    10811205#  endif
    10821206#else
    1083    num_pass=1;
     1207   num_pass = 1;
    10841208#endif
    10851209
     
    10911215   for (pass = 0; pass < num_pass; pass++)
    10921216   {
    1093       png_debug1(0, "Writing row data for pass %d\n",pass);
     1217      png_debug1(0, "Writing row data for pass %d", pass);
    10941218      for (y = 0; y < height; y++)
    10951219      {
    10961220#ifndef SINGLE_ROWBUF_ALLOC
    1097          png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass,y);
     1221         png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y);
    10981222         row_buf = (png_bytep)png_malloc(read_ptr,
    10991223            png_get_rowbytes(read_ptr, read_info_ptr));
    1100          png_debug2(0, "0x%08lx (%ld bytes)\n", (unsigned long)row_buf,
     1224         png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
    11011225            png_get_rowbytes(read_ptr, read_info_ptr));
    11021226#endif /* !SINGLE_ROWBUF_ALLOC */
     
    11181242
    11191243#ifndef SINGLE_ROWBUF_ALLOC
    1120          png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n\n", pass, y);
     1244         png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y);
    11211245         png_free(read_ptr, row_buf);
     1246         row_buf = NULL;
    11221247#endif /* !SINGLE_ROWBUF_ALLOC */
    11231248      }
     
    11311256#endif
    11321257
    1133    png_debug(0, "Reading and writing end_info data\n");
     1258   png_debug(0, "Reading and writing end_info data");
    11341259
    11351260   png_read_end(read_ptr, end_info_ptr);
     
    11411266      if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0)
    11421267      {
    1143          png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text);
     1268         png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
    11441269         png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text);
    11451270      }
     
    11541279         png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
    11551280#if defined(PNG_TIME_RFC1123_SUPPORTED)
    1156          /* we have to use png_memcpy instead of "=" because the string
     1281         /* We have to use png_memcpy instead of "=" because the string
    11571282            pointed to by png_convert_to_rfc1123() gets free'ed before
    11581283            we use it */
     
    11601285                    png_convert_to_rfc1123(read_ptr, mod_time),
    11611286                    png_sizeof(tIME_string));
    1162          tIME_string[png_sizeof(tIME_string)-1] = '\0';
     1287         tIME_string[png_sizeof(tIME_string) - 1] = '\0';
    11631288         tIME_chunk_present++;
    11641289#endif /* PNG_TIME_RFC1123_SUPPORTED */
     
    11771302         png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
    11781303           num_unknowns);
    1179          /* copy the locations from the read_info_ptr.  The automatically
    1180             generated locations in write_end_info_ptr are wrong because we
    1181             haven't written the end_info yet */
     1304         /* Copy the locations from the read_info_ptr.  The automatically
     1305          * generated locations in write_end_info_ptr are wrong because we
     1306          * haven't written the end_info yet.
     1307          */
    11821308         for (i = 0; i < (png_size_t)num_unknowns; i++)
    11831309           png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i,
     
    11911317
    11921318#ifdef PNG_EASY_ACCESS_SUPPORTED
    1193    if(verbose)
     1319   if (verbose)
    11941320   {
    11951321      png_uint_32 iwidth, iheight;
    11961322      iwidth = png_get_image_width(write_ptr, write_info_ptr);
    11971323      iheight = png_get_image_height(write_ptr, write_info_ptr);
    1198       fprintf(STDERR, "Image width = %lu, height = %lu\n",
     1324      fprintf(STDERR, "\n Image width = %lu, height = %lu\n",
    11991325         (unsigned long)iwidth, (unsigned long)iheight);
    12001326   }
    12011327#endif
    12021328
    1203    png_debug(0, "Destroying data structs\n");
     1329   png_debug(0, "Destroying data structs");
    12041330#ifdef SINGLE_ROWBUF_ALLOC
    1205    png_debug(1, "destroying row_buf for read_ptr\n");
     1331   png_debug(1, "destroying row_buf for read_ptr");
    12061332   png_free(read_ptr, row_buf);
    1207    row_buf=NULL;
     1333   row_buf = NULL;
    12081334#endif /* SINGLE_ROWBUF_ALLOC */
    1209    png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr\n");
     1335   png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr");
    12101336   png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
    12111337#ifdef PNG_WRITE_SUPPORTED
    1212    png_debug(1, "destroying write_end_info_ptr\n");
     1338   png_debug(1, "destroying write_end_info_ptr");
    12131339   png_destroy_info_struct(write_ptr, &write_end_info_ptr);
    1214    png_debug(1, "destroying write_ptr, write_info_ptr\n");
     1340   png_debug(1, "destroying write_ptr, write_info_ptr");
    12151341   png_destroy_write_struct(&write_ptr, &write_info_ptr);
    12161342#endif
    1217    png_debug(0, "Destruction complete.\n");
     1343   png_debug(0, "Destruction complete.");
    12181344
    12191345   FCLOSE(fpin);
    12201346   FCLOSE(fpout);
    12211347
    1222    png_debug(0, "Opening files for comparison\n");
     1348   png_debug(0, "Opening files for comparison");
    12231349#if defined(_WIN32_WCE)
    12241350   MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
     
    12441370   }
    12451371
    1246    for(;;)
     1372   for (;;)
    12471373   {
    12481374      png_size_t num_in, num_out;
    12491375
    1250       READFILE(fpin, inbuf, 1, num_in);
    1251       READFILE(fpout, outbuf, 1, num_out);
     1376         READFILE(fpin, inbuf, 1, num_in);
     1377         READFILE(fpout, outbuf, 1, num_out);
    12521378
    12531379      if (num_in != num_out)
     
    12551381         fprintf(STDERR, "\nFiles %s and %s are of a different size\n",
    12561382                 inname, outname);
    1257          if(wrote_question == 0)
     1383         if (wrote_question == 0)
    12581384         {
    12591385            fprintf(STDERR,
    12601386         "   Was %s written with the same maximum IDAT chunk size (%d bytes),",
    1261               inname,PNG_ZBUF_SIZE);
     1387              inname, PNG_ZBUF_SIZE);
    12621388            fprintf(STDERR,
    12631389              "\n   filtering heuristic (libpng default), compression");
     
    12651391              " level (zlib default),\n   and zlib version (%s)?\n\n",
    12661392              ZLIB_VERSION);
    1267             wrote_question=1;
     1393            wrote_question = 1;
    12681394         }
    12691395         FCLOSE(fpin);
     
    12781404      {
    12791405         fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname);
    1280          if(wrote_question == 0)
     1406         if (wrote_question == 0)
    12811407         {
    12821408            fprintf(STDERR,
    12831409         "   Was %s written with the same maximum IDAT chunk size (%d bytes),",
    1284                  inname,PNG_ZBUF_SIZE);
     1410                 inname, PNG_ZBUF_SIZE);
    12851411            fprintf(STDERR,
    12861412              "\n   filtering heuristic (libpng default), compression");
     
    12881414              " level (zlib default),\n   and zlib version (%s)?\n\n",
    12891415              ZLIB_VERSION);
    1290             wrote_question=1;
     1416            wrote_question = 1;
    12911417         }
    12921418         FCLOSE(fpin);
     
    13021428}
    13031429
    1304 /* input and output filenames */
     1430/* Input and output filenames */
    13051431#ifdef RISCOS
    13061432static PNG_CONST char *inname = "pngtest/png";
     
    13171443   int ierror = 0;
    13181444
    1319    fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
     1445   fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
    13201446   fprintf(STDERR, "   with zlib   version %s\n", ZLIB_VERSION);
    1321    fprintf(STDERR,"%s",png_get_copyright(NULL));
     1447   fprintf(STDERR, "%s", png_get_copyright(NULL));
    13221448   /* Show the version of libpng used in building the library */
    1323    fprintf(STDERR," library (%lu):%s",
     1449   fprintf(STDERR, " library (%lu):%s",
    13241450      (unsigned long)png_access_version_number(),
    13251451      png_get_header_version(NULL));
    13261452   /* Show the version of libpng used in building the application */
    1327    fprintf(STDERR," pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
     1453   fprintf(STDERR, " pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
    13281454      PNG_HEADER_VERSION_STRING);
    1329    fprintf(STDERR," png_sizeof(png_struct)=%ld, png_sizeof(png_info)=%ld\n",
     1455   fprintf(STDERR, " sizeof(png_struct)=%ld, sizeof(png_info)=%ld\n",
    13301456                    (long)png_sizeof(png_struct), (long)png_sizeof(png_info));
    13311457
    13321458   /* Do some consistency checking on the memory allocation settings, I'm
    1333       not sure this matters, but it is nice to know, the first of these
    1334       tests should be impossible because of the way the macros are set
    1335       in pngconf.h */
     1459    * not sure this matters, but it is nice to know, the first of these
     1460    * tests should be impossible because of the way the macros are set
     1461    * in pngconf.h
     1462    */
    13361463#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
    13371464      fprintf(STDERR, " NOTE: Zlib compiled for max 64k, libpng not\n");
     
    13781505   }
    13791506
    1380    if (!multiple && argc == 3+verbose)
    1381      outname = argv[2+verbose];
    1382 
    1383    if ((!multiple && argc > 3+verbose) || (multiple && argc < 2))
     1507   if (!multiple && argc == 3 + verbose)
     1508     outname = argv[2 + verbose];
     1509
     1510   if ((!multiple && argc > 3 + verbose) || (multiple && argc < 2))
    13841511   {
    13851512     fprintf(STDERR,
     
    14051532#endif
    14061533         int kerror;
    1407          fprintf(STDERR, "Testing %s:",argv[i]);
     1534         fprintf(STDERR, "\n Testing %s:", argv[i]);
    14081535         kerror = test_one_file(argv[i], outname);
    14091536         if (kerror == 0)
     
    14161543#endif
    14171544#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
    1418             for (k=0; k<256; k++)
    1419                if(filters_used[k])
     1545            for (k = 0; k<256; k++)
     1546               if (filters_used[k])
    14201547                  fprintf(STDERR, " Filter %d was used %lu times\n",
    1421                      k,(unsigned long)filters_used[k]);
     1548                     k, (unsigned long)filters_used[k]);
    14221549#endif
    14231550#if defined(PNG_TIME_RFC1123_SUPPORTED)
    1424          if(tIME_chunk_present != 0)
    1425             fprintf(STDERR, " tIME = %s\n",tIME_string);
     1551         if (tIME_chunk_present != 0)
     1552            fprintf(STDERR, " tIME = %s\n", tIME_string);
    14261553         tIME_chunk_present = 0;
    14271554#endif /* PNG_TIME_RFC1123_SUPPORTED */
     
    14351562         if (allocation_now != current_allocation)
    14361563            fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n",
    1437                current_allocation-allocation_now);
     1564               current_allocation - allocation_now);
    14381565         if (current_allocation != 0)
    14391566         {
     
    14441571            while (pinfo != NULL)
    14451572            {
    1446                fprintf(STDERR, " %lu bytes at %x\n", (unsigned long)pinfo->size,
     1573               fprintf(STDERR, " %lu bytes at %x\n",
     1574                 (unsigned long)pinfo->size,
    14471575                 (unsigned int) pinfo->pointer);
    14481576               pinfo = pinfo->next;
     
    14651593   {
    14661594      int i;
    1467       for (i=0; i<3; ++i)
     1595      for (i = 0; i<3; ++i)
    14681596      {
    14691597         int kerror;
     
    14721600#endif
    14731601         if (i == 1) status_dots_requested = 1;
    1474          else if(verbose == 0)status_dots_requested = 0;
     1602         else if (verbose == 0)status_dots_requested = 0;
    14751603         if (i == 0 || verbose == 1 || ierror != 0)
    1476             fprintf(STDERR, "Testing %s:",inname);
     1604            fprintf(STDERR, "\n Testing %s:", inname);
    14771605         kerror = test_one_file(inname, outname);
    1478          if(kerror == 0)
     1606         if (kerror == 0)
    14791607         {
    1480             if(verbose == 1 || i == 2)
     1608            if (verbose == 1 || i == 2)
    14811609            {
    14821610#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
     
    14901618#endif
    14911619#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
    1492                 for (k=0; k<256; k++)
    1493                    if(filters_used[k])
     1620                for (k = 0; k<256; k++)
     1621                   if (filters_used[k])
    14941622                      fprintf(STDERR, " Filter %d was used %lu times\n",
    1495                          k,(unsigned long)filters_used[k]);
     1623                         k,
     1624                         (unsigned long)filters_used[k]);
    14961625#endif
    14971626#if defined(PNG_TIME_RFC1123_SUPPORTED)
    1498              if(tIME_chunk_present != 0)
    1499                 fprintf(STDERR, " tIME = %s\n",tIME_string);
     1627             if (tIME_chunk_present != 0)
     1628                fprintf(STDERR, " tIME = %s\n", tIME_string);
    15001629#endif /* PNG_TIME_RFC1123_SUPPORTED */
    15011630            }
     
    15031632         else
    15041633         {
    1505             if(verbose == 0 && i != 2)
    1506                fprintf(STDERR, "Testing %s:",inname);
     1634            if (verbose == 0 && i != 2)
     1635               fprintf(STDERR, "\n Testing %s:", inname);
    15071636            fprintf(STDERR, " FAIL\n");
    15081637            ierror += kerror;
     
    15111640         if (allocation_now != current_allocation)
    15121641             fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n",
    1513                current_allocation-allocation_now);
     1642               current_allocation - allocation_now);
    15141643         if (current_allocation != 0)
    15151644         {
     
    15201649             while (pinfo != NULL)
    15211650             {
    1522                 fprintf(STDERR," %lu bytes at %x\n",
     1651                fprintf(STDERR, " %lu bytes at %x\n",
    15231652                   (unsigned long)pinfo->size, (unsigned int)pinfo->pointer);
    15241653                pinfo = pinfo->next;
     
    15431672   t_misc += (t_stop - t_start);
    15441673   t_start = t_stop;
    1545    fprintf(STDERR," CPU time used = %.3f seconds",
     1674   fprintf(STDERR, " CPU time used = %.3f seconds",
    15461675      (t_misc+t_decode+t_encode)/(float)CLOCKS_PER_SEC);
    1547    fprintf(STDERR," (decoding %.3f,\n",
     1676   fprintf(STDERR, " (decoding %.3f,\n",
    15481677      t_decode/(float)CLOCKS_PER_SEC);
    1549    fprintf(STDERR,"        encoding %.3f ,",
     1678   fprintf(STDERR, "        encoding %.3f ,",
    15501679      t_encode/(float)CLOCKS_PER_SEC);
    1551    fprintf(STDERR," other %.3f seconds)\n\n",
     1680   fprintf(STDERR, " other %.3f seconds)\n\n",
    15521681      t_misc/(float)CLOCKS_PER_SEC);
    15531682#endif
    15541683
    15551684   if (ierror == 0)
    1556       fprintf(STDERR, "libpng passes test\n");
     1685      fprintf(STDERR, " libpng passes test\n");
    15571686   else
    1558       fprintf(STDERR, "libpng FAILS test\n");
     1687      fprintf(STDERR, " libpng FAILS test\n");
    15591688   return (int)(ierror != 0);
    15601689}
    15611690
    15621691/* Generate a compiler error if there is an old png.h in the search path. */
    1563 typedef version_1_2_29 your_png_h_is_not_version_1_2_29;
     1692typedef version_1_2_40 your_png_h_is_not_version_1_2_40;
Note: See TracChangeset for help on using the changeset viewer.