summaryrefslogtreecommitdiff
path: root/graphics/netpbm/patches/patch-ak
blob: 479dd2a1f2a827cbd75f5fa530437f42395debaf (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
$NetBSD: patch-ak,v 1.10 2014/08/25 08:23:22 wiz Exp $

Fix build with png-1.5.
Already included in Advanced release.

--- converter/other/pngtxt.c.orig	2006-08-19 04:12:28.000000000 +0100
+++ converter/other/pngtxt.c	2011-01-14 21:28:09.000000000 +0000
@@ -240,7 +240,8 @@
 
 
 void 
-pnmpng_read_text (png_info * const info_ptr, 
+pnmpng_read_text (png_struct * png_ptr,
+                  png_info * info_ptr, 
                   FILE *     const tfp, 
                   bool       const ztxt,
                   bool       const verbose) {
@@ -250,6 +251,7 @@
     unsigned int commentIdx;
     bool noCommentsYet;
     bool eof;
+    png_textp text_ptr;
     unsigned int allocatedComments;
         /* Number of entries currently allocated for the info_ptr->text
            array 
@@ -257,8 +259,8 @@
 
     allocatedComments = 256;  /* initial value */
 
-    MALLOCARRAY(info_ptr->text, allocatedComments);
-    if (info_ptr->text == NULL) 
+    MALLOCARRAY(text_ptr, allocatedComments);
+    if (text_ptr == NULL) 
         pm_error("unable to allocate memory for comment array");
 
     commentIdx = 0;
@@ -273,7 +275,7 @@
             if (lineLength == 0) {
                 /* skip this empty line */
             } else {
-                handleArrayAllocation(&info_ptr->text, &allocatedComments,
+                handleArrayAllocation(&text_ptr, &allocatedComments,
                                       commentIdx);
                 if ((textline[0] != ' ') && (textline[0] != '\t')) {
                     /* Line doesn't start with white space, which
@@ -285,7 +287,7 @@
                         ++commentIdx;
                     noCommentsYet = FALSE;
 
-                    startComment(&info_ptr->text[commentIdx], 
+                    startComment(&text_ptr[commentIdx], 
                                  textline, lineLength, ztxt);
                 } else {
                     /* Line starts with whitespace, which means it is
@@ -295,20 +297,20 @@
                         pm_error("Invalid comment file format: "
                                  "first line is a continuation line! "
                                  "(It starts with whitespace)");
-                    continueComment(&info_ptr->text[commentIdx], 
+                    continueComment(&text_ptr[commentIdx], 
                                     textline, lineLength);
                 }
             }
             strfree(textline);
         }
     } 
-    if (noCommentsYet)
-        info_ptr->num_text = 0;
-    else
-        info_ptr->num_text = commentIdx + 1;
+    if (!noCommentsYet)
+        png_set_text(png_ptr, info_ptr, text_ptr, commentIdx + 1);
 
     if (verbose)
-        pm_message("%d comments placed in text chunk", info_ptr->num_text);
+        pm_message("%d comments placed in text chunk", commentIdx + 1);
+
+    free(text_ptr);
 }