[simage] 01/03: Replace stderr by stdout in example.
Anton Gladky
gladk at moszumanska.debian.org
Tue Sep 6 18:04:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
gladk pushed a commit to branch master
in repository simage.
commit d223a78f244cedca259a3393d62278c43857c2cb
Author: Anton Gladky <gladk at debian.org>
Date: Tue Sep 6 19:59:37 2016 +0200
Replace stderr by stdout in example.
---
configure | 13 -------------
debian/patches/series | 1 +
examples/simage-convert.c | 38 +++++++++++++++++++-------------------
examples/simage-read-line-test.c | 18 +++++++++---------
src/simage_png.c | 2 +-
5 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/configure b/configure
index 78161c2..c317bf0 100755
--- a/configure
+++ b/configure
@@ -5143,19 +5143,6 @@ $as_echo "$sim_ac_msvcrt" >&6; }
fi
-# Figure out if we want a static or shared library.
-case ${enable_static-no} in
-true | yes) SIMAGE_STATIC=true
- enable_shared=no ;; # fix --enable-static problem. 20041021 larsa
-*) SIMAGE_STATIC=false ;;
-esac
-
-case ${enable_shared-default} in
-default) ;;
-true | yes) SIMAGE_STATIC=false ;;
-*) SIMAGE_STATIC=true ;;
-esac
-
# **************************************************************************
# Check to see if fink is installed on the system
diff --git a/debian/patches/series b/debian/patches/series
index 483488e..929c1f4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
01_configure-shared-static.patch
libpng16.patch
+10_change_stderr.patch
diff --git a/examples/simage-convert.c b/examples/simage-convert.c
index db7b125..25cf9af 100644
--- a/examples/simage-convert.c
+++ b/examples/simage-convert.c
@@ -28,7 +28,7 @@
static void
usage(const char * argv0)
{
- fprintf(stderr, "Usage:\n %s <infile> <outfile> [-newsize <x> <y>] [-scale <xmul> <ymul>] [-alphathreshold <val>] [-addalpha <filename>] [-setundef]\n",argv0);
+ fprintf(stdout, "Usage:\n %s <infile> <outfile> [-newsize <x> <y>] [-scale <xmul> <ymul>] [-alphathreshold <val>] [-addalpha <filename>] [-setundef]\n",argv0);
}
int main(int argc, char ** argv)
@@ -124,30 +124,30 @@ int main(int argc, char ** argv)
else {
ext = strrchr(outfile, '.');
if (ext == NULL) {
- fprintf(stderr,"outfile has no valid extension\n");
+ fprintf(stdout,"outfile has no valid extension\n");
return -1;
}
else {
ext++; /* skip period */
if (!simage_check_save_supported(ext)) {
- fprintf(stderr,"Extension '%s' not supported for writing by simage\n",
+ fprintf(stdout,"Extension '%s' not supported for writing by simage\n",
ext);
save = 0;
}
}
}
- fprintf(stderr,"read image: %s...", infile);
+ fprintf(stdout,"read image: %s...", infile);
buf = simage_read_image(infile, &w, &h, &nc);
if (buf) {
- fprintf(stderr,"done\n");
+ fprintf(stdout,"done\n");
}
else {
- fprintf(stderr,"Unable to read file\n", argv[1]);
+ fprintf(stdout,"Unable to read file\n", argv[1]);
return -1;
}
- fprintf(stderr,"image size: (%d, %d), components: %d\n",
+ fprintf(stdout,"image size: (%d, %d), components: %d\n",
w, h, nc);
if (xmul > 0.0f) {
@@ -157,11 +157,11 @@ int main(int argc, char ** argv)
if (neww > 0 && newh > 0 && (neww != w || newh != h)) {
unsigned char * newbuf;
- fprintf(stderr,"resizing image: (%d, %d) to (%d %d)...",
+ fprintf(stdout,"resizing image: (%d, %d) to (%d %d)...",
w, h, neww, newh);
newbuf = simage_resize(buf, w, h, nc,
neww, newh);
- fprintf(stderr,"done\n");
+ fprintf(stdout,"done\n");
simage_free_image(buf);
buf = newbuf;
w = neww;
@@ -173,12 +173,12 @@ int main(int argc, char ** argv)
int ac;
int w2, h2, nc2;
unsigned char * buf2 = simage_read_image(addalpha, &w2, &h2, &nc2);
- fprintf(stderr,"alpha size: %d %d %d\n", w2, h2, nc2);
+ fprintf(stdout,"alpha size: %d %d %d\n", w2, h2, nc2);
if (buf2) {
if (w == w2 && h == h2 && (nc2 == 1 || nc2 == 2 || nc2 == 4)) {
unsigned char * dstbuf = buf;
if (nc == 1 || nc == 3) {
- fprintf(stderr,"adding alpha channel\n");
+ fprintf(stdout,"adding alpha channel\n");
dstbuf = (unsigned char*) malloc(w*h*(nc+1));
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
@@ -193,7 +193,7 @@ int main(int argc, char ** argv)
if (nc2 == 2) ac = 1;
if (nc2 == 4) ac = 3;
- fprintf(stderr,"merging in alpha channel\n");
+ fprintf(stdout,"merging in alpha channel\n");
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
dstbuf[y*w*nc + x*nc + (nc-1)] = buf2[y*w*nc2 + x * nc2 + ac];
@@ -205,11 +205,11 @@ int main(int argc, char ** argv)
}
}
else {
- fprintf(stderr,"Unable to add alpha channel\n");
+ fprintf(stdout,"Unable to add alpha channel\n");
}
}
else {
- fprintf(stderr,"Unable to read alpha file: %s\n", addalpha);
+ fprintf(stdout,"Unable to read alpha file: %s\n", addalpha);
}
}
@@ -238,7 +238,7 @@ int main(int argc, char ** argv)
}
p++;
}
- fprintf(stderr,"alpha threshold changed %d pixels\n", cnt);
+ fprintf(stdout,"alpha threshold changed %d pixels\n", cnt);
}
if (gray && nc >= 3) {
@@ -272,7 +272,7 @@ int main(int argc, char ** argv)
}
p += nc;
}
- fprintf(stderr,"undef'ed %d pixels\n", cnt);
+ fprintf(stdout,"undef'ed %d pixels\n", cnt);
}
if (mirrory) {
unsigned char * tmp = (unsigned char*) malloc(w*nc);
@@ -288,15 +288,15 @@ int main(int argc, char ** argv)
}
if (save) {
- fprintf(stderr,"save image '%s'...", outfile);
+ fprintf(stdout,"save image '%s'...", outfile);
ret = simage_save_image(argv[2], buf, w, h, nc, ext);
simage_free_image(buf);
if (ret != 1) {
- fprintf(stderr,"error: %s\n", simage_get_last_error());
+ fprintf(stdout,"error: %s\n", simage_get_last_error());
return -1;
}
else {
- fprintf(stderr,"done\n");
+ fprintf(stdout,"done\n");
}
}
return 0;
diff --git a/examples/simage-read-line-test.c b/examples/simage-read-line-test.c
index ae54dbd..12ae3b9 100644
--- a/examples/simage-read-line-test.c
+++ b/examples/simage-read-line-test.c
@@ -28,7 +28,7 @@
static void
usage(const char * argv0)
{
- fprintf(stderr, "Usage:\n %s <infile>\n");
+ fprintf(stdout, "Usage:\n %s <infile>\n");
}
int main(int argc, char ** argv)
@@ -48,7 +48,7 @@ int main(int argc, char ** argv)
image = s_image_open(argv[1], 1);
if (!image) {
- fprintf(stderr,"Unable to open file: %s\n" ,argv[1]);
+ fprintf(stdout,"Unable to open file: %s\n" ,argv[1]);
return -1;
}
@@ -56,28 +56,28 @@ int main(int argc, char ** argv)
h = s_image_height(image);
nc = s_image_components(image);
- fprintf(stderr,"testing file: %s, %d %d %d\n", argv[1], w, h, nc);
+ fprintf(stdout,"testing file: %s, %d %d %d\n", argv[1], w, h, nc);
row = (unsigned char*) malloc(w*nc);
- fprintf(stderr,"testing step: %s, %d %d %d\n", argv[1], w, h, nc);
+ fprintf(stdout,"testing step: %s, %d %d %d\n", argv[1], w, h, nc);
for (i = 0; i < h; i += 146) {
if (!s_image_read_line(image, i, row)) {
- fprintf(stderr,"failed to read line %d\n", i);
+ fprintf(stdout,"failed to read line %d\n", i);
}
}
- fprintf(stderr,"testing normal: %s, %d %d %d\n", argv[1], w, h, nc);
+ fprintf(stdout,"testing normal: %s, %d %d %d\n", argv[1], w, h, nc);
for (i = 0; i < h; i++) {
if (!s_image_read_line(image, i, row)) {
- fprintf(stderr,"failed to read line %d\n", i);
+ fprintf(stdout,"failed to read line %d\n", i);
}
}
- fprintf(stderr,"testing backwards: %s, %d %d %d\n", argv[1], w, h, nc);
+ fprintf(stdout,"testing backwards: %s, %d %d %d\n", argv[1], w, h, nc);
for (i = h-1; i >=0; i--) {
if (!s_image_read_line(image, i, row)) {
- fprintf(stderr,"failed to read line %d\n", i);
+ fprintf(stdout,"failed to read line %d\n", i);
}
}
diff --git a/src/simage_png.c b/src/simage_png.c
index 8d0a2e1..d85cba0 100644
--- a/src/simage_png.c
+++ b/src/simage_png.c
@@ -342,7 +342,7 @@ simage_png_save(const char *filename,
/* Set error handling. REQUIRED if you aren't supplying your own
* error hadnling functions in the png_create_write_struct() call.
*/
- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
/* If we get here, we had a problem reading the file */
fclose(fp);
png_destroy_write_struct(&png_ptr, (png_infopp)info_ptr);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/simage.git
More information about the debian-science-commits
mailing list