~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to libpng/pngread.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
/* pngread.c - read a PNG file
3
3
 *
4
 
 * Last changed in libpng 1.2.15 January 5, 2007
 
4
 * Last changed in libpng 1.2.20 September 7, 2007
5
5
 * For conditions of distribution and use, see copyright notice in png.h
6
6
 * Copyright (c) 1998-2007 Glenn Randers-Pehrson
7
7
 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
55
55
   if (png_ptr == NULL)
56
56
      return (NULL);
57
57
 
58
 
#if !defined(PNG_1_0_X)
59
 
#ifdef PNG_MMX_CODE_SUPPORTED
60
 
   png_init_mmx_flags(png_ptr);   /* 1.2.0 addition */
61
 
#endif
62
 
#endif /* PNG_1_0_X */
63
 
 
64
58
   /* added at libpng-1.2.6 */
65
59
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
66
60
   png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
117
111
        char msg[80];
118
112
        if (user_png_ver)
119
113
        {
120
 
          sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
 
114
          png_snprintf(msg, 80,
 
115
             "Application was compiled with png.h from libpng-%.20s",
121
116
             user_png_ver);
122
117
          png_warning(png_ptr, msg);
123
118
        }
124
 
        sprintf(msg, "Application  is  running with png.c from libpng-%.20s",
 
119
        png_snprintf(msg, 80,
 
120
             "Application  is  running with png.c from libpng-%.20s",
125
121
           png_libpng_ver);
126
122
        png_warning(png_ptr, msg);
127
123
#endif
197
193
      png_ptr->warning_fn=NULL;
198
194
      if (user_png_ver)
199
195
      {
200
 
        sprintf(msg, "Application was compiled with png.h from libpng-%.20s",
 
196
        png_snprintf(msg, 80,
 
197
           "Application was compiled with png.h from libpng-%.20s",
201
198
           user_png_ver);
202
199
        png_warning(png_ptr, msg);
203
200
      }
204
 
      sprintf(msg, "Application  is  running with png.c from libpng-%.20s",
 
201
      png_snprintf(msg, 80,
 
202
         "Application  is  running with png.c from libpng-%.20s",
205
203
         png_libpng_ver);
206
204
      png_warning(png_ptr, msg);
207
205
   }
346
344
   for(;;)
347
345
   {
348
346
#ifdef PNG_USE_LOCAL_ARRAYS
349
 
      PNG_IHDR;
350
 
      PNG_IDAT;
351
 
      PNG_IEND;
352
 
      PNG_PLTE;
 
347
      PNG_CONST PNG_IHDR;
 
348
      PNG_CONST PNG_IDAT;
 
349
      PNG_CONST PNG_IEND;
 
350
      PNG_CONST PNG_PLTE;
353
351
#if defined(PNG_READ_bKGD_SUPPORTED)
354
 
      PNG_bKGD;
 
352
      PNG_CONST PNG_bKGD;
355
353
#endif
356
354
#if defined(PNG_READ_cHRM_SUPPORTED)
357
 
      PNG_cHRM;
 
355
      PNG_CONST PNG_cHRM;
358
356
#endif
359
357
#if defined(PNG_READ_gAMA_SUPPORTED)
360
 
      PNG_gAMA;
 
358
      PNG_CONST PNG_gAMA;
361
359
#endif
362
360
#if defined(PNG_READ_hIST_SUPPORTED)
363
 
      PNG_hIST;
 
361
      PNG_CONST PNG_hIST;
364
362
#endif
365
363
#if defined(PNG_READ_iCCP_SUPPORTED)
366
 
      PNG_iCCP;
 
364
      PNG_CONST PNG_iCCP;
367
365
#endif
368
366
#if defined(PNG_READ_iTXt_SUPPORTED)
369
 
      PNG_iTXt;
 
367
      PNG_CONST PNG_iTXt;
370
368
#endif
371
369
#if defined(PNG_READ_oFFs_SUPPORTED)
372
 
      PNG_oFFs;
 
370
      PNG_CONST PNG_oFFs;
373
371
#endif
374
372
#if defined(PNG_READ_pCAL_SUPPORTED)
375
 
      PNG_pCAL;
 
373
      PNG_CONST PNG_pCAL;
376
374
#endif
377
375
#if defined(PNG_READ_pHYs_SUPPORTED)
378
 
      PNG_pHYs;
 
376
      PNG_CONST PNG_pHYs;
379
377
#endif
380
378
#if defined(PNG_READ_sBIT_SUPPORTED)
381
 
      PNG_sBIT;
 
379
      PNG_CONST PNG_sBIT;
382
380
#endif
383
381
#if defined(PNG_READ_sCAL_SUPPORTED)
384
 
      PNG_sCAL;
 
382
      PNG_CONST PNG_sCAL;
385
383
#endif
386
384
#if defined(PNG_READ_sPLT_SUPPORTED)
387
 
      PNG_sPLT;
 
385
      PNG_CONST PNG_sPLT;
388
386
#endif
389
387
#if defined(PNG_READ_sRGB_SUPPORTED)
390
 
      PNG_sRGB;
 
388
      PNG_CONST PNG_sRGB;
391
389
#endif
392
390
#if defined(PNG_READ_tEXt_SUPPORTED)
393
 
      PNG_tEXt;
 
391
      PNG_CONST PNG_tEXt;
394
392
#endif
395
393
#if defined(PNG_READ_tIME_SUPPORTED)
396
 
      PNG_tIME;
 
394
      PNG_CONST PNG_tIME;
397
395
#endif
398
396
#if defined(PNG_READ_tRNS_SUPPORTED)
399
 
      PNG_tRNS;
 
397
      PNG_CONST PNG_tRNS;
400
398
#endif
401
399
#if defined(PNG_READ_zTXt_SUPPORTED)
402
 
      PNG_zTXt;
 
400
      PNG_CONST PNG_zTXt;
403
401
#endif
404
402
#endif /* PNG_USE_LOCAL_ARRAYS */
405
403
      png_byte chunk_length[4];
417
415
      /* This should be a binary subdivision search or a hash for
418
416
       * matching the chunk name rather than a linear search.
419
417
       */
420
 
      if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
 
418
      if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
421
419
        if(png_ptr->mode & PNG_AFTER_IDAT)
422
420
          png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
423
421
 
567
565
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
568
566
{
569
567
#ifdef PNG_USE_LOCAL_ARRAYS
570
 
   PNG_IDAT;
571
 
   const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
572
 
   const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
 
568
   PNG_CONST PNG_IDAT;
 
569
   PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
 
570
     0xff};
 
571
   PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
573
572
#endif
574
573
   int ret;
575
574
   if(png_ptr == NULL) return;
925
924
   do
926
925
   {
927
926
#ifdef PNG_USE_LOCAL_ARRAYS
928
 
      PNG_IHDR;
929
 
      PNG_IDAT;
930
 
      PNG_IEND;
931
 
      PNG_PLTE;
 
927
      PNG_CONST PNG_IHDR;
 
928
      PNG_CONST PNG_IDAT;
 
929
      PNG_CONST PNG_IEND;
 
930
      PNG_CONST PNG_PLTE;
932
931
#if defined(PNG_READ_bKGD_SUPPORTED)
933
 
      PNG_bKGD;
 
932
      PNG_CONST PNG_bKGD;
934
933
#endif
935
934
#if defined(PNG_READ_cHRM_SUPPORTED)
936
 
      PNG_cHRM;
 
935
      PNG_CONST PNG_cHRM;
937
936
#endif
938
937
#if defined(PNG_READ_gAMA_SUPPORTED)
939
 
      PNG_gAMA;
 
938
      PNG_CONST PNG_gAMA;
940
939
#endif
941
940
#if defined(PNG_READ_hIST_SUPPORTED)
942
 
      PNG_hIST;
 
941
      PNG_CONST PNG_hIST;
943
942
#endif
944
943
#if defined(PNG_READ_iCCP_SUPPORTED)
945
 
      PNG_iCCP;
 
944
      PNG_CONST PNG_iCCP;
946
945
#endif
947
946
#if defined(PNG_READ_iTXt_SUPPORTED)
948
 
      PNG_iTXt;
 
947
      PNG_CONST PNG_iTXt;
949
948
#endif
950
949
#if defined(PNG_READ_oFFs_SUPPORTED)
951
 
      PNG_oFFs;
 
950
      PNG_CONST PNG_oFFs;
952
951
#endif
953
952
#if defined(PNG_READ_pCAL_SUPPORTED)
954
 
      PNG_pCAL;
 
953
      PNG_CONST PNG_pCAL;
955
954
#endif
956
955
#if defined(PNG_READ_pHYs_SUPPORTED)
957
 
      PNG_pHYs;
 
956
      PNG_CONST PNG_pHYs;
958
957
#endif
959
958
#if defined(PNG_READ_sBIT_SUPPORTED)
960
 
      PNG_sBIT;
 
959
      PNG_CONST PNG_sBIT;
961
960
#endif
962
961
#if defined(PNG_READ_sCAL_SUPPORTED)
963
 
      PNG_sCAL;
 
962
      PNG_CONST PNG_sCAL;
964
963
#endif
965
964
#if defined(PNG_READ_sPLT_SUPPORTED)
966
 
      PNG_sPLT;
 
965
      PNG_CONST PNG_sPLT;
967
966
#endif
968
967
#if defined(PNG_READ_sRGB_SUPPORTED)
969
 
      PNG_sRGB;
 
968
      PNG_CONST PNG_sRGB;
970
969
#endif
971
970
#if defined(PNG_READ_tEXt_SUPPORTED)
972
 
      PNG_tEXt;
 
971
      PNG_CONST PNG_tEXt;
973
972
#endif
974
973
#if defined(PNG_READ_tIME_SUPPORTED)
975
 
      PNG_tIME;
 
974
      PNG_CONST PNG_tIME;
976
975
#endif
977
976
#if defined(PNG_READ_tRNS_SUPPORTED)
978
 
      PNG_tRNS;
 
977
      PNG_CONST PNG_tRNS;
979
978
#endif
980
979
#if defined(PNG_READ_zTXt_SUPPORTED)
981
 
      PNG_zTXt;
 
980
      PNG_CONST PNG_zTXt;
982
981
#endif
983
982
#endif /* PNG_USE_LOCAL_ARRAYS */
984
983
 
1464
1463
   /* read rest of file, and get additional chunks in info_ptr - REQUIRED */
1465
1464
   png_read_end(png_ptr, info_ptr);
1466
1465
 
1467
 
   if(transforms == 0 || params == NULL)
1468
 
      /* quiet compiler warnings */ return;
 
1466
   transforms = transforms; /* quiet compiler warnings */
 
1467
   params = params;
1469
1468
 
1470
1469
}
1471
1470
#endif /* PNG_INFO_IMAGE_SUPPORTED */