shithub: riscv

Download patch

ref: 5654f15e56087986812c557412d558482383fc8b
parent: a78f5f8a3d72fc18c9bb734e066f45e9a3be5ab0
author: cinap_lenrek <[email protected]>
date: Tue Jul 17 04:51:20 EDT 2012

png: sysfatal, debug print to stderr instead of potentialy messing up output stream

--- a/sys/src/cmd/jpg/readpng.c
+++ b/sys/src/cmd/jpg/readpng.c
@@ -175,6 +175,8 @@
 	int i;
 
 	switch(alg){
+	default:
+		fprint(2, "unknown filtering scheme %d\n", alg);
 	case FilterNone:
 		break;
 
@@ -201,9 +203,6 @@
 		for(; i < len; ++i)
 			buf[i] += paeth(buf[i-bypp], up[i], up[i-bypp]);
 		break;
-
-	default:
-		sysfatal("unknown filtering scheme %d\n", alg);
 	}
 }
 
@@ -312,7 +311,7 @@
 	else
 		n = (dx+adx-1)/adx;
 	if(n != 1 + (z->dx - (adam7[z->pass].x+1)) / adam7[z->pass].dx){
-		print("%d/%d != 1+(%d-1)/%d = %d\n",
+		fprint(2, "%d/%d != 1+(%d-1)/%d = %d\n",
 			z->dx - adam7[z->pass].x - 1 + adx, adx,
 			z->dx - (adam7[z->pass].x+1), adam7[z->pass].dx,
 			1 + (z->dx - (adam7[z->pass].x+1)) / adam7[z->pass].dx);