Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: src/images/SkImageDecoder_libpng.cpp

Issue 68453006: Clean up after longjmp in SkImageDecoder_libpng. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); 248 png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
249 return false; 249 return false;
250 } 250 }
251 *info_ptrp = info_ptr; 251 *info_ptrp = info_ptr;
252 252
253 /* Set error handling if you are using the setjmp/longjmp method (this is 253 /* Set error handling if you are using the setjmp/longjmp method (this is
254 * the normal method of doing things with libpng). REQUIRED unless you 254 * the normal method of doing things with libpng). REQUIRED unless you
255 * set up your own error handlers in the png_create_read_struct() earlier. 255 * set up your own error handlers in the png_create_read_struct() earlier.
256 */ 256 */
257 if (setjmp(png_jmpbuf(png_ptr))) { 257 if (setjmp(png_jmpbuf(png_ptr))) {
258 png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
258 return false; 259 return false;
259 } 260 }
260 261
261 /* If you are using replacement read functions, instead of calling 262 /* If you are using replacement read functions, instead of calling
262 * png_init_io() here you would call: 263 * png_init_io() here you would call:
263 */ 264 */
264 png_set_read_fn(png_ptr, (void *)sk_stream, sk_read_fn); 265 png_set_read_fn(png_ptr, (void *)sk_stream, sk_read_fn);
265 #ifdef SK_BUILD_FOR_ANDROID 266 #ifdef SK_BUILD_FOR_ANDROID
266 png_set_seek_fn(png_ptr, sk_seek_fn); 267 png_set_seek_fn(png_ptr, sk_seek_fn);
267 #endif 268 #endif
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 return SkImageDecoder::kUnknown_Format; 1292 return SkImageDecoder::kUnknown_Format;
1292 } 1293 }
1293 1294
1294 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { 1295 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
1295 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL; 1296 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL;
1296 } 1297 }
1297 1298
1298 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); 1299 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory);
1299 static SkImageDecoder_FormatReg gFormatReg(get_format_png); 1300 static SkImageDecoder_FormatReg gFormatReg(get_format_png);
1300 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); 1301 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698