~ubuntu-branches/ubuntu/saucy/links2/saucy-proposed

« back to all changes in this revision

Viewing changes to png.c

  • Committer: Bazaar Package Importer
  • Author(s): Axel Beckert
  • Date: 2011-08-18 23:35:41 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110818233541-3x10px37rwkortla
Tags: 2.3-1
* New upstream release.
  + Refreshed patches links2-instead-of-links.diff and ipv6.diff
  + Fixes downloads of files larger than 4GB (Closes: #610418)
* Fix debian/watch so that upstream versions are sorted properly; add
  and prefer bzip2 compressed upstream tarballs.
* Add missing bug number for IPv6 patch in the previous changelog entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
          
31
31
/* Decoder structs */
32
32
 
33
 
/* prototypes */
34
 
void img_my_png_warning(png_structp, png_const_charp);
35
 
void img_my_png_error(png_structp, png_const_charp);
36
 
void png_info_callback(png_structp, png_infop);
37
 
void a2char_from_unsigned_short(unsigned char *, unsigned short *, int);
38
 
void unsigned_short_from_2char(unsigned short *, unsigned char *, int);
39
 
void png_row_callback(png_structp, png_bytep, png_uint_32, int);
40
 
void png_end_callback(png_structp, png_infop);
41
 
 
42
 
 
43
33
/* Warning for from-web PNG images */
44
 
void img_my_png_warning(png_structp a, png_const_charp b)
 
34
static void img_my_png_warning(png_structp a, png_const_charp b)
45
35
{
46
36
}
47
37
 
48
38
/* Error for from-web PNG images. */
49
 
void img_my_png_error(png_structp png_ptr, png_const_charp error_string)
 
39
static void img_my_png_error(png_structp png_ptr, png_const_charp error_string)
50
40
{
 
41
#if (PNG_LIBPNG_VER < 10500)
51
42
        longjmp(png_ptr->jmpbuf,1);
 
43
#else
 
44
        png_longjmp(png_ptr,1);
 
45
#endif
52
46
}
53
47
 
54
 
void png_info_callback(png_structp png_ptr, png_infop info_ptr)
 
48
static void png_info_callback(png_structp png_ptr, png_infop info_ptr)
55
49
{
56
50
        int bit_depth, color_type, intent;
57
51
        double gamma;
115
109
                img_my_png_error(png_ptr, "bad image size");
116
110
}
117
111
 
 
112
#ifdef REPACK_16
118
113
/* Converts unsigned shorts to doublechars (in big endian) */
119
 
void a2char_from_unsigned_short(unsigned char *chr, unsigned short *shrt, int len)
 
114
static void a2char_from_unsigned_short(unsigned char *chr, unsigned short *shrt, int len)
120
115
{
121
116
        unsigned short s;
122
117
 
128
123
}
129
124
 
130
125
/* Converts doublechars (in big endian) to unsigned shorts */
131
 
void unsigned_short_from_2char(unsigned short *shrt, unsigned char *chr, int len)
 
126
static void unsigned_short_from_2char(unsigned short *shrt, unsigned char *chr, int len)
132
127
{
133
128
        unsigned short s;
134
129
        
137
132
                *shrt=s;
138
133
        }
139
134
}
 
135
#endif
140
136
 
141
 
void png_row_callback(png_structp png_ptr, png_bytep new_row, png_uint_32
 
137
static void png_row_callback(png_structp png_ptr, png_bytep new_row, png_uint_32
142
138
        row_num, int pass)
143
139
{
144
140
        struct cached_image *cimg;
182
178
        cimg->rows_added=1;
183
179
}
184
180
 
185
 
void png_end_callback(png_structp png_ptr, png_infop info)
 
181
static void png_end_callback(png_structp png_ptr, png_infop info)
186
182
{
187
183
        end_callback_hit=1;
188
184
}
204
200
#ifdef DEBUG
205
201
        if (!info_ptr) internal ("png_create_info_struct failed\n");
206
202
#endif /* #ifdef DEBUG */
207
 
        if (setjmp(png_ptr->jmpbuf)){
 
203
        if (setjmp(png_jmpbuf(png_ptr))){
208
204
error:
209
205
                png_destroy_read_struct(&png_ptr, &info_ptr,
210
206
                        (png_infopp)NULL);
214
210
        png_set_progressive_read_fn(png_ptr, NULL,
215
211
                                    png_info_callback, png_row_callback,
216
212
                                    png_end_callback);
217
 
        if (setjmp(png_ptr->jmpbuf)) goto error;
 
213
        if (setjmp(png_jmpbuf(png_ptr))) goto error;
218
214
        decoder=mem_alloc(sizeof(*decoder));
219
215
        decoder->png_ptr=png_ptr;
220
216
        decoder->info_ptr=info_ptr;
233
229
        png_ptr=((struct png_decoder *)(cimg->decoder))->png_ptr;
234
230
        info_ptr=((struct png_decoder *)(cimg->decoder))->info_ptr;
235
231
        end_callback_hit=0;
236
 
        if (setjmp(png_ptr->jmpbuf)){
 
232
        if (setjmp(png_jmpbuf(png_ptr))){
237
233
                img_end(cimg);
238
234
                return;
239
235
        }