summarylogtreecommitdiffstats
path: root/pngmeta-1.11-libpng_fixes.diff
blob: 6ac8ca5fb36cd88a1990e4c8b754cd444d027e5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
diff -c -r pngmeta-1.11.orig/pngmeta.1 pngmeta-1.11/pngmeta.1
*** pngmeta-1.11.orig/pngmeta.1	2001-05-16 16:46:52.000000000 +0200
--- pngmeta-1.11/pngmeta.1	2008-12-30 19:12:24.000000000 +0100
***************
*** 10,21 ****
  pngmeta \- extract metadata from Portable Network Graphics (PNG) image files
  .SH SYNOPSIS
  .B pngmeta
! .RB [ \--soif ]
! .RB [ \--html ]
! .RB [ \--xrdf ]
! .RB [ \--all ]
! .RB [ \--quiet ]
! .RB [ \--uri\ URI ]
  .RI [ filename ]
  .SH DESCRIPTION
  The
--- 10,21 ----
  pngmeta \- extract metadata from Portable Network Graphics (PNG) image files
  .SH SYNOPSIS
  .B pngmeta
! .RB [ \-\-soif ]
! .RB [ \-\-html ]
! .RB [ \-\-xrdf ]
! .RB [ \-\-all ]
! .RB [ \-\-quiet ]
! .RB [ \-\-uri\ URI ]
  .RI [ filename ]
  .SH DESCRIPTION
  The
***************
*** 44,80 ****
  and is processed.
  .SH FORMAT OPTIONS
  .TP
! .B \--soif
  Format output using (Harvest) SOIF format.  This is the default if
  the program is called PngImage.sum.
  .TP
! .B \--html
  Format output in HTML, with each field/value as an element in a descriptive
  .RB ( DL )
  list.
  .TP
! .B \--xrdf
  Format output in RDF/XML, with each field/value as an element in an
  rdf:Description block inside the outer rdf:RDF wrapper element.
  If an XMLRDFDATA field is found, it is assumed to be RDF/XML content
  and is emitted in a second rdf:Description block.
  .SH OTHER OPTIONS
  .TP
! .B \--all
  Output all the information about the image size, depth etc. even if
  not usually printed.
  .TP
! .B \--quiet
  Suppress the output of the banner for plain text output.
! .B \--uri URI
  Set the URI that is used for the SOIF and XML/RDF outputs.  By
  default this will be the filename, or "stdin" if this is the program
  is used as a filter.
  .TP
! .B \--help
  Show a usage message
  .TP
! .B \--version
  Show the program and library versions
  .SH FILES
  .TP 2.2i
--- 44,80 ----
  and is processed.
  .SH FORMAT OPTIONS
  .TP
! .B \-\-soif
  Format output using (Harvest) SOIF format.  This is the default if
  the program is called PngImage.sum.
  .TP
! .B \-\-html
  Format output in HTML, with each field/value as an element in a descriptive
  .RB ( DL )
  list.
  .TP
! .B \-\-xrdf
  Format output in RDF/XML, with each field/value as an element in an
  rdf:Description block inside the outer rdf:RDF wrapper element.
  If an XMLRDFDATA field is found, it is assumed to be RDF/XML content
  and is emitted in a second rdf:Description block.
  .SH OTHER OPTIONS
  .TP
! .B \-\-all
  Output all the information about the image size, depth etc. even if
  not usually printed.
  .TP
! .B \-\-quiet
  Suppress the output of the banner for plain text output.
! .B \-\-uri URI
  Set the URI that is used for the SOIF and XML/RDF outputs.  By
  default this will be the filename, or "stdin" if this is the program
  is used as a filter.
  .TP
! .B \-\-help
  Show a usage message
  .TP
! .B \-\-version
  Show the program and library versions
  .SH FILES
  .TP 2.2i
***************
*** 104,124 ****
  http://www.libpng.org/pub/png/
  .LP
  For
! .IR "libpng library:"
  .IP
  http://www.libpng.org/pub/png/libpng.html
  .br
  http://libpng.sourceforge.net
  .LP
  For
! .IR zlib - "zlib library"
  .IP
! http://www.info-zip.org/pub/infozip/zlib/
! .br
! http://www.mirror.ac.uk/sites/ftp.freesoftware.com/pub/infozip/zlib/
  .IP
  .SH AUTHORS
! Version 1.10.
  Dave Beckett, ILRT, University of Bristol, http://purl.org/net/dajobe/
  .LP
  The
--- 104,122 ----
  http://www.libpng.org/pub/png/
  .LP
  For
! .IR "libpng library"
  .IP
  http://www.libpng.org/pub/png/libpng.html
  .br
  http://libpng.sourceforge.net
  .LP
  For
! .IR "zlib library"
  .IP
! http://www.zlib.net/
  .IP
  .SH AUTHORS
! Version 1.11.
  Dave Beckett, ILRT, University of Bristol, http://purl.org/net/dajobe/
  .LP
  The
***************
*** 126,137 ****
  library required by
  .I pngmeta
  is copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler.
- Some code was modified from the code for the
- .IR libpng (3)
- library function
- .B png_read_end()
- which is copyright (c) Guy Eric Schalnat, Andreas Dilger, Glenn
- Randers-Pehrson and others -- see the source for details.
  .LP
  Original UNIX manual page by R. P. C. Rodgers,
  U.S. National Library of Medicine (rodgers@nlm.nih.gov).
--- 124,129 ----
diff -c -r pngmeta-1.11.orig/pngmeta.c pngmeta-1.11/pngmeta.c
*** pngmeta-1.11.orig/pngmeta.c	2001-05-16 16:41:06.000000000 +0200
--- pngmeta-1.11/pngmeta.c	2008-12-30 19:15:47.000000000 +0100
***************
*** 9,35 ****
  
  
     $Id: pngmeta.c,v 1.12 2001/05/16 14:41:06 cmdjb Exp $
-    
-    The function png_skip_till_end() is a modified version of
-    png_read_end() from libpng 1.0.0 by
-    Guy Eric Schalnat, Group 42, Inc.
-    Andreas Eric Dilger and Glenn Randers-Pehrson
-    as well as many others.  The original copyright message follows.
  */
  
- /* pngread.c - read a PNG file
-  *
-  * libpng 1.0.0
-  * For conditions of distribution and use, see copyright notice in png.h
-  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
-  * Copyright (c) 1996, 1997 Andreas Dilger
-  * Copyright (c) 1998, Glenn Randers-Pehrson
-  * March 8, 1998
-  *
-  * This file contains routines that an application calls directly to
-  * read a PNG file or stream.
-  */
- 
  /* png.h - header file for PNG reference library
   *
  
--- 9,16 ----
***************
*** 65,70 ****
--- 46,52 ----
  #include <stdio.h>
  #include <stdlib.h>
  #include <strings.h>
+ #include <ctype.h>
  
  /* Needed to access various internal PNG chunk routines */
  #define PNG_INTERNAL
***************
*** 86,93 ****
  #define XMLRDF_MAGIC_FIELD "XMLRDFDATA"
  
  
- void png_skip_till_end PNGARG((png_structp png_ptr, png_infop info));
  void html_quote_string PNGARG((FILE *fd, const char *string));
  void print_init PNGARG((FILE *fd, int output_type, const char *filename, const char *uri, int quiet));
  void print_start_image PNGARG((FILE *fd, int output_type, const char *filename, const char *uri, int quiet));
  void print_kv PNGARG((FILE *fd, int output_type, const char *field, const char *value));
--- 68,75 ----
  #define XMLRDF_MAGIC_FIELD "XMLRDFDATA"
  
  
  void html_quote_string PNGARG((FILE *fd, const char *string));
+ void html_quote_element PNGARG((FILE *fd, const char *string));
  void print_init PNGARG((FILE *fd, int output_type, const char *filename, const char *uri, int quiet));
  void print_start_image PNGARG((FILE *fd, int output_type, const char *filename, const char *uri, int quiet));
  void print_kv PNGARG((FILE *fd, int output_type, const char *field, const char *value));
***************
*** 102,182 ****
  /* static - used to store magic RDF field if seen */
  static char *xmlrdf_magic_block=NULL;
  
- 
- /* read data, ignoring IDATs, till the end of the png file.
-    
-    Will not read past the end of the file, will verify the end is
-    accurate, and will read any comments or time information at the
-    end of the file, if info is not NULL. */
- void
- png_skip_till_end(png_structp png_ptr, png_infop info_ptr)
- {
-    png_byte chunk_length[4];
-    png_uint_32 length;
- 
-    length=png_ptr->idat_size;
-    
-   /* Skip IDAT chunks */
-    do
-    {
-      png_crc_finish(png_ptr, length);
- 
-      png_read_data(png_ptr, chunk_length, 4);
-      length = png_get_uint_32(chunk_length);
- 
-      png_reset_crc(png_ptr);
-      png_crc_read(png_ptr, png_ptr->chunk_name, 4);
-    } while (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4));
-    
-    png_ptr->mode |= PNG_AFTER_IDAT;
-    
-    do
-    {
-      if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
-        png_handle_IHDR(png_ptr, info_ptr, length);
-      else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
-      {
-        /* Zero length IDATs are legal after the last IDAT has been
-         * read, but not after other chunks have been read.
-         */
-        if (length > 0 || png_ptr->mode & PNG_AFTER_IDAT)
-          png_error(png_ptr, "Too many IDAT's found");
-        else
-          png_crc_finish(png_ptr, 0);
-      }
- #if defined(PNG_READ_tIME_SUPPORTED)
-      else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4))
-        png_handle_tIME(png_ptr, info_ptr, length);
- #endif
- #if defined(PNG_READ_tEXt_SUPPORTED)
-      else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
-        png_handle_tEXt(png_ptr, info_ptr, length);
- #endif
- #if defined(PNG_READ_zTXt_SUPPORTED)
-      else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
-        png_handle_zTXt(png_ptr, info_ptr, length);
- #endif
- #if defined(PNG_READ_iTXt_SUPPORTED)
-       else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
-          png_handle_iTXt(png_ptr, info_ptr, length);
- #endif
-      else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
-        png_handle_IEND(png_ptr, info_ptr, length);
-      else
-        png_handle_unknown(png_ptr, info_ptr, length);
- 
-      if (!(png_ptr->mode & PNG_HAVE_IEND)) {
-        png_read_data(png_ptr, chunk_length, 4);
-        length = png_get_uint_32(chunk_length);
-      
-        png_reset_crc(png_ptr);
-        png_crc_read(png_ptr, png_ptr->chunk_name, 4);
-      }
-      
-    } while (!(png_ptr->mode & PNG_HAVE_IEND));
- }
- 
- 
  #define OUTPUT_TEXT 0
  #define OUTPUT_SOIF 1
  #define OUTPUT_HTML 2
--- 84,89 ----
***************
*** 200,205 ****
--- 107,122 ----
  }
  
  
+ void html_quote_element(FILE *fd, const char *string)
+ {
+   char c;
+   char const * p=string;
+   while ((c = *p++))
+     if (!isspace (c))
+       fputc(c, fd);
+ }
+ 
+ 
  void print_init(FILE *fd, int output_type, const char *filename,
                  const char *uri, int quiet)
  {
***************
*** 248,256 ****
        
        case OUTPUT_XRDF:
          if (uri)
!           fprintf(fd, "  <png:Image about=\"%s\"\n", uri);
          else {
!           fputs("  <png:Image about=\"", fd);
            html_quote_string(fd, filename); 
            fputs("\">\n", fd);
          }
--- 165,173 ----
        
        case OUTPUT_XRDF:
          if (uri)
!           fprintf(fd, "  <png:Image rdf:about=\"%s\">\n", uri);
          else {
!           fputs("  <png:Image rdf:about=\"", fd);
            html_quote_string(fd, filename); 
            fputs("\">\n", fd);
          }
***************
*** 294,300 ****
  
            /* start tag */
            fputs("    <png:", fd);
!           html_quote_string(fd, field);
            fputs(">", fd);
  
            /* If value starts with <RDF, assume it is RDF and don't
--- 211,217 ----
  
            /* start tag */
            fputs("    <png:", fd);
!           html_quote_element(fd, field);
            fputs(">", fd);
  
            /* If value starts with <RDF, assume it is RDF and don't
***************
*** 306,312 ****
  
            /* end tag */
            fputs("</png:", fd);
!           html_quote_string(fd, field);
            fputs(">\n", fd);
            break;
  
--- 223,229 ----
  
            /* end tag */
            fputs("</png:", fd);
!           html_quote_element(fd, field);
            fputs(">\n", fd);
            break;
  
***************
*** 599,608 ****
      print_kv(out_fp, output_type, "image-type", value);
    }
    
-   /* Local function */
-   png_skip_till_end(png_ptr, end_info);
- 
- 
  #ifdef HAVE_PNG_GET_TEXT
    if(png_get_text(png_ptr, info_ptr, &text_ptr, &num_text) > 0) {
      for (i = 0; i < num_text; i++)
--- 516,521 ----
***************
*** 639,645 ****
    
    
    /* Cleanup */
!   png_read_destroy(png_ptr, info_ptr, end_info);
  
    fclose(in_fp);
    
--- 552,558 ----
    
    
    /* Cleanup */
!   png_destroy_read_struct(png_ptr, info_ptr, end_info);
  
    fclose(in_fp);
    
Pouze v pngmeta-1.11.orig/: pngmeta.spec
diff -c -r pngmeta-1.11.orig/test4.xpt pngmeta-1.11/test4.xpt
*** pngmeta-1.11.orig/test4.xpt	2000-08-15 17:39:04.000000000 +0200
--- pngmeta-1.11/test4.xpt	2008-12-30 19:12:24.000000000 +0100
***************
*** 1,7 ****
  <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
           xmlns:png='http://www.w3.org/2000/08/pngmeta#'
           xmlns:dc='http://purl.org/dc/elements/1.0/'>
!   <png:Image about="ct1n0g04.png">
      <dc:type>image/png</dc:type>
      <png:Title>PngSuite</png:Title>
      <png:Author>Willem A.J. van Schaik
--- 1,7 ----
  <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
           xmlns:png='http://www.w3.org/2000/08/pngmeta#'
           xmlns:dc='http://purl.org/dc/elements/1.0/'>
!   <png:Image rdf:about="ct1n0g04.png">
      <dc:type>image/png</dc:type>
      <png:Title>PngSuite</png:Title>
      <png:Author>Willem A.J. van Schaik