autotrace-0.31.1-libpng-1.5.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. https://sourceforge.net/mailarchive/forum.php?thread_name=01e601cbc22e%24f45d7200%24dd185600%24%40acm.org&forum_name=png-mng-implement
  2. $NetBSD$
  3. Fix build with png-1.5.
  4. --- input-png.c.orig 2002-10-10 20:44:14.000000000 +0000
  5. +++ input-png.c
  6. @@ -42,17 +42,17 @@ static png_bytep * read_png(png_structp
  7. static void handle_warning(png_structp png, const at_string message) {
  8. LOG1("PNG warning: %s", message);
  9. - at_exception_warning((at_exception_type *)png->error_ptr,
  10. + at_exception_warning((at_exception_type *)png_get_error_ptr(png),
  11. message);
  12. - /* at_exception_fatal((at_exception_type *)at_png->error_ptr,
  13. + /* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png),
  14. "PNG warning"); */
  15. }
  16. static void handle_error(png_structp png, const at_string message) {
  17. LOG1("PNG error: %s", message);
  18. - at_exception_fatal((at_exception_type *)png->error_ptr,
  19. + at_exception_fatal((at_exception_type *)png_get_error_ptr(png),
  20. message);
  21. - /* at_exception_fatal((at_exception_type *)at_png->error_ptr,
  22. + /* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png),
  23. "PNG error"); */
  24. }
  25. @@ -157,8 +157,8 @@ read_png(png_structp png_ptr, png_infop
  26. png_set_strip_16(png_ptr);
  27. png_set_packing(png_ptr);
  28. - if ((png_ptr->bit_depth < 8) ||
  29. - (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
  30. + if ((png_get_bit_depth(png_ptr, info_ptr) < 8) ||
  31. + (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) ||
  32. (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
  33. png_set_expand(png_ptr);
  34. @@ -181,20 +181,10 @@ read_png(png_structp png_ptr, png_infop
  35. PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
  36. } else
  37. png_set_strip_alpha(png_ptr);
  38. + png_set_interlace_handling(png_ptr);
  39. png_read_update_info(png_ptr, info_ptr);
  40. -
  41. - info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
  42. - info_ptr->height * sizeof(png_bytep));
  43. -#ifdef PNG_FREE_ME_SUPPORTED
  44. - info_ptr->free_me |= PNG_FREE_ROWS;
  45. -#endif
  46. - for (row = 0; row < (int)info_ptr->height; row++)
  47. - info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
  48. - png_get_rowbytes(png_ptr, info_ptr));
  49. -
  50. - png_read_image(png_ptr, info_ptr->row_pointers);
  51. - info_ptr->valid |= PNG_INFO_IDAT;
  52. + png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
  53. png_read_end(png_ptr, info_ptr);
  54. return png_get_rows(png_ptr, info_ptr);
  55. }