Gentoo Archives: gentoo-commits

From: "Tim Harder (radhermit)" <radhermit@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-gfx/hugin/files: hugin-2011.0.0_rc1-libpng15.patch
Date: Wed, 18 May 2011 06:42:06
Message-Id: 20110518064154.7ABFE20057@flycatcher.gentoo.org
1 radhermit 11/05/18 06:41:54
2
3 Added: hugin-2011.0.0_rc1-libpng15.patch
4 Log:
5 Version bump to release candidate. Remove old post install message, bump to EAPI 4, apply patch for libpng-1.5 (bug #355885).
6
7 (Portage version: 2.2.0_alpha33/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 media-gfx/hugin/files/hugin-2011.0.0_rc1-libpng15.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/hugin/files/hugin-2011.0.0_rc1-libpng15.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-gfx/hugin/files/hugin-2011.0.0_rc1-libpng15.patch?rev=1.1&content-type=text/plain
14
15 Index: hugin-2011.0.0_rc1-libpng15.patch
16 ===================================================================
17 --- hugin-2011.0.0.orig/src/foreign/vigra/vigra_impex/png.cxx
18 +++ hugin-2011.0.0/src/foreign/vigra/vigra_impex/png.cxx
19 @@ -78,7 +75,7 @@
20 static void PngError( png_structp png_ptr, png_const_charp error_msg )
21 {
22 png_error_message = std::string(error_msg);
23 - longjmp( png_ptr->jmpbuf, 1 );
24 + longjmp( png_jmpbuf(png_ptr), 1 );
25 }
26
27 // called on non-fatal errors
28 @@ -200,9 +197,9 @@
29 // check if the file is a png file
30 const unsigned int sig_size = 8;
31 png_byte sig[sig_size];
32 - std::fread( sig, sig_size, 1, file.get() );
33 + std::size_t readCount = std::fread( sig, sig_size, 1, file.get() );
34 const int no_png = png_sig_cmp( sig, 0, sig_size );
35 - vigra_precondition( !no_png, "given file is not a png file.");
36 + vigra_precondition( (readCount == 1) && !no_png, "given file is not a png file.");
37
38 // create png read struct with user defined handlers
39 png = png_create_read_struct( PNG_LIBPNG_VER_STRING, NULL,
40 @@ -210,7 +207,7 @@
41 vigra_postcondition( png != 0, "could not create the read struct." );
42
43 // create info struct
44 - if (setjmp(png->jmpbuf)) {
45 + if (setjmp(png_jmpbuf(png))) {
46 png_destroy_read_struct( &png, &info, NULL );
47 vigra_postcondition( false, png_error_message.insert(0, "error in png_create_info_struct(): ").c_str() );
48 }
49 @@ -218,14 +215,14 @@
50 vigra_postcondition( info != 0, "could not create the info struct." );
51
52 // init png i/o
53 - if (setjmp(png->jmpbuf)) {
54 + if (setjmp(png_jmpbuf(png))) {
55 png_destroy_read_struct( &png, &info, NULL );
56 vigra_postcondition( false, png_error_message.insert(0, "error in png_init_io(): ").c_str() );
57 }
58 png_init_io( png, file.get() );
59
60 // specify that the signature was already read
61 - if (setjmp(png->jmpbuf)) {
62 + if (setjmp(png_jmpbuf(png))) {
63 png_destroy_read_struct( &png, &info, NULL );
64 vigra_postcondition( false, png_error_message.insert(0, "error in png_set_sig_bytes(): ").c_str() );
65 }
66 @@ -241,13 +238,13 @@
67 void PngDecoderImpl::init()
68 {
69 // read all chunks up to the image data
70 - if (setjmp(png->jmpbuf))
71 + if (setjmp(png_jmpbuf(png)))
72 vigra_postcondition( false, png_error_message.insert(0, "error in png_read_info(): ").c_str() );
73 png_read_info( png, info );
74
75 // pull over the header fields
76 int interlace_method, compression_method, filter_method;
77 - if (setjmp(png->jmpbuf))
78 + if (setjmp(png_jmpbuf(png)))
79 vigra_postcondition( false, png_error_message.insert(0, "error in png_get_IHDR(): ").c_str() );
80 png_get_IHDR( png, info, &width, &height, &bit_depth, &color_type,
81 &interlace_method, &compression_method, &filter_method );
82 @@ -261,7 +258,7 @@
83
84 // transform palette to rgb
85 if ( color_type == PNG_COLOR_TYPE_PALETTE) {
86 - if (setjmp(png->jmpbuf))
87 + if (setjmp(png_jmpbuf(png)))
88 vigra_postcondition( false, png_error_message.insert(0, "error in png_palette_to_rgb(): ").c_str() );
89 png_set_palette_to_rgb(png);
90 color_type = PNG_COLOR_TYPE_RGB;
91 @@ -270,15 +267,10 @@
92
93 // expand gray values to at least one byte size
94 if ( color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8 ) {
95 -#if (PNG_LIBPNG_VER >= 10400)
96 - if (setjmp(png->jmpbuf))
97 - vigra_postcondition( false,png_error_message.insert(0, "error in png_set_expand_gray_1_2_4_to_8(): ").c_str());
98 + if (setjmp(png_jmpbuf(png)))
99 + vigra_postcondition(false,
100 + png_error_message.insert(0, "error in png_set_expand_gray_1_2_4_to_8(): ").c_str());
101 png_set_expand_gray_1_2_4_to_8(png);
102 -#else
103 - if (setjmp(png->jmpbuf))
104 - vigra_postcondition( false,png_error_message.insert(0, "error in png_set_gray_1_2_4_to_8(): ").c_str());
105 - png_set_gray_1_2_4_to_8(png);
106 -#endif
107 bit_depth = 8;
108 }
109
110 @@ -286,7 +278,7 @@
111 #if 0
112 // strip alpha channel
113 if ( color_type & PNG_COLOR_MASK_ALPHA ) {
114 - if (setjmp(png->jmpbuf))
115 + if (setjmp(png_jmpbuf(png)))
116 vigra_postcondition( false, png_error_message.insert(0, "error in png_set_strip_alpha(): ").c_str() );
117 png_set_strip_alpha(png);
118 color_type ^= PNG_COLOR_MASK_ALPHA;
119 @@ -317,8 +309,8 @@
120 }
121
122 // read resolution
123 - x_resolution = png_get_x_pixels_per_meter( png, info ) / 254.0;
124 - y_resolution = png_get_y_pixels_per_meter( png, info ) / 254.0;
125 + x_resolution = png_get_x_pixels_per_meter( png, info ) * 0.0254f;
126 + y_resolution = png_get_y_pixels_per_meter( png, info ) * 0.0254f;
127
128 // read offset
129 position.x = png_get_x_offset_pixels( png, info );
130 @@ -328,9 +320,13 @@
131 #if (PNG_LIBPNG_VER > 10008) && defined(PNG_READ_iCCP_SUPPORTED)
132 char * dummyName;
133 int dummyCompType;
134 +#if (PNG_LIBPNG_VER < 10500)
135 char * profilePtr;
136 +#else
137 + png_byte * profilePtr;
138 +#endif
139 png_uint_32 profileLen;
140 - if (info->valid & PNG_INFO_iCCP) {
141 + if (png_get_valid( png, info, PNG_INFO_iCCP )) {
142 png_get_iCCP(png, info, &dummyName, &dummyCompType, &profilePtr, &profileLen) ;
143 iccProfilePtr = (unsigned char *) profilePtr;
144 iccProfileLength = profileLen;
145 @@ -343,7 +339,7 @@
146 // image gamma
147 double image_gamma = 0.45455;
148 if ( png_get_valid( png, info, PNG_INFO_gAMA ) ) {
149 - if (setjmp(png->jmpbuf))
150 + if (setjmp(png_jmpbuf(png)))
151 vigra_postcondition( false, png_error_message.insert(0, "error in png_get_gAMA(): ").c_str() );
152 png_get_gAMA( png, info, &image_gamma );
153 }
154 @@ -352,26 +348,26 @@
155 double screen_gamma = 2.2;
156
157 // set gamma correction
158 - if (setjmp(png->jmpbuf))
159 + if (setjmp(png_jmpbuf(png)))
160 vigra_postcondition( false, png_error_message.insert(0, "error in png_set_gamma(): ").c_str() );
161 png_set_gamma( png, screen_gamma, image_gamma );
162 #endif
163
164 // interlace handling, get number of read passes needed
165 - if (setjmp(png->jmpbuf))
166 + if (setjmp(png_jmpbuf(png)))
167 vigra_postcondition( false,png_error_message.insert(0, "error in png_set_interlace_handling(): ").c_str());
168 n_interlace_passes = png_set_interlace_handling(png);
169
170 // update png library state to reflect any changes that were made
171 - if (setjmp(png->jmpbuf))
172 + if (setjmp(png_jmpbuf(png)))
173 vigra_postcondition( false, png_error_message.insert(0, "error in png_read_update_info(): ").c_str() );
174 png_read_update_info( png, info );
175
176 - if (setjmp(png->jmpbuf))
177 + if (setjmp(png_jmpbuf(png)))
178 vigra_postcondition( false,png_error_message.insert(0, "error in png_get_channels(): ").c_str());
179 n_channels = png_get_channels(png, info);
180
181 - if (setjmp(png->jmpbuf))
182 + if (setjmp(png_jmpbuf(png)))
183 vigra_postcondition( false,png_error_message.insert(0, "error in png_get_rowbytes(): ").c_str());
184 rowsize = png_get_rowbytes(png, info);
185
186 @@ -381,9 +377,10 @@
187
188 void PngDecoderImpl::nextScanline()
189 {
190 - for (int i=0; i < n_interlace_passes; i++) {
191 - if (setjmp(png->jmpbuf))
192 - vigra_postcondition( false,png_error_message.insert(0, "error in png_read_row(): ").c_str());
193 + if (setjmp(png_jmpbuf(png)))
194 + vigra_postcondition( false,png_error_message.insert(0, "error in png_read_row(): ").c_str());
195 + for (int i=0; i < n_interlace_passes; i++)
196 + {
197 png_read_row(png, row_data.begin(), NULL);
198 }
199 }
200 @@ -548,7 +545,7 @@
201 vigra_postcondition( png != 0, "could not create the write struct." );
202
203 // create info struct
204 - if (setjmp(png->jmpbuf)) {
205 + if (setjmp(png_jmpbuf(png))) {
206 png_destroy_write_struct( &png, &info );
207 vigra_postcondition( false, png_error_message.insert(0, "error in png_info_struct(): ").c_str() );
208 }
209 @@ -559,7 +556,7 @@
210 }
211
212 // init png i/o
213 - if (setjmp(png->jmpbuf)) {
214 + if (setjmp(png_jmpbuf(png))) {
215 png_destroy_write_struct( &png, &info );
216 vigra_postcondition( false, png_error_message.insert(0, "error in png_init_io(): ").c_str() );
217 }
218 @@ -574,7 +571,7 @@
219 void PngEncoderImpl::finalize()
220 {
221 // write the IHDR
222 - if (setjmp(png->jmpbuf))
223 + if (setjmp(png_jmpbuf(png)))
224 vigra_postcondition( false, png_error_message.insert(0, "error in png_set_IHDR(): ").c_str() );
225 png_set_IHDR( png, info, width, height, bit_depth, color_type,
226 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
227 @@ -582,16 +579,16 @@
228
229 // set resolution
230 if (x_resolution > 0 && y_resolution > 0) {
231 - if (setjmp(png->jmpbuf))
232 + if (setjmp(png_jmpbuf(png)))
233 vigra_postcondition( false, png_error_message.insert(0, "error in png_set_pHYs(): ").c_str() );
234 - png_set_pHYs(png, info, (png_uint_32) (x_resolution * 254 + 0.5),
235 - (png_uint_32) (y_resolution * 254 + 0.5),
236 + png_set_pHYs(png, info, (png_uint_32) (x_resolution / 0.0254 + 0.5),
237 + (png_uint_32) (y_resolution / 0.0254 + 0.5),
238 PNG_RESOLUTION_METER);
239 }
240
241 // set offset
242 if (position.x > 0 && position.y > 0) {
243 - if (setjmp(png->jmpbuf))
244 + if (setjmp(png_jmpbuf(png)))
245 vigra_postcondition( false, png_error_message.insert(0, "error in png_set_oFFs(): ").c_str() );
246 png_set_oFFs(png, info, position.x, position.y, PNG_OFFSET_PIXEL);
247 }
248 @@ -599,13 +596,17 @@
249 #if (PNG_LIBPNG_VER > 10008) && defined(PNG_WRITE_iCCP_SUPPORTED)
250 // set icc profile
251 if (iccProfile.size() > 0) {
252 - png_set_iCCP(png, info, "icc", 0,
253 - (char *)iccProfile.begin(), iccProfile.size());
254 + png_set_iCCP(png, info, (png_charp)("icc"), 0,
255 +#if (PNG_LIBPNG_VER < 10500)
256 + (png_charp)iccProfile.begin(), (png_uint_32)iccProfile.size());
257 +#else
258 + (png_byte*)iccProfile.begin(), (png_uint_32)iccProfile.size());
259 +#endif
260 }
261 #endif
262
263 // write the info struct
264 - if (setjmp(png->jmpbuf))
265 + if (setjmp(png_jmpbuf(png)))
266 vigra_postcondition( false, png_error_message.insert(0, "error in png_write_info(): ").c_str() );
267 png_write_info( png, info );
268
269 @@ -637,10 +638,10 @@
270 }
271
272 // write the whole image
273 - if (setjmp(png->jmpbuf))
274 + if (setjmp(png_jmpbuf(png)))
275 vigra_postcondition( false, png_error_message.insert(0, "error in png_write_image(): ").c_str() );
276 png_write_image( png, row_pointers.begin() );
277 - if (setjmp(png->jmpbuf))
278 + if (setjmp(png_jmpbuf(png)))
279 vigra_postcondition( false, png_error_message.insert(0, "error in png_write_end(): ").c_str() );
280 png_write_end(png, info);
281 }
282 @@ -688,8 +689,7 @@
283 pimpl->components = bands;
284 }
285
286 - void PngEncoder::setCompressionType( const std::string & comp,
287 - int quality )
288 + void PngEncoder::setCompressionType( const std::string & /* comp */, int /* quality */)
289 {
290 // nothing is settable => do nothing
291 }