#! /bin/sh /usr/share/dpatch/dpatch-run ## 10_write_text_comment.dpatch by Erik Schanze ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: change from internal functions to public library functions ## DP: and clarify if/else construct, because of compiler warning @DPATCH@ diff -urNad gif2png-2.5.1~/gif2png.c gif2png-2.5.1/gif2png.c --- gif2png-2.5.1~/gif2png.c 2002-05-10 16:06:02.000000000 +0200 +++ gif2png-2.5.1/gif2png.c 2005-10-03 16:34:12.998396803 +0200 @@ -135,7 +135,7 @@ unsigned long hist_maxvalue; int passcount; int errtype, errorcount = 0; - png_text software; + png_text software, comment; /* these volatile declarations prevent gcc warnings ("variable might be * clobbered by `longjmp' or `vfork'") */ @@ -517,11 +517,17 @@ j = s->size; if (j > 0 && data[j-1] == '\0') /* some apps include a NULL in GIF comment */ --j; - if (j<500) { - png_write_tEXt(png_ptr, "Comment", (png_charp)data, j); + + comment.key = "Comment"; + comment.text = (png_charp)data; + comment.text_length = j; + + if (j<500) { + comment.compression = PNG_TEXT_COMPRESSION_NONE; } else { - png_write_zTXt(png_ptr, "Comment", (png_charp)data, j, 0); + comment.compression = PNG_TEXT_COMPRESSION_zTXt; } + png_set_text(png_ptr, info_ptr, &comment, 1); break; case GIFapplication: @@ -674,22 +680,27 @@ return 1; if (webconvert) + { if (num_pics != 1) { fprintf(stderr, "gif2png: %s is multi-image\n", fname); return 0; } - else if (!transparent_ok - && current->imagestruct && current->imagestruct->trans != -1) - { - fprintf(stderr, "gif2png: %s has a transparency color\n", fname); - return 0; - } else - { - printf("%s\n", fname); - return 0; - } + { + if (!transparent_ok + && current->imagestruct && current->imagestruct->trans != -1) + { + fprintf(stderr, "gif2png: %s has a transparency color\n", fname); + return 0; + } + else + { + printf("%s\n", fname); + return 0; + } + } + } /* eliminate use of transparency, if that is called for */ if (matte)